How to subtracrt one image from another image?

asked 2016-11-19 21:56:15 -0600

If i subtract one image from another image which are merely same then i want output as 0.

plzz..

edit retag flag offensive close merge delete

Comments

well this is a little unclear, atm., can you try to explain it better ? do you have an example ?

berak gravatar imageberak ( 2016-11-20 01:31:27 -0600 )edit

I guess you want to do the following?

Mat image = imread("1circle.png", CV_LOAD_IMAGE_GRAYSCALE); //get image 1
Mat image2 = imread("1circlecut.jpg", CV_LOAD_IMAGE_GRAYSCALE); //get image 2
Mat res = image2 - image; //substract image 2 from 1
threshold(res, res, 200, 255, THRESH_TOZERO); //set pixel beneath intensity 200 to 0
Ice_T02 gravatar imageIce_T02 ( 2016-11-21 09:59:50 -0600 )edit