How to do Addition and Subtraction of Binary image

asked 2015-05-31 07:49:49 -0600

nistar gravatar image

Mat result = img1 + img2;

imshow("h", result);

Mat re1 = result1 - img1;

imshow("h1", re1);

img1 and img2 are Binary image.

But image 're1' have other color, no only have White and Black

image description

How to solve this problem???????

I think that the matrix 'result' and 're1' establish in the type of binary image matrix. But I don't know what to do.

edit retag flag offensive close merge delete

Comments

1

Hi, add and substraction methods in binary image are bit operation,you can use bitwise-and, bitwise-not,bitwise-or to do what you want:)

wuling gravatar imagewuling ( 2015-05-31 08:27:23 -0600 )edit

I used 'bitwise_and(img1,img2,result)' Pero have other color, too.

nistar gravatar imagenistar ( 2015-05-31 12:09:33 -0600 )edit

it's a bit unclear, what you want to achieve.

berak gravatar imageberak ( 2015-06-01 00:55:38 -0600 )edit