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 }