读取图像

 1 Mat readImage(string path)
 2 {
 3     std::ifstream file("cr.tif", std::ios::binary);
 4     std::vector<char> data;
 5     file >>noskipws;
 6     copy(istream_iterator<char>(file),istream_iterator<char>(), back_inserter(data));
 7     Mat jpegimage = imdecode(data, CV_LOAD_IMAGE_COLOR);
 8     file.close();
 9     return jpegimage;
10 
11 }
原文地址:https://www.cnblogs.com/hsy1941/p/11704570.html