1 | initial version |
Considering that you won't move the camera, you can save an image of your background, and then you would compare the camera view with the background. You can use cv::absdiff() to perform the difference between the 2 images and then analyse the generated subtraction matrix. If the majority of the images is different, then you have an object obstructing the camera( the subtraction matrix will have higher values than one without any obstruction). Try to perform the comparition with the RGB image, and with a grayscale copy and see the differences.