I have 2 cv::Mat array (with same size), and when I want to compare them (if identical), I used cv::compare
cv::compare(mat1,mat2,dst,cv::CMP_EQ);
Is there any function that return true/false?
If you need to compare 2 cv::Mat by sizes, then you might check
if(mat1.size() == mat2.size())
//do stuff
else
//do other stuff
If you need to check if 2 cv::Mat are equal, you can perform the AND XOR operator and check if the result is a cv::Mat full of zeros:
cv::bitwise_xor(mat1, mat2, dst);
if(cv::countNonZero(dst) > 0) //check non-0 pixels
//do stuff in case cv::Mat are not the same
else
//do stuff in case they are equal
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With