Ask Your Question

Blocked camera detection using opencv

asked 2019-09-10 11:10:54 -0500

Nazzal gravatar image

Hi all .. I am developing a camera state monitoring service using opencv in Python, am facing a problem in detecting if a camera view is blocked by an obstruction (obstacle) ,, how can i detect such case using opencv in Windows platform

edit retag flag offensive close merge delete


Do you have image to show what is look like? I am using Raspberry pi 3/4 using Debian Buster ver 10.

supra56 gravatar imagesupra56 ( 2019-09-12 07:51:28 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2019-09-11 05:04:34 -0500

dbots94 gravatar image

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.

edit flag offensive delete link more


thanks will try it.. my case is a camera monitoring a street with car passing all day, traffic will be different during the day, I can have a baseline image to compare with, I will try ur idea and will update the results here

Nazzal gravatar imageNazzal ( 2019-09-14 01:41:07 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-09-10 11:10:54 -0500

Seen: 53 times

Last updated: Sep 10 '19