c++ - OpenCV 和 C++;比较两个二进制图像并获得输出(结果)

标签 c++ image opencv binary edge-detection

我想比较两个二值图像并得到一个输出结果。

我该怎么做??

我可以使用 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/

相关文章:

c++ - 为什么unordered_map没有rbegin()和rend(),而只有begin()和end()

c++ - 删除两个集合交集中元素的算法

java - ImageIO.write 不起作用?

c++ - 更改 RGB 值

c++ - 并发 vector 的安全性

c++ - 如何使用迭代器修改对象?使用 <列表>

python - 如何在 PIL 中缩放动画 GIF 图像并保留动画

java - 我可以将图像渐变指定给矩形吗

python - 使用深度信息处理图像

android - OpenCV 相机方向问题