A method for enabling a vehicle to determine entry and exit from a parking lot
By calculating the center trajectory of the vehicle during its movement and using the coordinates of the center point of the vehicle detection box to calculate the distance between two frames, a threshold is set to filter static vehicles. This solves the accuracy and efficiency problems of vehicle entry and exit judgment in existing technologies and adapts to the flexibility of different camera installation positions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INGENIC SEMICON CO LTD
- Filing Date
- 2024-12-10
- Publication Date
- 2026-06-12
AI Technical Summary
Existing methods for determining vehicle entry and exit from parking lots suffer from problems such as large data labeling workload, long model training time, high memory consumption, and judgment errors due to the non-fixed position of lane lines, making it impossible to accurately determine the direction of vehicle movement.
By calculating the center trajectory of the vehicle during its movement, the distance between two frames is calculated using the center point coordinates of the vehicle detection box. A threshold is set to filter static vehicles, and the vehicle's entry and exit status in the parking lot is determined based on the distance.
It achieves more accurate vehicle entry and exit judgment, avoids the problems of large data labeling workload and high memory consumption, and adapts to the flexibility of different camera installation locations.
Smart Images

Figure CN122200567A_ABST
Abstract
Claims
1. A method for determining whether a vehicle is entering or exiting a parking lot, characterized in that, The method includes the following steps: S1. Determine and record the coordinates of the center point of the vehicle detection frame in the first frame: First, determine whether the moving vehicle in the frame is the first frame, i.e., the first time the vehicle is detected; the condition for determining the first frame is: define an initial value f = 0 during initialization. If f = 0 during the determination, it is considered the first frame; otherwise, it is considered the Nth frame. If it is the first frame, calculate and record the coordinates of its center point; The coordinates of the detection box are obtained. The coordinates of the detection box are derived from a general detection model and are the coordinates of the upper left and lower right corners of the vehicle. Therefore, it is necessary to calculate the coordinates of the center point of the vehicle based on these coordinates. Assuming the coordinates of the obtained vehicle detection bounding box are: top left corner (x1, y1), bottom right corner (x2, y2), calculate the coordinates of the center point: center_x, center_y. center_x = (x1 + x2) / 2; center_y = (y1 + y2) / 2; S2. Determine and record the coordinates of the midpoint of the vehicle detection box in the Nth frame, where N≥2: If the moving vehicle is not detected for the first time, it means that the vehicle was detected in frame N. The calculation method for the center point is similar to step S1. Define the center point coordinates as history_x and history_y. Assume the coordinates of the vehicle detection box are: top left corner (x1, y1), bottom right corner (x2, y2), and the center point coordinates as history_x and history_y: history_x = (x1 + x2) / 2; history_y = (y1 + y2) / 2; S3. Calculate the distance between the two frames based on the midpoint coordinates of the vehicle in the first frame and the midpoint coordinates of the current Nth frame: Through steps S1 and S2, the coordinates of the center point of the vehicle in the first frame and the center point of the Nth frame have been determined. Next, the distance between the two detection boxes is determined using the coordinates of these two center points. The distance is calculated using the square root method, as follows: The distance between the two detection boxes is represented by the term "distance". Float distance=sqrt((center_x-history_x)*(center_x-history_x)+(center_y-history_y)*(center_y-history_y)); The sprt() function uses a function from the C++ library to calculate the square root between values; S4. Based on the obtained distance, determine the following indicators: Based on the information obtained in step S3, vehicles entering and exiting the parking lot are judged. Since the judgment focuses on vehicles entering and exiting the parking lot while in motion, static vehicles need to be filtered out. The purpose of `distance` is to compare its value with a threshold and then filter out static vehicles. Vehicles with a value greater than the threshold are considered dynamic vehicles, and those with a value less than the threshold are considered static vehicles. That is, the midpoint coordinates of the first frame and the midpoint coordinates of the current frame are compared to obtain the final output index for judging whether a vehicle has entered or exited the parking lot. The output is represented by `out`. Let `out = 1` indicate entry, and `out = -1` indicate exit. If center_y > history_y, out = 1, which means the vehicle is in the state of entering the parking lot; on the contrary, if center_y < history_y, out = -1, and at this time the vehicle is in the state of leaving the parking lot.
2. The method for determining vehicle entry and exit from a parking lot according to claim 1, characterized in that, In the step S4, filtering out static vehicles further includes: Since the detection box of the vehicle is obtained according to the model, that is, the coordinates obtained for each frame of the static vehicle are not fixed and there will be a deviation of a certain number of pixels. That is, the distance between the midpoints of the detection boxes of the stationary vehicle in each frame is not fixed and unchanged. Therefore, those vehicles that remain stationary in the camera view need to be filtered out. That is, a threshold is set, and if the calculated distance is less than the threshold, it is considered that the vehicle is stationary in the camera view and does not participate in the judgment of entering or leaving the parking lot.
3. The method for determining vehicle entry and exit from a parking lot according to claim 2, characterized in that, The range of the threshold is between 0 and 100.
4. The method for determining vehicle entry and exit from a parking lot according to claim 3, characterized in that, The threshold is set to 50 in the algorithm logic. 50 is the optimal recommended value given by multiple data. If distance is less than 50, it is considered that the vehicle is stationary; if it is greater than 50, it is considered that the vehicle is moving and participates in the judgment of entering or leaving the parking lot.
5. The method for determining vehicle entry and exit from a parking lot according to claim 1, characterized in that, In the step S4, due to the different installation positions of the camera lens, the final judgment of the vehicle's state of entering or leaving the parking lot can be set by oneself. That is, when out = 1, it can be entering the parking lot or leaving the parking lot, which is determined according to the installation position of the lens by oneself.