Triangle Detection Method in Image and Parking Space Detection System

By projecting image pixel points into parameter space, extracting and sorting straight lines, and combining straight lines to detect triangles, the problem of difficulty in identifying discontinuous triangles in the prior art is solved, and the accurate extraction and recognition of triangles is achieved.

CN115880670BActive Publication Date: 2025-06-20YANGTZE RIVER DELTA HART ROBOT IND TECH RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211607557.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-14
Publication Date
2025-06-20
Estimated Expiration
2042-12-14

AI Technical Summary

Technical Problem

In existing images, triangle detection techniques are difficult to effectively identify triangles with discontinuous sides, such as triangles composed of dotted lines.

Method used

By projecting the pixel points of the image into the parameter space, extracting and sorting straight lines, combining straight lines to detect triangles, ensuring that the number of intersections is 3 and the coordinates are greater than zero.

Benefits of technology

Accurate extraction and recognition of discontinuous triangles is achieved, and the accuracy and reliability of triangle detection in the image is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115880670B_ABST
    Figure CN115880670B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for detecting triangles in an image, comprising the following steps: extracting a straight line L in the image to be detected n and straight line L n The number of points N Ln , according to the number of points N Ln From large to small, the order of the straight line L n Sort; if the straight line L n If the number is greater than 3, select a combination where the sum of the points of the three lines is greater than or equal to N, where N is the number of fitting points on the set triangle; detect whether the three lines in each combination intersect each other, and the number of intersections is 3, and the coordinates of the intersections are all greater than zero. If the detection result is yes, it is determined that the three lines in the current combination form a triangle, and the points on the three lines are retained. All combinations are traversed and all triangles in the image to be detected are output. Line extraction is achieved by projecting the pixel points of the image into the parameter space, and then triangles are identified based on the extracted line combinations. Triangles with discontinuous edges can also be extracted and identified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image detection. More specifically, the present invention relates to a method for detecting triangles in an image and a parking space detection system. Background Art

[0002] In a parking space detection system in a parking lot, to identify whether a parking space is vacant, it is necessary to identify any cars that may be parked in the parking lot in the image obtained by the detection system. However, since the types, shapes, sizes, etc. of cars vary greatly, it is unrealistic to determine whether a parking space is vacant by identifying whether there are cars in the image. Since a yellow triangle sign can be drawn on each parking space first, and then it can be determined whether a parking space is vacant by identifying whether the image contains a triangle. If there is no triangle in the image, it indicates that the parking space has been occupied by a car, otherwise it indicates that the parking space is vacant. Therefore, the detection of vacant parking spaces is converted into detecting whether there are triangles in the image, which is easier than identifying all cars.

[0003] The triangle detection technology in "An Algorithm for Efficiently Detecting Triangles in Images" is to extract connected edges, but there are errors in edge extraction and it is not applicable to triangles with discontinuous edges, such as triangles composed of dotted lines. Summary of the Invention

[0004] The present invention provides a method for detecting triangles in an image, aiming to improve the above technical problems.

[0005] The present invention is implemented as follows. A method for detecting triangles in an image, the method specifically includes the following steps:

[0006] (1) Extract the straight line L in the image to be detected n and the number of points N n on the straight line L Ln , and sort the straight line L Ln in descending order according to the number of points N n ;

[0007] (2) Detect whether the number of straight lines L n is less than 3. If the detection result is no, then execute step (3);

[0008] (3) Select combinations where the sum of the number of points of three straight lines is greater than or equal to N, where N is the number of fitting points set on the triangle;

[0009] (4) Detect whether the three straight lines in each combination intersect pairwise, and the number of intersection points is 3, and the intersection coordinates are all greater than zero. If the detection result is yes, it is determined that the three straight lines in the current combination form a triangle, retain the points on the three straight lines, traverse all combinations, and output all triangles in the image to be detected.

[0010] Further, step (1) specifically includes the following steps:

