0
$\begingroup$

I want to detect door blockage on a camera. Basically if the exit door is blocked by an object, it detects it as an anomaly. How can we do it? Is it possible to do it using OpenCV?

Remember, it doesn’t catch light or shadow changes, so it understands object blockage.

enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$

This can be easily done using either OpenCV or by training a Deep Learning model.

If you want to go the OpenCV route you need to find out the coordinates of the bounding box as shown in the image and extract the features (basically the pixel values) of that rectangle. Now these features are your ground truth. Id there is an object blocking the door then the features of that bounding box would not match the ground truth and hence we can infer there is some blockage.

If you want to go the Deep Learning route then simple train an object detection algorithm to detect if there are any object near the door. There are many pre trained models out there which you can directly use without training.

PS : If you are going the non AI way, you can use template matching present in skimage or opencv (cv2.matchTemplate) to detect the gorunf truth in an image. First simply crop the area you are interested in manually. This will be your ground truth. Then pass this ground truth to the templateMatching function which will then detect the ground truth if present in the image. Once the ground truth is detected you can use opencv to extract the coordinates.

If you wanna got the AI route then you can start with the YOLO series. This is an object detection algorithm which can detect 80 different types of objects out of the box. You can also train it to detect virtually any object you want in addition to these classes.

Cheers!

$\endgroup$
2
  • $\begingroup$ But how to find the coordinates of the bounding box initially? Also, is there any general object detection model that can detect "any" objects? $\endgroup$
    – Tina J
    Jul 19 at 10:55
  • $\begingroup$ @TinaJ Updated my answer based on your comments $\endgroup$
    – spectre
    Jul 20 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.