PeakGen
PeakGen

Reputation: 23035

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?

Upvotes: 3

Views: 2202

Answers (1)

jnovacho
jnovacho

Reputation: 2903

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

Upvotes: 3

Related Questions