1 | initial version |
You can do something like this to print hex value
Mat img1 = imread("g:/lib/opencv/samples/data/rubberwhale2.png", IMREAD_COLOR);
Mat img2 = imread("g:/lib/opencv/samples/data/rubberwhale1.png", IMREAD_COLOR);
Mat d1,d2;
Ptr<cv::img_hash::AverageHash> m= cv::img_hash::AverageHash::create();
m->compute(img1, d1);
m->compute(img2, d2);
for (int i = 0; i<d1.cols; i++)
cout << std::hex<<int(d1.at<uchar>(0, i)) << "\t";
cout << "\n";
for (int i = 0; i<d2.cols; i++)
cout << std::hex<<int(d2.at<uchar>(0, i)) << "\t";
cout << "\n";
and to get hamming norm :
cout <<"Hamming norm "<< norm(d1, d2, NORM_HAMMING)<<"\n";