saving and loading mat histogram [closed]
i already have my histogram, now i want to save the histogram data and call it back to do comparison. But when I try to show the image of "histogram1" and "histogram2" it gives unhandled exception error. here's my code
// save file
Mat result1
Mat result2
cv::FileStorage fs("results_file.yml", cv::FileStorage::WRITE);
fs << "result1" << result1 ;
fs << "result2" << result2 ;
fs.release();
// load file
cv::FileStorage fs("results_file.yml", cv::FileStorage::READ);
Mat histogram1 ;
Mat histogram2 ;
fs["result1"] >> histogram1 ;
fs["result2"] >> histogram2 ;
fs.release();
imshow("histogram1",histogram1);
imshow("histogram2",histogram2);
what's the exception, exactly ?
besides, a histogram is not an image. you'd have to draw bars or similar to visualize it.
my crystal ball tells me: you're throwing a 2 channel histogram mat at imshow(), which can only handle 1,3 or 4 channel input
Nice to see you can guess the future @berak!
we'll see about that ;)