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).
Share
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: