PeakGen
PeakGen

Reputation: 23035

Finding "Missing" objects in image using openCV

Please have a look at the following 2 images

Image 1

enter image description here

Image 2

enter image description here

In image 1, you can see there is a Mat on wall, and in image2 the mat is missing. Now, I am going to insert the Image1 as the first image and Image2 as the second and going to find what is missing. Then, I need to draw a rectangle above the missing object.

In my program, I will check for this in each and every our.

I can't think about something else than "image difference" which is "absDiff()" method. But I am using this technique for motion detection in the same application, so I am not sure whether the same technique will suit for "Finding Missing objects" (because in that case, how this is going to be different from motion detection" ?

Any ideas about how i can find the missing objects like this?

Upvotes: 5

Views: 2757

Answers (3)

TwinPenguins
TwinPenguins

Reputation: 495

Although I am 7 years late to get to this question, but since I was struggling to find the best way to solve this problem for a whole now, I thought I would share this great solution by Adrian Rosebrock at pyimagesearch. He uses the Structural Similarity Index (SSIM) between the two images to find distinct differences (what I needed), and based on the computed differences, he finds the contours to place rectangles around the regions identified as “different”. I find it very effective for a 'template matching' or identifying 'anomalies' in an image when compared to a golden image, which is able to handle missing objects too.

Upvotes: 1

Dino
Dino

Reputation: 609

You could try something like looking for points of interest on both images and then look at the areas where are points that were not matched between pictures.

Upvotes: 1

ChronoTrigger
ChronoTrigger

Reputation: 8617

Well, this is also a kind of motion detection, since you can think the Mat has move out of the scene. If your images are aligned (i.e. if the camera is placed at the same position), image subtraction is a good way to begin with. With this you can have a clue of what objects have appeared or disappeared. Note that this technique is not suitable if you allow your Mat to appear in the image but at a different position.

On the other hand, if you are watching that certain Mat, you can go with object detection, so that if you are not able to detect the object in the image, you can suppose the object has been stolen. You can achieve this by extracting features from an image of the object (e.g. SURF) and matching these later with features extracted from your webcam image. If that black Mat must be always on a white wall, detecting blobs with those colors may be useful as well.

Upvotes: 1

Related Questions