Home > Net >  How to detect cars encroaching on the white line of the parking slot from CCTV Camera system?
How to detect cars encroaching on the white line of the parking slot from CCTV Camera system?

Time:12-15

I'm developing an application to identify cars crossing the white line in the parking lot using the CCTV camera system. I'm experiencing difficulty with some tilt-angle cameras.

My solution for the rear camera angles is to utilize the shapely library in Python to detect the intersection of the bounding boxes of the car recognized with model yolov7 and the bounding box of the parking slot. The experimental results are pretty promising. camera1

In the case of tilt-angle cameras, such as the one shown below, the car does not cross the line, but its bounding box crosses with the white line. camera2

Does anyone have any suggestions on how to make this work? Thank you very much.

Note: my input is a 1920x1080 video, I use OpenCV to read frames and the yolov7-tiny.pt model to detect cars in the frame. The bounding box of the parking slots is predefined in a JSON file.

Note2: I used the yolov7-tiny.pt model in image 1. In image 2, I used yolov7-mask.pt model.

CodePudding user response:

If the yolov7-tiny.pt model gives you back not only the bounding box of the car but also the car edges, as seen in the second image.

p = cv2.arcLength(cnt, True) # cnt is the x,y values of the car's edges
appr = cv2.approxPolyDP(cnt, 0.02*p, True)

The appr contains the bousing box of the car aligned with the car angle.

  • Related