我想比较两个二值图像并得到一个输出结果。
我该怎么做??
我可以使用 cvSobel() 来做到这一点吗??
二值图像有白色边缘,有没有办法计算白色像素或其他东西???
谢谢!
最佳答案
尝试简历::比较: http://opencv.willowgarage.com/documentation/cpp/operations_on_arrays.html#cv-compare
cv::Mat img1 = ...
cv::Mat img2 = ...
cv::Mat result = ...
int threshold = (double)(img1.rows * img1.cols) * 0.7;
cv::compare(img1 , img2 , result , cv::CMP_EQ );
int similarPixels = countNonZero(result);
if ( similarPixels > threshold ) {
cout << "similar" << endl;
}
关于c++ - OpenCV 和 C++;比较两个二进制图像并获得输出(结果),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6953106/