Parking entry and exit threshold calculation method and parking entry and exit determination method
By fitting the relationship formula between the entry and exit threshold and the angle and height of the parking space frame, the variable threshold is calculated, which solves the complex problem of judging the diversity of parking space patterns and environmental scenes in the existing technology, and improves the calculation efficiency and accuracy of parking entrance and exit detection. sex.
Patent Information
- Application Number
- CN202111524328.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-14
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-12-14
AI Technical Summary
In the existing parking entrance and exit detection algorithm based on image recognition, the threshold value for the intersection area between the vehicle detection frame and the parking space frame as the basis for judgment needs to be adjusted multiple times according to different parking space shapes and environmental scenes, which increases the operation difficulty and calculation complexity.
By obtaining a large amount of image data, selecting the angle and intercepting height of the parking space frame as parameters, fitting the formula for the relationship between the entry and exit threshold and angle and height, and calculating the variable threshold, adapting to the entry and exit judgment of different parking space forms and environmental scenes.
It reduces the judgment complexity and data calculation amount, improves the calculation efficiency and judgment accuracy, and adapts to the entry and exit judgment of different camera installation angles and parking space drawing methods.
Smart Images

Figure CN114170578B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent algorithm technology, and in particular to a method for calculating a parking entry and exit variable threshold and a method for determining a parking entry and exit. Background Art
[0002] In the current parking entry and exit detection algorithm based on image recognition, the general calculation method is to judge whether a parking space is in place based on the intersection area of the vehicle detection frame obtained by vehicle detection and the quadrilateral frame of the parking space on the ground. A threshold is required here as a boundary and judgment basis. Since the vehicle detection rectangular frames of vehicles in the picture are of different sizes and shapes, the parking spaces are drawn differently. Different parking space drawing methods require different thresholds to judge whether a vehicle is in or out of the parking space. This increases the difficulty of operation and the calculation process. According to the actual parking space environment, if multiple parking spaces need to be drawn, several different sets of thresholds need to be prepared to cope with different scenarios, which increases the complexity. Summary of the invention
[0003] The purpose of the present invention is to provide a method for calculating a variable threshold value for parking entry and exit and a method for determining parking entry and exit in response to the above-mentioned problems. The method of the present invention calculates the threshold value for vehicle entry and exit for parking spaces of various shapes drawn for different scenes, and copes with different scenes according to the currently common parking space drawing methods. By collecting relevant data on entry and exit judgments of various parking space drawing methods, a variable threshold value is derived and calculated to adapt to the entry and exit judgment of parking spaces of different shapes in different environments, so as to reduce the complexity of the judgment and the amount of data calculation.
[0004] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0005] The present invention first provides a method for calculating a parking entry and exit threshold, comprising the following steps:
[0006] Step S1: In a roadside parking scene, a large number of images containing parking spaces and vehicles are obtained, a vehicle detection frame of the vehicle is obtained in the obtained images, and a quadrilateral parking space frame is drawn based on the actual parking space frame line on the ground to obtain coordinate data of the parking space frame;
[0007] Step S2: selecting one of the corners in the quadrilateral parking space frame as a reference angle and a first calculation parameter;
[0008] Step S3: intercepting the lower half of the vehicle detection frame that has a greater intersection with the parking space frame as a bottom rectangular area, and taking the intercepted height of the bottom rectangular area as a second calculation parameter;
[0009] Step S4: Assume that the angle of the selected angle is x, the interception height is y, and the entry and exit threshold is z, process a large number of collected parking images, obtain the corresponding interception height value y under different x values, and calculate the entry and exit threshold for the parking space that has been parked, and fit the yx relationship formula of the interception height-angle according to the values of x and y; fit the zy relationship formula of the entry and exit threshold-interception height according to the value distribution of y and z;
[0010] Step S5: In the actual scene, according to the coordinate distribution in the image, the angle of the reference angle of a quadrilateral parking space frame is obtained, and different interception height values are calculated according to the yx relationship formula, and then according to the zy relationship formula, the entry and exit thresholds corresponding to the parking space are calculated from the different interception height values;
[0011] For different quadrilateral parking space frames in the image, different entry and exit thresholds are obtained by calculation, namely, the entry and exit variable thresholds.
[0012] In the present invention, preferably, the step S4 of calculating the entry and exit threshold for the parking space where the vehicle has been parked means calculating the intersection area of the vehicle detection frame and the quadrilateral parking space frame.
[0013] In the present invention, preferably, in step S2, according to the parking space distribution in the actual environment and the image data collected by the camera, the parameter variation range of the selected angle is set to 20 degrees to 180 degrees, and the angle range is normalized to 0.2-1.8 and then substituted into subsequent calculations.
[0014] In the present invention, preferably, in step S2, an acute angle in the quadrilateral parking space frame close to the middle of the road is selected as the first calculation parameter, the acute angle parameter variation range is set to 20 degrees to 90 degrees, and the acute angle range is normalized to 0.2-0.9.
[0015] In the present invention, preferably, the method for intercepting the bottom rectangular area described in step S3 is to find the intersection of the vertical line close to the middle of the road in the vehicle detection frame and the edge of the selected acute angle perpendicular to the roadbed, and the horizontal line where the intersection is located is the interception boundary line of the bottom rectangular area.
[0016] In the present invention, preferably, the angle of the acute angle is calculated using the coordinates of three points, the vertex of the acute angle is used as the corner point, and the two adjacent corner points are used as the remaining two points to calculate the angle.
[0017] The present invention also provides a method for determining parking entry and exit, comprising the following steps:
[0018] Determine the position:
[0019] (1) Obtain a video image of the monitoring area, and draw the coordinates of continuous parking spaces in the obtained video image according to the actual environment, with each parking space being a quadrilateral frame; using the calculation method, according to the angle value of the reference angle of the parking space frame, calculate the entry and exit threshold of each parking space frame;
[0020] (2) Real-time video detection of vehicles, obtaining the vehicle detection frame of each frame, and calculating the intersection area of the vehicle detection frame and the parking space frame. When the intersection area gradually increases, the vehicle is judged to be in the entry state; the intersection area value is compared with the entry and exit threshold of the corresponding parking space. When the intersection area value reaches the entry and exit threshold and stabilizes, it enters the entry waiting for confirmation state. After continuous judgment for multiple frames to increase the credibility of the event, the vehicle status is changed to successful entry;
[0021] Determine the position:
[0022] Real-time video detection of vehicles, obtaining the vehicle detection frame of each frame, and calculating the intersection area of the vehicle detection frame and the parking space frame, comparing the intersection area value with the entry and exit threshold of the corresponding parking space. When the intersection area is less than the entry and exit threshold and gradually decreases, it is judged to be in the exit state. When the intersection area gradually decreases to 0, the vehicle state is changed to exit.
[0023] When a vehicle parks across parking spaces during the parking process, that is, the vehicle intersects with multiple parking spaces, different parking space intersections are selected for event judgment based on the current status of the vehicle, and the entire process is recorded. Finally, the specific process of parking across parking spaces can be obtained as a basis for subsequent judgment.
[0024] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0025] The present invention uses the angle of one corner of the parking space frame as a reference angle, introduces the interception height value of the bottom rectangular area as an intermediate parameter according to the interrelated relationship between the angle, the intersection area of the vehicle detection frame and the parking space frame, and fits the interception height-angle yx relationship formula; and according to the relationship that the larger the interception height value, the larger the entry and exit threshold, fits the entry and exit threshold zy relationship formula-interception height, so that in subsequent calculations, the corresponding threshold can be obtained by obtaining the angle value, so that the threshold of each parking space frame can be easily calculated as the entry and exit variable threshold, which improves the calculation efficiency and adaptability, reduces the amount of data, reduces the interference of manual work on the data, can adapt to the judgment of the entry and exit under different camera installation angles and different parking space drawing forms, so as to reduce the complexity of the judgment and the amount of data calculation, and improve the accuracy of the judgment. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a quadrilateral parking space frame rendering of the actual parking space on the ground;
[0027] Figure 2 This is a schematic diagram of the final effect of selecting the sharp corner and the bottom rectangular area in the image;
[0028] Figure 3 Schematic diagram of the relationship between the vehicle detection frame, the parking space frame and the interception boundary line in the present invention; wherein, 1-vehicle detection frame; 2-reference angle; 3-parking space frame; 4-interception boundary line;
[0029] Figure 4 It is the intercept height y-acute angle yx fitting curve diagram in Example 1;
[0030] Figure 5 This is the fitting curve diagram of the input and output position change threshold-intercept height zy in Example 1. DETAILED DESCRIPTION
[0031] In order to express the present invention more clearly, the present invention is further described below through specific examples.
[0032] The parking entry and exit threshold calculation method based on parking space lines includes the following steps:
[0033] Step S1: In a roadside parking scene, a large number of images containing parking spaces and vehicles are obtained, a vehicle detection frame 1 of the vehicle is obtained in the obtained image, and a quadrilateral parking space frame 3 is drawn based on the actual parking space frame line on the ground to obtain coordinate data of the parking space frame 3; in this step, the image acquisition can be a photo obtained by taking a camera set in the parking scene or an image frame in a video stream; the parking space frame angles in the selected images are as different as possible to make the basic data volume of the present invention larger and improve the reliability of the fitting formula; the car detection frame is obtained through the existing target detection model, which is a mature technology in this field, and the car detection frame is generally a rectangular frame; the real parking space frame is drawn according to the actual white parking space line on the ground.
[0034] Step S2: Select one of the angles in the quadrilateral parking space frame 3 as the reference angle 2 and the first calculation parameter; using the method of the present invention, any angle of the parking space frame 3 can be used as the reference angle 2, and the parameter range of the selected angle is set to 20 to 180 degrees according to the parking space distribution in the actual environment and the image data collected by the camera, and the angle range is normalized to 0.2-1.8, and then substituted into the subsequent calculation. In this embodiment, an acute angle close to the middle of the road in the quadrilateral parking space frame 3 is preferably selected as the first calculation parameter, and the acute angle parameter range is set to 20 to 90 degrees according to the parking space distribution in the actual environment and the image data collected by the camera, and the acute angle range is normalized to 0.2-0.9, so as to facilitate subsequent calculations;
[0035] Step S3: In the vehicle detection frame 1, the lower half of the part with a greater intersection with the parking space frame 3 is intercepted as the bottom rectangular area, and the interception height of the bottom rectangular area is used as the second calculation parameter; wherein, the interception method of the bottom rectangular area is to find the intersection of the vertical line close to the middle of the road in the vehicle detection frame 1 and the edge of the selected acute angle perpendicular to the roadbed, and the horizontal line where the intersection is located is the interception boundary line 4 of the bottom rectangular area, which can be seen in Figure 2 The interception boundary 4 in the image is obtained; the interception boundary 4 can be manually marked during training; when the selected reference angle 2 is different, the position of the interception boundary 4 is determined according to the same rule. After analyzing a large number of images, it can be found that the interception area is based on the height of the rectangular frame, and the size of the angle value is regularly correlated with the size of the interception area.
[0036] Step S4: Let the angle of the selected angle be x, the interception height be y, and the entry and exit threshold be z, and process a large number of collected parking images to obtain the corresponding interception height value y under different x values, and calculate the entry and exit threshold for the parking space that has been parked. The angle x of the acute angle is calculated by the coordinates of three points, the vertex of the acute angle is used as the corner point, and the two adjacent corner points are used as the remaining two points to calculate the angle. According to the values of x and y, the yx relationship formula of the interception height-angle is fitted; according to the value distribution of y and z, the zy relationship formula of the entry and exit threshold-interception height is fitted; wherein, calculating the entry and exit threshold for the parking space that has been parked means calculating the intersection area of the vehicle detection frame 1 and the quadrilateral parking space frame 3;
[0037] Steps S1-S4 are intended to obtain two relationship formulas through mathematical models, and in actual application, there is no need to repeatedly establish models and formulas. The following step S5 is to obtain the threshold of the parking space through simple calculation in specific applications.
[0038] Step S5: In the actual scene, according to the coordinate distribution in the image, the angle of the reference angle of a quadrilateral parking space frame 3 is obtained. The selection rule of the reference angle 2 should be consistent with the angle rule selected during modeling. According to the yx relationship formula, different interception height values y are calculated, and then according to the zy relationship formula, the entry and exit threshold z corresponding to the parking space is calculated from the different interception height values; for different quadrilateral parking space frames 3 in the image, different entry and exit thresholds are obtained by calculation, that is, the entry and exit variable thresholds.
[0039] The present invention is now described through a specific calculation case:
[0040] Example 1
[0041] The parking entry and exit threshold calculation method based on parking space lines includes the following steps:
[0042] Step S1: In a roadside parking scene, a large number of images containing parking spaces and vehicles are acquired through a camera, a vehicle detection frame 1 of the vehicle is obtained in the acquired image, and a quadrilateral parking space frame 3 is drawn based on the actual parking space frame line on the ground, see Figure 1 and Figure 2 ;
[0043] Step S2: Continue to see Figure 2 , select an acute angle near the middle of the road in the quadrilateral parking space frame 3 as the first calculation parameter, set the acute angle parameter range to 20 degrees to 90 degrees according to the parking space distribution in the actual environment and the image data collected by the camera, and normalize the acute angle range to 0.2-0.9;
[0044] Step S3: Continue to see Figure 2 , find the intersection of the vertical line of the vehicle detection frame 1 and the edge of the acute angle perpendicular to the roadbed, the horizontal line where the intersection is located is the interception boundary line 4 of the bottom rectangular area; intercept the bottom rectangular area in the vehicle detection frame 1 through the interception boundary line 4, and use the interception height of the bottom rectangular area as the second calculation parameter; the relationship diagram of the vehicle detection frame 1, the parking space frame 3 and the interception boundary line 4 is shown in Figure 3 ;
[0045] Step S4: Let the acute angle be x, the interception height be y, and the entry and exit threshold be z. A large number of parking images collected are manually processed. When the acute angle obtained in the actual scene is (0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9), the corresponding interception height value y obtained in the image is (0.25, 0.28, 0.32, 0.38, 0.46, 0.52, 0.55, 0.6), and the calculated entry and exit thresholds are (0.3, 0.4, 0.55, 0.61, 0.75, 0.8, 0.9). According to the values of x and y, the fitting curve is shown in Fig. Figure 3 , the fitting formula for the intercept height-acute angle yx is:
[0046] y=a0+a1*cos(x*w)+b1*sin(x*w); (1)
[0047] Among them, a0=0.4237, a1=-0.1549, b1=-0.08825, w=3.741;
[0048] According to the distribution of y and z values, the fitting curve is shown in Figure 4 , the fitting formula of the relationship between the entry and exit threshold and the interception height zy is:
[0049] z=p1*y 3 +p2*y 2 +p3*y+p4; (2)
[0050] Among them, p1=9.67, p2=-16.45, p3=10.01, p4=-1.321;
[0051] Step S5: In the actual scene, according to the coordinate distribution in the image, obtain the acute angle of a quadrilateral parking space frame 3 close to the middle of the road, substitute it into formula (1), calculate different interception height values y, and then substitute the y value into formula (2) to calculate the entry and exit threshold z corresponding to the parking space frame 3; perform corresponding calculations for each parking space, which is the entry and exit threshold.
[0052] Example 2
[0053] The parking entry and exit position variable threshold calculation method of the present invention can be applied to the parking entry and exit determination, and comprises the following steps:
[0054] Determine the position:
[0055] (1) Obtain a video image of the monitoring area, and draw the coordinates of continuous parking spaces in the obtained video image according to the actual environment, with each parking space being a quadrilateral frame parking space frame 3; using the above-mentioned calculation method, according to the angle value of the reference angle of the parking space frame, calculate the entry and exit threshold of each parking space frame;
[0056] (2) Real-time video detection of vehicles, obtaining the vehicle detection frame 1 of each frame, and calculating the intersection area of the vehicle detection frame 1 and the parking space frame 3. When the intersection area is gradually increased, the vehicle is judged to be in the entry state; the intersection area value is compared with the entry and exit threshold of the corresponding parking space. When the intersection area value reaches the entry and exit threshold and stabilizes, it enters the entry waiting for confirmation state. After multiple frames of continuous judgment to increase the credibility of the event, the vehicle status is modified to successful entry; when the vehicle parks across parking spaces during the parking process, that is, the vehicle intersects with multiple parking spaces, different parking space intersections are selected according to the current state of the vehicle for event judgment, and the entire process is recorded. Finally, the specific process of parking across parking spaces can be obtained as a basis for post-judgment. Due to the use of variable entry and exit thresholds, each parking space is judged using a more scientific threshold, making the judgment result more reliable. When the vehicle intersects with multiple parking spaces, separate judgments are made. Therefore, the situation of parking across parking spaces can be identified and evidence can be collected.
[0057] Determine the position:
[0058] The previous step is the entry judgment method. The exit judgment is roughly the same as the above. Real-time video detects vehicles, obtains the vehicle detection frame 1 of each frame, and calculates the intersection area of the vehicle detection frame 1 and the parking space frame 3. The intersection area value is compared with the entry and exit threshold of the corresponding parking space. When the intersection area is less than the entry and exit threshold and gradually decreases, it is judged to enter the exit state. When the intersection area gradually decreases to 0, the vehicle state is changed to exit.
[0059] The present invention obtains the threshold of the corresponding parking space by obtaining the angle value, so that the threshold of each parking space frame can be easily calculated and used as the entry and exit variable threshold, thereby improving the calculation efficiency and adaptability, reducing the amount of data, reducing manual interference with the data, and being able to adapt to the judgment of entry and exit positions under different camera installation angles and different parking space forms, so as to reduce the complexity of the judgment and the amount of data calculation, and improve the accuracy of the judgment.
[0060] The above description is a detailed description of the preferred feasible embodiments of the present invention, but the embodiments are not intended to limit the scope of the patent application of the present invention. All equivalent changes or modified changes completed under the technical spirit suggested by the present invention should fall within the patent scope covered by the present invention.
Claims
1. A method for calculating the parking entry and exit threshold, characterized in that: The following steps are involved: Step S1: In a roadside parking scene, a large number of images containing parking spaces and vehicles are obtained, a vehicle detection frame of the vehicle is obtained in the obtained images, and a quadrilateral parking space frame is drawn based on the actual parking space frame line on the ground to obtain coordinate data of the parking space frame; Step S2: selecting one of the corners in the quadrilateral parking space frame as a reference angle and a first calculation parameter; Step S3: intercepting the lower half of the vehicle detection frame that has a greater intersection with the parking space frame as a bottom rectangular area, and taking the intercepted height of the bottom rectangular area as a second calculation parameter; Step S4: Assume that the angle of the selected angle is x, the interception height is y, and the entry and exit threshold is z, process a large number of collected parking images, obtain the corresponding interception height value y under different x values, and calculate the entry and exit threshold z for the parking space that has been parked, and fit the yx relationship formula of the interception height-angle according to the values of x and y; fit the zy relationship formula of the entry and exit threshold-interception height according to the value distribution of y and z; Step S5: In the actual scene, according to the coordinate distribution in the image, obtain the angle x of a quadrilateral parking space frame reference angle, calculate different interception height values y according to the yx relationship formula, and then calculate the entry and exit threshold z corresponding to the parking space from the different interception height values y according to the zy relationship formula; For different quadrilateral parking space frames in the image, different entry and exit thresholds are calculated by the method in step 5, namely, the entry and exit variable thresholds.
2. The parking entry and exit threshold calculation method according to claim 1, characterized in that: Calculating the entry and exit threshold for the parking space where the vehicle has parked in step S4 refers to calculating the intersection area of the vehicle detection frame and the quadrilateral parking space frame.
3. The parking entry and exit threshold calculation method according to claim 1, characterized in that: In step S2, according to the parking space distribution in the actual environment and the image data collected by the camera, the parameter variation range of the selected angle is set to 20 degrees to 180 degrees, and the angle range is normalized to 0.2-1.8 and then substituted into the subsequent calculation.
4. The method for calculating parking entry and exit threshold value according to claim 3, characterized in that: In step S2, an acute angle in the quadrilateral parking space frame close to the middle of the road is selected as the first calculation parameter, the acute angle parameter variation range is set to 20 degrees to 90 degrees, and the acute angle range is normalized to 0.2-0.
9.
5. The parking entry and exit threshold calculation method according to claim 4, characterized in that: The method for intercepting the bottom rectangular area described in step S3 is to find the intersection of the vertical line close to the middle of the road in the vehicle detection frame and the edge of the selected acute angle perpendicular to the roadbed, and the horizontal line where the intersection is located is the interception boundary line of the bottom rectangular area.
6. The parking entry and exit threshold calculation method according to claim 3, characterized in that: The angle of the acute angle is calculated using the coordinates of three points, with the vertex of the acute angle being the corner point and the two adjacent corner points being the remaining two points for calculating the angle.
7. A method for determining parking entry and exit, characterized in that: The following steps are involved: Determine the position: (1) Obtain a video image of the monitoring area, and draw the coordinates of continuous parking spaces in the obtained video image according to the actual environment, with each parking space being a quadrilateral frame; and using the calculation method described in any one of claims 1 to 6, calculate the entry and exit threshold of each parking space frame according to the angle value of the reference angle of the parking space frame; (2) Real-time video detection of vehicles, obtaining the vehicle detection frame of each frame, and calculating the intersection area of the vehicle detection frame and the parking space frame. When the intersection area gradually increases, the vehicle is judged to be in the entry state; the intersection area value is compared with the entry and exit threshold of the corresponding parking space. When the intersection area value reaches the entry and exit threshold and stabilizes, it enters the entry waiting for confirmation state. After continuous judgment for multiple frames to increase the credibility of the event, the vehicle status is changed to successful entry; Determine the position: Real-time video detection of vehicles, obtain the vehicle detection frame of each frame, and calculate the intersection area of the vehicle detection frame and the parking space frame, compare the intersection area value with the entry and exit threshold of the corresponding parking space, when the intersection area is less than the entry and exit threshold and gradually decreases, it is judged to enter the exit state, when the intersection area gradually decreases to 0, the vehicle state is changed to exit.
8. The method for determining parking space entry and exit according to claim 7, characterized in that: When a vehicle parks across parking spaces during the parking process, that is, the vehicle intersects with multiple parking spaces, different parking space intersections are selected for event judgment based on the current status of the vehicle, and the entire process is recorded. Finally, the specific process of parking across parking spaces can be obtained as a basis for subsequent judgment.
