Reputation: 464
I have an app that needs to take two photos of a room and detect if one of the objects in the first photos is missing in the second photo. How can it do it using OpenCV or any other tool?
Upvotes: 2
Views: 2309
Reputation: 434
If your object of interest has well known structure - i.e. it's an augmented reality marker, then this task is well described and almost trivial to implement. If you don't have a priori knowledge about the missing object, the only thing you can do is to compare 2 photos i.e. like in panorama stitching which can be done with SIFT or SURF (please read further about these). If the object is more complicated and if both the images were taken with similar field of view and the model of the missing object is known a priori (i.e. you have a picture of the object of interest and ONLY it), you can use SIFT or SURF to detect features both in the a priori model image and in the input image (the one where you want to find the missing object), perform feature matching and look for the densest cluster of matching features (i.e. use particle swarm optimization algorithm). You need to be aware that this won't work in every case and might give you quite a lot of false-positives. Disturbances such as the object looking different from every side, differences in lighting, partial occlusions etc will easily break this model. This approach does not require dewarping of the image etc. since SIFT is scale, translation and rotation invariant.
There are plenty of more robust methods for this, including deep learning (look for scientific papers on object detection), but the one with feature matching seems to be the easiest thing to try first.
Upvotes: 2