[0011] (11) Project all points in the image to be detected onto the parameter space, and record the intersection points (a n , b n ) of all intersecting lines in the parameter space, the coordinates (x n , y n ) in the image space corresponding to the line where each intersection point (a n,m , b n,m ) is located, the line L n in the image space, and the number of points n on the line L

[0012] (12) Sort the lines L in descending order according to the number of points n to obtain the line L with the maximum number of points max max , its intersection point (a max , b max ) in the parameter space, and the coordinates (x max , y max ) in the image space corresponding to the line where the intersection point (a max,m , b max,m ) is located;

[0013] (13) After taking out the coordinates (x max , y max ) in the image space corresponding to the line where the intersection point (a max,m , b max,m ) is located from the image, execute steps (11) and (12), and finally sort the lines L in descending order according to the number of points n .

[0014] Further, the method for extracting the line L n in the image space is specifically as follows:

[0015] Record the intersecting lines with the intersection point (a n , b n ) in the parameter space, obtain the corresponding points in the image space of all intersecting lines, and the line where all corresponding points are located is the line L n in the image to be detected.

[0016] Further, the method for determining the number of points n on the line L is specifically as follows:

[0017] A straight line in the parameter space corresponds to a point in the image space. Count the number of intersecting straight lines at the intersection point (a n , b n ) in the parameter space, which is the number of points on the straight line L n

[0018] Further, step (3) includes the following steps:

[0019] (31) Let where respectively represent the number of points on the first sorted straight line and the second sorted straight line in step (13). Remove the straight lines with the number of points n less than num from the straight line L . When n > 2, check whether the number of remaining straight lines is less than 3. If the check result is no, then execute step (32);

[0020] (32) Traverse the remaining straight lines, combine any three straight lines to form several combinations;

[0021] (33) Calculate whether the sum of the number of points of the three straight lines in the combination is less than the number of points N. If the check result is yes, then delete this combination and traverse all combinations.

[0022] Further, the method for determining the number of fitting points N on the triangle is specifically as follows:

[0023] Determine the number of pixel points M occupied by the triangle to be detected in the image, then k·M is the number of fitting points N on the triangle, where the value range of k is 0.7 to 0.9.

[0024] The present invention is implemented as follows. A parking space detection system, the system includes:

[0025] A camera installed in the parking lot, and a processor communicatively connected to the camera;

[0026] The camera is used to capture the image of the parking space in the parking lot, input the parking space image as the image to be detected into the processor, and the processor extracts the triangle in the image to be detected based on the detection method in the above image. The parking space with a triangle is an idle parking space.

[0027] Further, the system further includes:

[0028] A display unit for displaying the identification of the unoccupied parking space.

[0029] Further, the set number of fitting points N on the triangle is integrated in the processor.

[0030] ​The present invention realizes the extraction of straight lines by projecting the pixel points of the image into the parameter space, and then distinguishes triangles based on the extracted straight line combination. It can also extract and identify triangles with discontinuous sides. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 A flow chart of a method for detecting triangles in an image provided by an embodiment of the present invention;

[0032] Figure 2 A schematic diagram of the structure of a parking space detection system provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0033] The specific implementation modes of the present invention are further explained in detail below by describing the embodiments with reference to the accompanying drawings, so as to help those skilled in the art to have a more complete, accurate and in-depth understanding of the inventive concept and technical solution of the present invention.

[0034] Figure 1 A flowchart of a method for detecting triangles in an image provided by an embodiment of the present invention, the method specifically comprises the following steps:

[0035] (1) Determine the number of fitting points N on the triangle in the image;

[0036] Determine the number of pixels M occupied by the triangle to be detected in the image, then k·M is the number of fitting points N on the triangle, where the value range of k is 0.7 to 0.9.

[0037] (2) Project all points in the image to be detected into the parameter space and record the intersection points of all intersecting straight lines in the parameter space (a n ,b n ), each intersection point (a n ,b n ) corresponds to the coordinates of the line in the image space (x n,m ,y n,m ), the straight line L in the image space n and the straight line L n Points on

