Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting Missing Objects

I want to detect missing objects of an image. Here is the situation

  1. You have an image of a room. There is a ball in the room.
  2. You have another image of the same room (Light conditions similar). The only difference is, the ball is missing.
  3. Now I need to opencv to compare these 2 images and find what is missing.

I know the first step of doing this, and that is calculating the histogram of both the images and comparing them . If something is missing from the second image, then the histogram values will differ.

Now, how to detect that "ball" is missing? Using template matching?

like image 325
PeakGen Avatar asked Sep 24 '26 08:09

PeakGen


1 Answers

As stated in comments, you can easily subtract those 2 images. IIRC Mat has overloaded - [minus] operator. So sub = img1 - img2; should be enough as long as imgs are cv::Mat objects.

About the blobs take a look at following tutorials at OpenCV website:

http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html

http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/hull/hull.html

http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html

like image 112
jnovacho Avatar answered Sep 26 '26 23:09

jnovacho



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!