OpenCV - Intersection between two binary images

前端 未结 2 1580
青春惊慌失措
青春惊慌失措 2021-02-01 20:57

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 imag

2条回答
  •  梦毁少年i
    2021-02-01 21:35

    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:

    image 1 image 2

    Here is the result of applying cv::bitwise_and:

    imgAnd

    Here is the result of applying cv::bitwise_or:

    imgOr

    Here is the result of applying cv::bitwise_xor:

    imgXor

提交回复
热议问题