[0038] The equation of a straight line is y = ax + b, where a represents the slope of the straight line and b represents the intercept. Rewrite this equation as b = -xa + y. At this time, (a, b) is considered to form a parameter space. Any point in the image to be detected is represented as a straight line in the parameter space, and the points corresponding to the intersecting straight lines in the parameter space are located on the same straight line in the image space. Assume that after projecting the points (x1, y1), (x2, y2), and (x2, y3) in the image into the parameter space, the straight lines of the three points in the parameter space all intersect at the same intersection point (a, b). Then it indicates that the points (x1, y1), (x2, y2), and (x2, y3) are located on the same straight line L in the image, and the number of points N on the straight line L L = 3.

[0039] (3) Sort the straight line L Ln in descending order according to the number of points N n to obtain the maximum number of points max on the straight line L max , its intersection point (a max , b max ) in the parameter space, and the coordinates (x) of the straight line where the intersection point (a max , b max max,m , y max,m ) is located in the image space;

[0040] (4) After taking out the coordinates (x) of the straight line where the intersection point (a max , b max max,m , y max,m ) is located from the image, execute steps (2) and (3), and finally obtain the straight line L sorted in descending order according to the number of points; n

[0041] (5) Detect whether the number of straight lines L n is less than 3. If the detection result is yes, it is determined that there is no triangle in the image to be detected, and the program is exited. If the detection result is no, then execute step (6);

[0042] (6) Let where respectively represent the number of points of the first sorted straight line and the second sorted straight line in step (4). Remove the straight lines with the number of points n less than num from the straight line L . If n > 2 and the number of the remaining straight lines after detection is less than 3, it is determined that there is no triangle in the image to be detected, and the program is exited. If the detection result is no, then execute step (7);

[0043] (7) Traverse the remaining straight lines, combine any three straight lines to form several combinations;

[0044] (8) Calculate whether the sum of the number of points on the three straight lines in the combination is less than the number of points N. If the detection result is yes, delete the combination. If the detection result is yes, retain the combination and traverse all combinations;

[0045] (9) Detect whether the three straight lines in each combination intersect pairwise, and the number of intersection points is 3, and the intersection coordinates are all greater than zero. If the detection result is yes, it is determined that the three straight lines in the current combination form a triangle, and retain the points on the three straight lines. If the detection result is no, delete the combination and traverse all combinations. Finally, output all the triangles in the image to be detected.

[0046] In the embodiment of the present invention, the image to be detected is located in the first quadrant of the image coordinate system. Therefore, the coordinate values of the three intersection points of the triangle are also located in the first quadrant, and their values are all greater than zero.

[0047] Figure 2 It is a schematic structural diagram of the parking space detection system provided by the embodiment of the present invention. For the convenience of description, only the parts related to the embodiment of the present invention are shown. The system includes:

[0048] A camera installed in the parking lot, and a processor communicatively connected to the camera;

[0049] The camera is used to capture the image of the parking space in the parking lot, input the parking space image as the image to be detected into the processor, and the processor extracts the triangles in the image based on the detection method in the above image. The parking space with a triangle is an idle parking space;

[0050] Among them, triangles are drawn on the parking spaces in the parking lot. If the parking space is occupied, the triangle is completely or partially blocked by the parked vehicle. Only when the parking space is not occupied can the triangle on the parking space be detected.

[0051] In the embodiment of the present invention, the system further includes: a display unit connected to the processor; the display unit displays the identification of the unoccupied parking space.

[0052] The present invention has been described exemplarily. Obviously, the specific implementation of the present invention is not limited by the above methods. As long as various non-substantive improvements are made by adopting the method concept and technical solution of the present invention, or the concept and technical solution of the present invention are directly applied to other occasions without improvement, they are all within the protection scope of the present invention.

