OpenCV-两个二进制图像之间的交集 [英] OpenCV - Intersection between two binary images
问题描述
比方说,我有两个相同大小的二进制图像.如何找到两个二进制图像之间的交点?在两个白色(灰色-255)图像上,只有坐标(位置)相同的像素才会在输出图像(相交)上给出白色像素.
您可以使用 cvAnd 或 cv: :bitwise_and 在两个图像上.仅当两个输入图像均为白色时,结果图像才会为白色.
这是应用 cv ::的结果: bitwise_and , cv :: bitwise_or 并在二进制图像上 cv :: bitwise_xor : /p>
这是两个源图像:
这是应用 cv :: bitwise_and :
这是应用 cv :: bitwise_or :
这是应用 cv :: bitwise_xor :
Let's say I have two binary images of the same size. How do I find the intersection between the two binary images? Only pixels of the same coordinate (location) on the two images that are white (gray - 255) will give white pixels on the output image (intersection).
You can use cvAnd or cv::bitwise_and on the two images. The resulting image will be white only where both the input images are white.
EDIT: Here are the results of applying cv::bitwise_and, cv::bitwise_or and cv::bitwise_xor on binary images:
These are the two source images:
Here is the result of applying cv::bitwise_and:
Here is the result of applying cv::bitwise_or:
Here is the result of applying cv::bitwise_xor:
这篇关于OpenCV-两个二进制图像之间的交集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!