Ask Your Question
0

Is there any openCV functionality that finds differences in images?

asked 2015-01-28 13:42:30 -0600

Potato gravatar image

I want to have a base image, say a picture of an empty theater. Another test image, the same theater with one person sitting on a seat. The output should circle the person showing that, that is the difference in the two images. Is there any functionality that would support this?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2015-01-28 14:42:36 -0600

Guanta gravatar image

Of course you can subtract two images using OpenCV. Something like this should work:

cv::Mat1f img1 = cv::imread("image1.png", cv::LOAD_IMAGE_GRAYSCALE);
cv::Mat1f img2 = cv::imread("image2.png", cv::LOAD_IMAGE_GRAYSCALE);

cv::Mat1f sub = img1 - img2; // Now all pixels != 0 are different pixels

From here on you can proceed further, some possible involved steps:

edit flag offensive delete link more

Comments

Great! Thank you for your help. I was able to achieve what I wanted to do.

Potato gravatar imagePotato ( 2015-01-29 15:35:33 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-01-28 13:42:30 -0600

Seen: 806 times

Last updated: Jan 28 '15