Claims

1. A method for detecting triangles in an image, characterized in that, The method specifically includes the following steps: (1) Extract the straight line L in the image to be detected n and the number of points N n on the straight line L Ln , and sort the straight line L Ln in descending order according to the number of points N n ; (2) Detect line L n Whether the quantity is less than 3. If the detection result is no, then execute step (3); (3) Select combinations where the sum of the number of points on three lines is greater than or equal to N, where N is the number of fitting points on the set triangle; (4) Detect whether the three lines in each combination intersect pairwise, and the number of intersection points is 3, and the intersection coordinates are all greater than zero. If the detection result is yes, it is determined that the three lines in the current combination form a triangle, retain the points on the three lines, traverse all combinations, and output all triangles in the image to be detected; The specific steps of step (1) include the following steps: (11) Project all points in the image to be detected into the parameter space and record the intersection points of all intersecting straight lines in the parameter space (a n ,b n ), each intersection point (a n ,b n ) corresponds to the coordinate (x n,m ,y n,m ), the straight line L in the image space n and the straight line L n The number of points N Ln ; (12) According to the number of points N Ln From large to small, the order of the straight line L n Sort and get the maximum number of points maxN Ln The straight line L max , and their intersection in parameter space (a max ,b max ) and the intersection point (a max ,b max ) corresponds to the coordinate (x max,m ,y max,m ); (13) After taking out the coordinates (x max , y max ) in the image space corresponding to the straight line where the intersection point (a max,m , b max,m ) is located from the image, steps (11) and (12) are executed, and finally the number of points N Ln The straight lines L n are sorted from large to small.

2. The method for detecting triangles in an image according to claim 1, characterized in that, The straight line L in the image space n The extraction method is as follows: Record the intersecting lines in the parameter space with the intersection point being (a n , b n ). Obtain the corresponding points of all the intersecting lines in the image space. The line where all the corresponding points lie is the line L in the image to be detected n .

3. The method for detecting triangles in an image according to claim 1, characterized in that, Straight line L n Number of points on The determination method is as follows: A straight line in the parameter space corresponds to a point in the image space. Count the number of intersecting straight lines at the intersection point (a n , b n ) in the parameter space. The number of such intersecting straight lines is the number of points on the straight line L n .

4. The method for detecting triangles in an image according to claim 1, characterized in that, The steps of step (3) include the following steps: (31) Order in They represent the number of points on the first sorting line and the second sorting line in step (13), respectively, from the line L n Remove points from less than num straight lines, n>2, check whether the number of retained straight lines is less than 3, if the test result is no, execute step (32); (32) Traverse the remaining lines, combine any three lines to form several combinations; (33) Calculate whether the sum of the number of points on the three lines in the combination is less than the number of points N. If the detection result is yes, delete the combination and traverse all combinations.

5. The method for detecting triangles in an image according to claim 1, characterized in that, The method for determining the number of fitting points N on the triangle is specifically as follows: Determine the number of pixel points M occupied by the triangle to be detected in the image, then k·M is the number of fitting points N on the triangle, where the value range of k is 0.7 to 0.

9.

6. A parking space detection system, characterized in that, The system includes: A camera installed in the parking lot, and a processor communicatively connected to the camera; The camera is used to capture the image of the parking space in the parking lot, input the parking space image as the image to be detected into the processor, and the processor extracts the triangle in the image to be detected based on the detection method in any one of claims 1 to 5. The parking space with a triangle is an idle parking space.

7. The parking space detection system according to claim 6, characterized in that, The system further includes: A display unit for displaying the identification of unoccupied parking spaces.

8. The parking space detection system according to claim 6, characterized in that, The set number of fitting points N on the triangle is integrated in the processor.

Citation Information

Patent Citations

  • Image edge feature-based three-dimensional model automatic adjustment method

    CN107146286A

  • Visual detection based automatic identification method for parking spaces in parking lot

    CN107665599A