CN113903188B - Parking space detection method, electronic device and computer readable storage medium - Google Patents
Parking space detection method, electronic device and computer readable storage medium Download PDFInfo
- Publication number
- CN113903188B CN113903188B CN202110943529.7A CN202110943529A CN113903188B CN 113903188 B CN113903188 B CN 113903188B CN 202110943529 A CN202110943529 A CN 202110943529A CN 113903188 B CN113903188 B CN 113903188B
- Authority
- CN
- China
- Prior art keywords
- parking space
- points
- point
- image
- detected
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G08—SIGNALLING
- G08G—TRAFFIC CONTROL SYSTEMS
- G08G1/00—Traffic control systems for road vehicles
- G08G1/14—Traffic control systems for road vehicles indicating individual free spaces in parking areas
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Traffic Control Systems (AREA)
Abstract
The application provides a parking space detection method, an electronic device and a computer readable storage medium, wherein the parking space detection method comprises the following steps: acquiring a plurality of parking space angular points in an image to be detected, and fitting the parking space angular points into two first straight lines; mapping the two first straight lines into a transmission image by using at least part of parking space angular points to form two parallel and equally-spaced second straight lines; determining a conversion relation between an image to be detected and a transmission image based on the position information of at least part of parking space angular points on a first straight line and the position information of at least part of parking space angular points on a second straight line of corresponding points of the transmission image; dividing two second straight lines based on the positions and the intervals of the corresponding points of the parking space angular points forming the same parking space in the image to be detected in the transmission image to obtain parking space information in the transmission image; and obtaining the parking space information in the image to be detected based on the conversion relation and the parking space information in the transmission diagram. Through the arrangement, the false detection parking spaces are corrected, and the missed detection parking spaces are complemented.
Description
Technical Field
The present invention relates to the field of parking space detection technologies, and in particular, to a parking space detection method, an electronic device, and a computer-readable storage medium.
Background
With the development of society, the number of motor vehicles is increased dramatically, which causes more common social problems: parking is difficult, and a driver cannot know where the surrounding parking spaces are left; the parking is not standard, and the driver directly parks the vehicle in the non-parking area. Therefore, the parking space area can be quickly and accurately positioned, and whether the parking space is empty or not can be determined, so that the information of the empty parking space can be issued to the driver, and the urban traffic management and construction are guaranteed.
In a roadside parking scene, the conventional parking space detection method still generates certain false detection and missed detection due to the shielding of a vehicle and the like, and cannot provide accurate parking space information for a driver.
Disclosure of Invention
In view of this, the present application provides a parking space detection method, an electronic device and a computer-readable storage medium, so as to solve the technical problems of false detection and missed detection caused by the shielding of a vehicle in the prior art.
In order to solve the above technical problem, the first technical solution provided by the present application is: the parking space detection method comprises the following steps: acquiring a plurality of parking space angular points in an image to be detected, and fitting the parking space angular points into two first straight lines;
mapping the two first straight lines into a transmission diagram by using at least part of the parking space angle points to form two parallel and equally spaced second straight lines;
determining a conversion relation between the image to be detected and the transmission image based on the position information of at least part of the parking space angular points on the first straight line and the position information of at least part of the parking space angular points on the second straight line of corresponding points of the transmission image; and
dividing the two second lines based on the positions and the distances of corresponding points of the parking space angular points forming the same parking space in the to-be-detected image in the transmission map to obtain parking space information in the transmission map;
and obtaining the parking space information in the image to be detected based on the conversion relation and the parking space information in the transmission diagram.
Wherein, the mapping the two first straight lines into the transmission map by using at least part of the parking space angle points to form two parallel and equally-spaced second straight lines comprises:
selecting a set number of target parking space angular points from the plurality of parking space angular points;
and mapping the target parking space angle points to the transmission map so that connecting lines of corresponding points of the target parking space angle points in the transmission map form two parallel and equally-spaced second straight lines.
Wherein, follow select the target parking stall angular point of setting for quantity among a plurality of parking stall angular points, include:
respectively acquiring the distance from each parking space angular point to two first straight lines;
and determining the parking space angle points with the minimum distance to the two first straight lines and the set number as the target parking space angle points.
Wherein, it includes to acquire respectively every parking stall angular point reaches two the distance of first straight line:
respectively acquiring the position coordinates of each parking space angular point in a set coordinate system; the set coordinate system is established by taking a parking space angular point at an end point in the image to be detected as an original point and taking two directions extending along a parking space as coordinate axes;
and calculating the distance from each parking space angular point to the two first straight lines by using the position coordinates.
Wherein, the determining the conversion relationship between the image to be detected and the transmission map based on the position information of the at least part of the parking space angle points on the first straight line and the position information of the at least part of the parking space angle points on the second straight line of the corresponding points of the transmission map comprises:
acquiring a first position coordinate of the target parking space angular point in the image to be detected and a second position coordinate of a corresponding point of the target parking space angular point in the transmission image;
and obtaining the conversion relation between the image to be detected and the transmission image by using the first position coordinate and the second position coordinate.
Wherein, based on waiting to examine the parking stall angular point who constitutes same parking stall in the detected image and being in the position and the interval of the corresponding point in the transmission map are right two second straight lines divide, obtain parking stall information in the transmission map includes:
acquiring the distance between two corresponding points of two corner points in the transmission image, wherein the two corner points form the same parking space in the image to be detected;
and dividing the two second straight lines at intervals to form a plurality of parking spaces, so as to obtain parking space information in the transmission diagram.
Wherein, every interval divides the two second straight lines to form a plurality of parking spaces, thereby obtaining the parking space information in the transmission diagram, including
And in response to that the remaining distance between the head end and the tail end of the two second straight lines is smaller than the distance and larger than half of the distance, dividing an area of the distance, in which the remaining distance is smaller than the distance and larger than half of the distance, into a parking space.
Wherein, based on the conversion relation and the parking stall information in the transmission chart obtains waiting to detect the parking stall information in the image, include:
and mapping the corresponding points of the plurality of parking spaces in the transmission diagram to the two first straight lines by using a conversion relation to obtain the parking space information of the image to be detected.
Wherein the set number is at least 4.
In order to solve the above technical problem, the second technical solution provided by the present application is: provided is an electronic device including: the parking space detection device comprises a memory and a processor, wherein the memory stores program instructions, and the processor calls the program instructions from the memory to execute any one of the parking space detection methods.
In order to solve the above technical problem, a third technical solution provided by the present application is: there is provided a computer readable storage medium storing a program file, the program file being executable to implement any one of the above-mentioned parking space detection methods.
The beneficial effect of this application: be different from prior art, parking stall detection method in this application includes: acquiring a plurality of parking space angular points in an image to be detected, and fitting the parking space angular points into two first straight lines; mapping the two first straight lines into a transmission image by using at least part of parking space angular points to form two parallel and equally-spaced second straight lines; determining a conversion relation between an image to be detected and a transmission image based on the position information of at least part of parking space angular points on a first straight line and the position information of at least part of parking space angular points on a second straight line of corresponding points of the transmission image; dividing the two second straight lines based on the positions and the intervals of the corresponding points of the parking space angular points forming the same parking space in the to-be-detected image in the transmission map to obtain parking space information in the transmission map; and obtaining the parking space information in the image to be detected based on the conversion relation and the parking space information in the transmission diagram. Through the arrangement, after partial parking spaces are detected out through the parking space angular points, the false detection parking spaces are corrected, and the missed detection parking spaces are complemented, so that accurate parking space information is provided for a driver, and the driver can find the parking spaces more quickly.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a diagram of a parking space detection effect under an ideal situation of detecting a parking space based on a parking space angular point;
FIG. 2 is a diagram of a parking space detection effect under the actual situation of detecting a parking space based on a parking space angular point;
FIG. 3 is a diagram of another parking space detection effect in the actual situation of detecting a parking space based on a parking space angular point;
fig. 4 is a schematic flow chart of a parking space detection method provided in the embodiment of the present application;
fig. 5 is a schematic diagram of detecting a parking space corner point in step S11 provided in fig. 4;
FIG. 6 is a schematic diagram corresponding to step S11 provided in FIG. 4;
fig. 7 is a schematic flowchart of an embodiment of step S12 in the parking space detection method provided in fig. 4;
fig. 8 is a schematic diagram of a specific embodiment of determining a target parking stall corner point in step S121 provided in fig. 7;
FIG. 9 is a schematic diagram corresponding to step S122 provided in FIG. 7;
FIG. 10 is a diagrammatic view of the target vehicle corner point of FIG. 8 at the corresponding point in the transmission map;
fig. 11 is a schematic flow chart of a specific embodiment of a parking space detection method provided in the present application;
fig. 12 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
fig. 13 is a schematic structural diagram of a computer-readable storage medium provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
The terms "first", "second" and "third" in this application are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or as implying a number of indicated technical features. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of the feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless explicitly specified otherwise. In the embodiment of the present application, all directional indicators (such as up, down, left, right, front, rear \8230;) are used only to explain the relative positional relationship between the components, the motion situation, etc. at a specific posture (as shown in the drawing), and if the specific posture is changed, the directional indicator is changed accordingly. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
Currently, in a roadside parking scene, the parking spaces are mostly manually defined, and the labor cost is high. In the detection process of the roadside scene by using the parking space detection method based on the parking space angular point detection, the parking space detection effect under the ideal condition is shown in fig. 1 (fig. 1 is a parking space detection effect diagram of a parking space under the ideal condition based on the parking space angular point detection), and the actual parking space detection effect with the vehicle shielding or the far parking space detection effect is relatively non-shielding or the near parking space detection effect is worse, for example, missing detection occurs (see fig. 2, fig. 2 is a parking space detection effect diagram under the actual parking space detection condition based on the parking space angular point), or missing detection and incomplete detection occur simultaneously (see fig. 3, fig. 3 is another parking space detection effect diagram under the actual parking space detection condition based on the parking space angular point), and a person skilled in the art can understand that the problem that the detection network cannot be basically as shown in fig. 2 and fig. 3 by improving. That is to say, the parking space detection method based on the parking space angular point detection may generate certain false detection and missed detection due to the shielding of the vehicle and other situations, and requires the engineering configuration personnel to continue manual adjustment.
In the related art, there is also a method for detecting a road test parking space, including: the method comprises the steps of obtaining image data collected by a camera, converting the image data into a top view, extracting a plurality of detection frames from the top view, and tracking the detection frames by adopting a plurality of two-dimensional Kalman filters to determine real detection frames. Then, judging a parking space entry point based on the distance between the central points of the real detection frames, and determining the position coordinates of the parking space based on the parking space entry point; and finally, judging whether the parking space is occupied or not based on the position coordinates of the parking space. The main defects of the detection method are that the method cannot be applied to a common monitoring camera, roadside parking is characterized by dispersion and large quantity, the parameters of each camera are obtained for perspective transformation, a common image is transformed into a top view with certain difficulty, information is changed after the perspective transformation of a video frame of the common camera, and when factors such as shielding exist on a target, the detection effect is relatively worse; and the detection method also needs to use tracking, and the method is complex.
Based on the problems, the parking space detection method is applied to roadside parking scenes, the problems of false detection and missed detection in parking space detection are solved, and the implementation process is simple.
Referring to fig. 4, fig. 4 is a schematic flowchart of a parking space detection method according to an embodiment of the present disclosure.
The embodiment of the application provides a parking space detection method which comprises the following steps.
S11: acquiring a plurality of parking space angular points in an image to be detected, and fitting the parking space angular points into two first straight lines.
Specifically, an image to be detected is obtained through an image acquisition device, a plurality of parking spaces exist in the image to be detected, and the angular points of each parking space in the plurality of parking spaces are detected through a detection method for detecting key points through a neural network, so that the angular points of the plurality of parking spaces are obtained. Wherein, the parking stall angular point is for forming the point on this parking stall sideline. Because drive test parking stall, a plurality of parking stalls are arranged in proper order along the extending direction on way and are set up, can obtain two first lines with the fitting of a plurality of parking stall angular points.
In an embodiment, four vertexes of each of the multiple parking spaces are detected by a method for detecting key points through a neural network, where the four vertexes are an upper left angular point, a lower left angular point, an upper right angular point, and a lower right angular point (as shown in fig. 5, fig. 5 is a schematic diagram of detecting the angular points of the parking spaces in step S11 provided in fig. 4); fitting the plurality of upper left corner points and the plurality of lower left corner points according to the arrangement sequence of the plurality of parking spaces to obtain a first straight line, and fitting the plurality of upper right corner points and the plurality of lower right corner points according to the arrangement sequence of the plurality of parking spaces to obtain another first straight line (as shown in fig. 6, fig. 6 is a schematic diagram corresponding to the step S11 provided in fig. 4). In other embodiments, other points other than the top point on the parking space edge line can be detected as the parking space corner points, and the parking space corner points are specifically designed according to needs. It can be understood that the two first lines obtained by fitting are not parallel due to factors such as the viewing angle in the image to be detected.
S12: and mapping the two first straight lines into the transmission image by utilizing at least part of the parking space corner points to form two parallel and equidistant second straight lines.
Specifically, please refer to fig. 7, wherein fig. 7 is a flowchart illustrating an embodiment of step S12 in the parking space detection method provided in fig. 4. Step S12 specifically includes the following steps:
s121: and selecting a set number of target parking space angle points from the plurality of parking space angle points.
Specifically, the set number is at least 4.
In one embodiment, the distances from each parking space angular point to the two first lines are respectively acquired, and the parking space angular points with the set number and the minimum distances from the two first lines are determined as the target parking space angular points. The step of respectively obtaining the distances from each parking space corner point to the two first straight lines specifically comprises the following steps: respectively acquiring the position coordinates of each parking space angular point in a set coordinate system; and calculating the distance from each parking space angular point to the two first straight lines by using the position coordinates. The set coordinate system is established by taking a parking space angular point at an end point in an image to be detected as an original point and taking two directions extending along a parking space as coordinate axes. The parking space angular point is the vertex of the parking space.
And a coordinate system is set, so that the distance from the parking space corner point to the first straight line can be calculated conveniently. It can be understood that, in the set coordinate system, the direction in which the parking space and the road extend may be taken as the Y axis, and the other extending direction of the parking space may be taken as the X axis; the same direction of the parking space and the extending direction of the road can be used as an X axis, the other extending direction of the parking space is used as a Y axis, the distance from the corner point of the parking space to the first straight line can be calculated, and the X axis and the Y axis of the set coordinate system are not limited in the application.
Specifically, the target parking space angle point may be determined by the following formula.
Among them, adis i Indicating the distance, bdis, of the corner point of the parking space from the first straight line i The distance between the parking space angle points and the second first straight line is represented, and Dis _ sum represents that the sum of the distances between the parking space angle points with the set number and the two first straight lines is the minimum, wherein the set number is 4. Referring to fig. 8, fig. 8 is a simplified diagram of an embodiment of determining a target parking space corner point in step S121 provided in fig. 7. For example, a first point A and a second point B are selected on the first straight line L1, a third point C and a fourth point D are selected on the second first straight line L2,when the sum of the distance from the first point A to the second first straight line L2, the distance from the second point B to the second first straight line L2, the distance from the third point C to the first straight line L1 and the distance from the fourth point D to the first straight line L1 is minimum, the first point A, the second point B, the third point C and the fourth point D are determined as target parking space angular points. At this time, the distance between the first point a and the second point B is approximately equal to the distance between the third point C and the fourth point D; and the distance between the first point a and the third point C is approximately equal to the distance between the second point B and the fourth point D. In this embodiment, the first point a, the second point B, the third point C, and the fourth point D are respectively vertexes of the parking space, which may be an upper left angular point, a lower left angular point, an upper right angular point, and a lower right angular point of the parking space, and the parking space surrounded by the first point a, the second point B, the third point C, and the fourth point D is a target parking space. It will be appreciated that the first point a and the second point B are adjacent on a first line L1 and the third point C and the fourth point D are adjacent on a second first line L2. The first point a, the second point B, the third point C and the fourth point D may constitute the same parking space, which is a target parking space. By setting a coordinate system, the position coordinates of the first point a, the second point B, the third point C and the fourth point D can be obtained, and the distance from the first point a to the second first straight line L2, the distance from the second point B to the second first straight line L2, the distance from the third point C to the first straight line L1 and the distance from the fourth point D to the first straight line L1 can be calculated.
Further, a head end point E and a tail end point F of the parking space are selected from the first straight line L1, a head end point G and a tail end point H of the parking space are selected from the second straight line L2, and the head end point E, the tail end point F, the head end point G and the tail end point H are also determined as target parking space corner points. And determining the position coordinates of the head end point E, the tail end point F, the head end point G and the tail end point H through the coordinate system. In this embodiment, the head point E may be an upper left angular point of the parking space at the first straight line head end, the head point G may be an upper right angular point of the parking space at the first straight line head end, the tail point F may be a lower left angular point of the parking space at the first straight line tail end, and the tail point H may be a lower right angular point of the parking space at the first straight line tail end.
In another embodiment, the plurality of parking space angular points are other points on the parking space edge line other than the vertex (the vertex of the non-parking space and the end point of the first straight line), and a set number of parking space angular points are selected from the plurality of parking space angular points as the target parking space angular points. For example, two parking space angle points are selected on a first straight line, and the distance between the two parking space angle points is determined to be a first value according to a set coordinate system; two parking space angle points with the first distance are selected on the second straight line (the distance between the two parking space angle points selected on the second straight line is determined according to a set coordinate system), and the four parking space angle points are determined as target parking space angle points.
S122: and mapping the target parking space angle points into the transmission map so that connecting lines of corresponding points of the target parking space angle points in the transmission map form two parallel second straight lines at equal intervals.
The target parking space corner point is mapped to the perspective view to obtain two second straight lines as shown in fig. 9, and fig. 9 is a schematic diagram corresponding to step S122 provided in fig. 7.
In one embodiment, the parking space angle points of the set number with the smallest sum of the distances from each parking space angle point to the two first straight lines are determined as target parking space angle points. Because the parking stall that the target parking stall angular point that confirms through this mode constitutes is close to real parking stall, promptly, the parking stall that target parking stall angular point constitutes is close to the rectangle. The target parking space angle point is mapped into the transmission map, and a connecting line of corresponding points of the target parking space angle point in the transmission map forms two parallel and equally spaced second straight lines (please refer to fig. 10, fig. 10 is a schematic diagram of corresponding points of the target parking space angle point in the transmission map in fig. 8). The corresponding point of the first point a in the transmission diagram is A1, the corresponding point of the second point B in the transmission diagram is B1, the corresponding point of the third point C in the transmission diagram is C1, the corresponding point of the fourth point D in the transmission diagram is D1, the corresponding point of the head end point E in the transmission diagram is E1, the corresponding point of the tail end point F in the transmission diagram is F1, the corresponding point of the head end point G in the transmission diagram is G1, the corresponding point of the tail end point H in the transmission diagram is H1, a connecting line of the corresponding point E1, the corresponding point A1, the corresponding point B1 and the corresponding point F1 forms a first second straight line L3, a connecting line of the corresponding point G1, the corresponding point C1, the corresponding point D1 and the tail end point H1 forms a second straight line L4, and the first second straight line L3 and the second straight line L4 are parallel and equidistant.
It can be understood that if the target parking space angle point only has a first point a, a second point B, a third point C and a fourth point D, two parallel and equidistant second straight lines can be obtained according to the target parking space angle point, and the two second straight lines at the moment are extended in the same length along the extending direction of the second straight lines, so that the second straight lines are divided in a follow-up manner. If the target parking space angular point only has a head end point E, a tail end point F, a head end point G and a tail end point H, two parallel and equidistant second straight lines can be obtained according to the target parking space angular point; before the subsequent second straight line is divided, a first point A, a second point B, a third point C and a fourth point D need to be determined through the formula so as to obtain information of the same parking space where the first point A, the second point B, the third point C and the fourth point D are located, the same parking space is used as a target parking space, and the second straight line is divided according to the distance between the target parking spaces.
In another embodiment, the parking space angle points with the set number are selected from non-top points on a plurality of parking space edge lines to serve as target parking space angle points. For example, two parking space angular points are selected on a first straight line, and the distance between the two parking space angular points is determined as a first value according to a set coordinate system; two parking space angle points with the distance as a first value are selected on the second straight line (the distance between the two parking space angle points selected on the second straight line is determined according to a set coordinate system), and the four parking space angle points are determined as target parking space angle points. The target parking space angular points determined by the method are equidistant on two first straight lines, and two side lines of the actual parking spaces are parallel, so that the connecting lines of the corresponding points of the target parking space angular points in the transmission diagram form two parallel and equidistant second straight lines. It can be understood that the two second straight lines obtained in this embodiment need to be extended along the extending direction by the same length, so as to divide the second straight lines in the following process.
S13: and determining the image to be detected and the conversion relation of the transmission map based on the position information of at least part of the parking space angular points on the first straight line and the position information of at least part of the parking space angular points on the corresponding points of the transmission map on the second straight line.
Specifically, at least part of the parking space angular points are target parking space angular points, and a first position coordinate of the target parking space angular points in the image to be detected and a second position coordinate of corresponding points of the target parking space angular points in the transmission image are obtained; and obtaining the conversion relation between the image to be detected and the transmission image by using the first position coordinate and the second position coordinate. Specifically, a coordinate system is set in an image to be detected, and a first position coordinate of a target parking space corner point in the image to be detected is determined by utilizing the coordinate system; setting another coordinate system in the transmission image, and determining a second position coordinate of a corresponding point of the target parking space corner point in the transmission image by using the coordinate system; and obtaining the conversion relation between the image to be detected and the transmission image by utilizing the first position coordinate and the second position coordinate. For example, a transformation matrix for converting the image to be detected into the transmission map is obtained by using the first position coordinate and the second position coordinate.
S14: and dividing the two second straight lines based on the positions and the intervals of the corresponding points of the parking space angular points forming the same parking space in the image to be detected in the transmission map to obtain the parking space information in the transmission map.
Specifically, the distance between two corresponding points of two corner points in a transmission image, wherein the two corner points form the same parking space in an image to be detected, is obtained; and dividing the two second straight lines at intervals to form a plurality of parking spaces, so as to obtain parking space information in the transmission diagram. The coordinate system is set in the transmission diagram to obtain the distance between two corresponding points of two corner points in the transmission diagram, wherein the two corner points form the same parking space in the image to be detected, and each distance in the coordinate system is divided into a parking space, so that the parking space information in the transmission diagram is obtained.
In one embodiment, two angular points of the parking space angular points forming the same parking space in the image to be detected are selected, wherein the two angular points can be the vertexes of the parking space, such as an upper left angular point and a lower left angular point; and acquiring the distance between two corresponding points of the two angular points in the transmission image, and dividing a parking space on the second straight line at intervals of the distance. That is, the interval between the corresponding point A1 and the corresponding point B1 in fig. 4, or the interval between the corresponding point C1 and the corresponding point D1 is acquired, and the second straight line is divided according to the interval. The distance between the corresponding point A1 and the corresponding point B1 is the height of one parking space in the perspective view, and in reality, the heights of a plurality of parking spaces are the same, so that the parking spaces can be divided according to the distance.
In another embodiment, two of the parking space angular points forming the same parking space in the image to be detected are selected, and the two angular points can be the vertexes of the parking space, such as an upper left angular point and a lower right angular point; two corresponding points of the two angular points in the transmission diagram are respectively located on two second straight lines, the distance between the two corresponding points of the two angular points in the transmission diagram is obtained, and along the extending direction of the second straight lines, a parking space is defined on the two second straight lines at intervals of the distance. That is, the distance between the corresponding point A1 and the corresponding point D1 in fig. 4, or the distance between the corresponding point B1 and the corresponding point C1, that is, the distance between the diagonal parking spaces is obtained, and the second straight line is divided according to the distance. The distance between the corresponding point A1 and the corresponding point D1 is the length of the diagonal line of one parking space in the perspective view, and the lengths of the diagonal lines of a plurality of parking spaces are the same in reality, so that the parking spaces can be divided according to the distance.
Two corresponding points of two corner points in the transmission image, which form the corner points of the same parking space and are selected from the images to be detected, may be at the end of the second straight line, or may be at the middle position of the second straight line (the middle position of the second straight line refers to the rest part excluding the end of the second straight line). When two corresponding points of two corner points in the transmission image, which are selected from the images to be detected and form the corner points of the same parking space, are located in the middle of a second straight line, and a parking space is defined from the middle of the second straight line to the two ends of the second straight line at intervals; and a parking space is defined in response to the fact that the remaining distance between the head end and the tail end of the two second straight lines is smaller than the distance and larger than half of the distance. That is to say, divide two second straight lines at this interval to form a plurality of parking stalls, thereby obtain the parking stall information in the transmission map, include: and in response to the fact that the remaining distance between the head end and the tail end of the two second straight lines is smaller than the distance and larger than a half of the distance, dividing the area of which the remaining distance is smaller than the distance and larger than the half of the distance into a parking space.
It is to be understood that the order of implementing step S13 and step S14 is not limited, and step S13 may be performed first and then step S14 may be performed, step S13 may be performed first and step S14 may be performed first, step S13 and step S14 may be performed simultaneously, and the steps are specifically designed as needed.
S15: and obtaining parking space information in the image to be detected based on the conversion relation and the parking space information in the transmission diagram.
Specifically, the corresponding points of the multiple parking spaces in the transmission diagram are mapped to two first straight lines by using the conversion relationship, so that the parking space information of the image to be detected is obtained. The method comprises the steps of dividing a perspective view into a plurality of parking spaces, correspondingly obtaining corresponding points of the plurality of parking spaces in the perspective view, mapping the corresponding points of the plurality of parking spaces to two first straight lines by using a conversion relation, and obtaining parking space information of an image to be detected. In an embodiment, when the conversion relationship from the image to be detected to the transmission map is specifically a transformation matrix, the conversion relationship from the transmission map to the image to be detected is specifically an inverse transformation matrix. That is, the conversion manner of the transmission map into the image to be detected and the conversion manner of the image to be detected into the transmission map are in reverse correspondence.
The parking space detection method comprises the steps of obtaining a plurality of parking space angular points in an image to be detected, and fitting the parking space angular points into two first straight lines; mapping the two first straight lines into a transmission image by using at least part of parking space angular points to form two parallel and equally spaced second straight lines; determining a conversion relation between an image to be detected and a transmission image based on the position information of at least part of parking space angular points on a first straight line and the position information of at least part of parking space angular points on a second straight line of corresponding points of the transmission image; dividing two second straight lines based on the positions and the intervals of the corresponding points of the parking space angular points forming the same parking space in the image to be detected in the transmission image to obtain parking space information in the transmission image; based on the parking stall information in the conversion relation and the transmission map obtain waiting to detect the parking stall information in the image, after detecting out partial parking stall through the parking stall angular point, realize revising the false retrieval parking stall and supplying and missing the detection parking stall to provide accurate parking stall information for the driver, make the driver can be faster find the parking stall. In addition, the parking space detection method does not need to acquire camera parameters (internal reference and external reference), and does not need to convert the image to be detected into a top view, so that the realization difficulty of the detection method is reduced.
Referring to fig. 11, fig. 11 is a schematic flow chart of an embodiment of a parking space detection method provided in the present application.
S21: and acquiring the detection information of all parking space angular points. The image to be detected is obtained through the image acquisition device, a plurality of parking spaces are arranged in the image to be detected, four vertexes of each parking space in the plurality of parking spaces are detected through the detection method of the neural network detection key points, and the four vertexes are respectively an upper left angular point, a lower left angular point, an upper right angular point and a lower right angular point, as shown in fig. 5.
S22: and sequencing all the parking spaces. And setting a coordinate system by taking a parking space angular point at an end point in the image to be detected as an original point, taking the parking space in the same direction as the extending direction of the road as a Y axis and taking the other extending direction of the parking space as an X axis. And sequencing all parking spaces along the Y axis of the coordinate system from small to large according to the coordinates of the upper left corner point, so that the corner point of the target parking space for perspective transformation is convenient to select.
S23: the upper left angular points and the lower left angular points of all parking spaces are fitted to obtain a first straight line, and the upper right angular points and the lower right angular points of all parking spaces are fitted to obtain a second straight line, as shown in fig. 6.
S24: and acquiring head and tail end points of the two first straight lines and an upper left angular point, a lower left angular point, an upper right angular point and a lower right angular point of the target parking space (as shown in fig. 8). The maximum point and the minimum point of the first straight line on the Y axis of the set coordinate system are set as the head and tail end points. The head end point of the first straight line is the minimum y value in the parking space angle points of the first sorted parking space, and the tail end point is the maximum y value in the parking space angle points of the last sorted parking space. And acquiring an upper left angular point, a lower left angular point, an upper right angular point and a lower right angular point of the target parking space through the following formula. This formula is described above and will not be described further.
S25: and obtaining a transformation matrix by using the upper left angular point, the lower left angular point, the upper right angular point and the lower right angular point of the target parking space as four points of perspective transformation. Determining first position coordinates of an upper left angular point, a lower left angular point, an upper right angular point and a lower right angular point of a target parking space in an image to be detected by using a coordinate system in the image to be detected; setting another coordinate system in the transmission image, and determining second position coordinates of corresponding points of an upper left angular point, a lower left angular point, an upper right angular point and a lower right angular point of the target parking space in the transmission image by using the coordinate system; and obtaining a transformation matrix by using the first position coordinate and the second position coordinate.
S26: and mapping head and tail end points of the two first straight lines into the perspective view by using a transformation matrix to obtain two parallel and equally-spaced second straight lines in the perspective view (as shown in figure 10).
S27: and dividing the two second straight lines according to the height of the target parking space in the perspective view to obtain the parking space angle point information of all parking spaces in the perspective view. Referring to fig. 10, the distance between the corresponding point A1 and the corresponding point B1 is the height of the target car corresponding to the car in the perspective view. The manner of dividing the two second straight lines is the same as the above description, and is not described again.
S28: and mapping the parking space angular point information in the perspective view back to the image to be detected by using an inverse transformation matrix which is in a reverse corresponding relation with the transformation matrix to obtain the parking space information in the image to be detected.
The parking space detection method can correct the false detection parking space and complement the missed detection parking space so as to provide accurate parking space information for the driver, and the driver can find the parking space more quickly. In addition, the parking space detection method does not need to acquire camera parameters (internal reference and external reference), and does not need to convert the image to be detected into a top view, so that the realization difficulty of the detection method is reduced.
Referring to fig. 12, fig. 12 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. The electronic device comprises a memory 20 and a processor 21 connected to each other.
The memory 20 is used for storing program instructions for implementing any one of the above-mentioned parking space detection methods.
The processor 21 may also be referred to as a CPU (Central Processing Unit). The processor 21 may be an integrated circuit chip having signal processing capabilities. The processor 21 may also be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 20 may be a memory bank, a TF card, etc., and may store all information in the electronic device of the device, including the input raw data, the computer program, the intermediate operation result, and the final operation result. It stores and retrieves information based on the location specified by the controller. With the memory 20, the electronic device has a memory function, so that the electronic device can work normally. The storage 20 of the electronic device may be classified into a main storage (internal storage) and an auxiliary storage (external storage) according to the purpose, and there is a classification method into an external storage and an internal storage. The external memory is usually a magnetic medium, an optical disk, or the like, and can store information for a long period of time. The memory is a storage unit on the motherboard, which is used for storing data and programs currently being executed, but is only used for temporarily storing the programs and the data, and the data is lost when the power is turned off or the power is cut off.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a module or a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a system server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method of the embodiments of the present application.
Referring to fig. 13, fig. 13 is a schematic structural diagram of a computer-readable storage medium according to an embodiment of the present disclosure. The storage medium of the present application stores a program file 30 capable of implementing all the above parking space detection methods, where the program file 30 may be stored in the storage medium in the form of a software product, and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods according to the embodiments of the present application. The foregoing storage device includes: various media capable of storing program codes, such as a usb disk, a mobile hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, or terminal devices, such as a computer, a server, a mobile phone, and a tablet.
The above description is only an embodiment of the present application, and is not intended to limit the scope of the present application, and all equivalent structures or equivalent processes performed by the present application and the contents of the attached drawings, which are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.
Claims (11)
1. A parking space detection method is characterized by comprising the following steps:
acquiring a plurality of parking space angular points in an image to be detected, and fitting the parking space angular points into two first straight lines;
mapping the two first straight lines into a transmission diagram by using at least part of the parking space angle points to form two parallel and equally spaced second straight lines;
determining a conversion relation between the image to be detected and the transmission image based on the position information of at least part of the parking space angular points on the first straight line and the position information of at least part of the parking space angular points on the second straight line of corresponding points of the transmission image; and
dividing the two second straight lines based on the positions and the intervals of the parking space angular points forming the same parking space in the image to be detected at the corresponding points in the transmission map to form a plurality of parking spaces and obtain parking space information in the transmission map;
and obtaining the parking space information in the image to be detected based on the conversion relation and the parking space information in the transmission diagram.
2. The parking space detection method according to claim 1, wherein the mapping the two first straight lines into a transmission map by using at least part of the parking space angle points to form two parallel and equally spaced second straight lines comprises:
selecting a set number of target parking space angular points from the plurality of parking space angular points;
and mapping the target parking space angle points to the transmission map so that connecting lines of corresponding points of the target parking space angle points in the transmission map form two parallel second straight lines at equal intervals.
3. The parking space detection method according to claim 2, wherein said selecting a set number of target parking space angle points from said plurality of parking space angle points comprises:
respectively acquiring the distance from each parking space angular point to the two first straight lines;
and determining the parking space angle points with the minimum distance to the two first straight lines and the set number as the target parking space angle points.
4. The parking space detection method according to claim 3, wherein the step of respectively obtaining the distance from each parking space corner point to the two first lines comprises:
respectively acquiring the position coordinates of each parking space angular point in a set coordinate system; the set coordinate system is established by taking a parking space angular point at an end point in the image to be detected as an original point and taking two directions extending along a parking space as coordinate axes;
and calculating the distance from each parking space corner point to the two first straight lines by using the position coordinates.
5. The parking space detection method according to any one of claims 2 to 4, wherein the determining of the conversion relationship between the image to be detected and the transmission map based on the position information of the at least part of the parking space corner points on the first line and the position information of the at least part of the parking space corner points on the second line of the corresponding points of the transmission map comprises:
acquiring a first position coordinate of the target parking space angular point in the image to be detected and a second position coordinate of a corresponding point of the target parking space angular point in the transmission image;
and obtaining the conversion relation between the image to be detected and the transmission image by using the first position coordinate and the second position coordinate.
6. The parking space detection method according to any one of claims 2 to 4, wherein the step of dividing the two second lines based on the positions and the distances of the corresponding points in the transmission map of the parking space corner points forming the same parking space in the image to be detected to obtain the parking space information in the transmission map comprises the steps of:
acquiring the distance between two corresponding points of two corner points in the transmission image, wherein the two corner points form the same parking space in the image to be detected;
and dividing the two second straight lines at intervals to form a plurality of parking spaces, so as to obtain parking space information in the transmission diagram.
7. The parking space detection method according to claim 6, wherein the dividing the two second straight lines every interval of the distance to form a plurality of parking spaces so as to obtain the parking space information in the transmission map comprises:
and in response to that the remaining distance between the head end and the tail end of the two second straight lines is smaller than the distance and larger than half of the distance, dividing an area of the distance, in which the remaining distance is smaller than the distance and larger than half of the distance, into a parking space.
8. The parking space detection method according to claim 1, wherein the obtaining of the parking space information in the image to be detected based on the conversion relationship and the parking space information in the transmission map comprises:
and mapping the corresponding points of the plurality of parking spaces in the transmission diagram to the two first straight lines by using a conversion relation to obtain the parking space information of the image to be detected.
9. A space detection method according to claim 2 or 3, wherein the set number is at least 4.
10. An electronic device, comprising: a memory storing program instructions and a processor retrieving the program instructions from the memory to perform the method of any one of claims 1 to 9.
11. A computer-readable storage medium, characterized in that a program file is stored, which can be executed to implement the parking space detection method according to any one of claims 1-9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110943529.7A CN113903188B (en) | 2021-08-17 | 2021-08-17 | Parking space detection method, electronic device and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110943529.7A CN113903188B (en) | 2021-08-17 | 2021-08-17 | Parking space detection method, electronic device and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113903188A CN113903188A (en) | 2022-01-07 |
CN113903188B true CN113903188B (en) | 2022-12-06 |
Family
ID=79187602
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110943529.7A Active CN113903188B (en) | 2021-08-17 | 2021-08-17 | Parking space detection method, electronic device and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113903188B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115206130B (en) * | 2022-07-12 | 2023-07-18 | 合众新能源汽车股份有限公司 | Parking space detection method, system, terminal and storage medium |
CN115762218B (en) * | 2022-10-10 | 2024-10-11 | 中汽创智科技有限公司 | Parking space map generation method, device, equipment and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101993378B1 (en) * | 2018-03-12 | 2019-06-26 | 에이치디씨아이콘트롤스주식회사 | System and method for detecting and guiding parking availability using image information |
CN110390306A (en) * | 2019-07-25 | 2019-10-29 | 湖州宏威新能源汽车有限公司 | Detection method, vehicle and the computer readable storage medium of right angle parking stall |
CN110414355A (en) * | 2019-06-27 | 2019-11-05 | 沈阳工业大学 | The right bit sky parking stall of view-based access control model and parking stall line detecting method during parking |
CN110472580A (en) * | 2019-08-16 | 2019-11-19 | 北京茵沃汽车科技有限公司 | The method, apparatus of detection parking stall based on full-view image, storage medium |
CN110796063A (en) * | 2019-10-24 | 2020-02-14 | 百度在线网络技术(北京)有限公司 | Method, device, equipment, storage medium and vehicle for detecting parking space |
CN111178295A (en) * | 2019-12-31 | 2020-05-19 | 华为技术有限公司 | Parking space detection and model training method and device, vehicle, equipment and storage medium |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6778620B2 (en) * | 2017-01-17 | 2020-11-04 | 株式会社デンソーテン | Road marking device, road marking system, and road marking method |
JP6825529B2 (en) * | 2017-09-28 | 2021-02-03 | トヨタ自動車株式会社 | Driving support device |
CN109614913A (en) * | 2018-12-05 | 2019-04-12 | 北京纵目安驰智能科技有限公司 | A kind of oblique parking stall recognition methods, device and storage medium |
CN112016349B (en) * | 2019-05-29 | 2024-06-11 | 北京市商汤科技开发有限公司 | Parking space detection method and device and electronic equipment |
CN112633152B (en) * | 2020-12-22 | 2021-11-26 | 深圳佑驾创新科技有限公司 | Parking space detection method and device, computer equipment and storage medium |
CN112562400B (en) * | 2020-12-24 | 2024-01-12 | 北京筑梦园科技有限公司 | Parking space line acquisition method and device and parking management system |
-
2021
- 2021-08-17 CN CN202110943529.7A patent/CN113903188B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101993378B1 (en) * | 2018-03-12 | 2019-06-26 | 에이치디씨아이콘트롤스주식회사 | System and method for detecting and guiding parking availability using image information |
CN110414355A (en) * | 2019-06-27 | 2019-11-05 | 沈阳工业大学 | The right bit sky parking stall of view-based access control model and parking stall line detecting method during parking |
CN110390306A (en) * | 2019-07-25 | 2019-10-29 | 湖州宏威新能源汽车有限公司 | Detection method, vehicle and the computer readable storage medium of right angle parking stall |
CN110472580A (en) * | 2019-08-16 | 2019-11-19 | 北京茵沃汽车科技有限公司 | The method, apparatus of detection parking stall based on full-view image, storage medium |
CN110796063A (en) * | 2019-10-24 | 2020-02-14 | 百度在线网络技术(北京)有限公司 | Method, device, equipment, storage medium and vehicle for detecting parking space |
CN111178295A (en) * | 2019-12-31 | 2020-05-19 | 华为技术有限公司 | Parking space detection and model training method and device, vehicle, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113903188A (en) | 2022-01-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3633539A2 (en) | Method for position detection, device, and storage medium | |
US11275962B2 (en) | Method of controlling image acquisition and other related tools | |
CN109918977B (en) | Method, device and equipment for determining idle parking space | |
CN113903188B (en) | Parking space detection method, electronic device and computer readable storage medium | |
CN110738150B (en) | Camera linkage snapshot method and device and computer storage medium | |
CN113874927A (en) | Parking detection method, system, processing device and storage medium | |
CN108596899B (en) | Road flatness detection method, device and equipment | |
CN111462503A (en) | Vehicle speed measuring method and device and computer readable storage medium | |
CN114862929A (en) | Three-dimensional target detection method and device, computer readable storage medium and robot | |
CN114550142A (en) | Parking space detection method based on fusion of 4D millimeter wave radar and image recognition | |
WO2024140336A1 (en) | Vehicle-mounted ranging method, system and apparatus, electronic apparatus and storage medium | |
CN114973752B (en) | License plate and parking space number association method and device, intelligent vehicle and readable storage medium | |
CN115240150A (en) | Lane departure warning method, system, device and medium based on monocular camera | |
CN115393433A (en) | Detection area recovery method, device, equipment and storage medium | |
CN111746521B (en) | Parking route planning method, device, equipment and storage medium | |
CN116168357A (en) | Foreground target machine vision extraction system and method for intelligent vehicle | |
CN108416305B (en) | Pose estimation method and device for continuous road segmentation object and terminal | |
CN113147746A (en) | Method and device for detecting ramp parking space | |
CN115063772B (en) | Method for detecting vehicles after formation of vehicles, terminal equipment and storage medium | |
CN112498338B (en) | Stock level determination method and device and electronic equipment | |
CN115937007B (en) | Wind shear identification method and device, electronic equipment and medium | |
CN113838125B (en) | Target position determining method, device, electronic equipment and storage medium | |
US20240193961A1 (en) | Parking space detection method, electronic device and computer-readable storage medium | |
CN117831331A (en) | Parking space determining method and device, computer equipment and storage medium | |
WO2024037363A1 (en) | Display method, electronic device, storage medium, and program product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |