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!