Lane line detection method and device, electronic device and computer readable storage medium
By converting the image to be detected into a binary image and generating target pixel clusters, combined with edge fitting and histogram analysis, the problems of lane line detection errors and recognition errors in the existing technology are solved, and more accurate and efficient lane lines are achieved. Identify.
Patent Information
- Application Number
- CN202110258199.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-09
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-03-09
AI Technical Summary
Existing lane line detection methods are easily affected by image noise, resulting in errors in lane line determination, and recognition errors in irregular scenes such as intersections, making it difficult to accurately identify lane lines.
By converting the image to be detected into a binary image, target pixel clusters are generated and candidate lane lines are determined. The left edge and right edge fitting equations are used to filter the target lane lines to ensure that the width and shape of the lane lines meet the preset conditions and are detected at the intersection. Determine lane line status through histogram analysis.
It improves the accuracy and robustness of lane line recognition, reduces the consumption of computing resources, improves lane line detection efficiency, and can accurately identify lane lines in intersection scenarios.
Smart Images

Figure CN112989991B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a lane line detection method and device, an electronic device, and a computer-readable storage medium. Background Art
[0002] In the field of intelligent control, the vehicle's assisted driving function and the vehicle's automatic driving function have received more and more attention. When the assisted driving function is turned on, the vehicle can assist the driver in completing driving behaviors, such as driving, steering, parking, etc.; when the automatic driving function is turned on, the vehicle can complete the driving behavior without the driver's participation.
[0003] Both of the above two behaviors need to rely on the lane line local map. Based on the lane line local map, the driving plan of the current vehicle can be planned.
[0004] The establishment of local maps mainly depends on the detection of lane lines. The current lane line detection method mainly relies on image recognition to identify lane lines in images collected by vehicles. However, the lane line determination by this method is often affected by factors such as image noise, resulting in certain errors in the lane line determination, and there is still room for optimization.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure. Summary of the invention
[0006] The embodiments of the present disclosure provide a lane line detection method and device, an electronic device, and a computer-readable storage medium, which can accurately and conveniently determine the lane lines in an image to be detected.
[0007] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0008] The disclosed embodiment proposes a lane line detection method, which includes: acquiring an image to be detected; generating a binary image to be detected based on the image to be detected; generating a target pixel cluster based on pixels whose continuous pixel values in each row in the binary image to be detected are the first value; determining a candidate lane line in the binary image to be detected based on the target pixel cluster in the image to be detected; determining a left edge fitting equation and a right edge fitting equation of the candidate lane line; and determining that the candidate lane line is a target lane line based on the left edge fitting equation and the right edge fitting equation.
[0009] In some embodiments, determining candidate lane lines in the binary image to be detected based on target pixel clusters in the image to be detected includes: eliminating target pixel clusters whose pixel numbers are not within a first range to determine candidate pixel clusters; and determining the candidate lane lines in the binary image to be detected based on the candidate pixel clusters.
[0010] In some embodiments, the candidate lane line is determined in the binary image to be detected based on the candidate pixel clusters, including: determining any pixel cluster in the candidate pixel clusters as the current pixel cluster; taking the pixel at the center of the current pixel cluster as the target pixel; searching in the upward and downward directions in the column direction starting from the target pixel to determine the previous pixel cluster where the previous pixel of the target pixel is located and the next pixel cluster where the next pixel of the target pixel is located; if the difference in the number of pixels between the previous pixel cluster and the next pixel cluster is less than a first threshold, determining that the current pixel cluster where the target pixel is located is a valid pixel cluster; taking the next pixel cluster of the current pixel cluster as the current pixel cluster to continue searching for valid pixel clusters; when the search is completed, integrating the upper and lower continuous pixel clusters into a lane line candidate cluster; when the number of pixel clusters of the lane line candidate cluster is greater than a preset number, generating the candidate lane line based on the lane line candidate cluster.
[0011] In some embodiments, the method further includes: if the difference in the number of pixels between the previous pixel cluster of the current pixel and the next pixel cluster is greater than or equal to the first threshold, no longer searching for a valid pixel cluster for the next pixel cluster of the current pixel cluster; taking the previous pixel cluster of the current pixel cluster as the current pixel cluster, and continuing to search for valid pixel clusters upward.
[0012] In some embodiments, determining the candidate lane line as the target lane line according to the left edge fitting equation and the right edge fitting equation includes: determining according to the left edge fitting equation and the right edge fitting equation that the lane line width of the candidate lane line satisfies a first condition, the lane line shape of the candidate lane line satisfies a second condition, and the left edge curve corresponding to the left edge fitting equation is parallel to the right edge curve corresponding to the right edge fitting equation; and determining the candidate lane line as the target lane line.
[0013] In some embodiments, determining that the lane line width of the candidate lane line satisfies a first condition, the lane line shape of the candidate lane line satisfies a second condition, and the left edge curve corresponding to the left edge fitting equation is parallel to the right edge curve corresponding to the right edge fitting equation according to the left edge fitting equation includes: if the difference between the constant term of the left edge fitting equation and the constant term of the right edge fitting equation is within a second range, determining that the lane line width of the candidate lane line satisfies the first condition; if the quadratic term coefficient of the left edge fitting equation and the quadratic term coefficient of the right edge fitting equation are both within a third range, determining that the lane line shape of the candidate lane line satisfies the second condition; if the linear term coefficient of the left edge fitting equation and the linear term coefficient of the right edge fitting equation are within a fourth range, and the quadratic term coefficient of the left edge fitting equation and the quadratic term coefficient of the right edge fitting equation are within a fifth range, then the left edge curve corresponding to the left edge fitting equation is parallel to the right edge curve corresponding to the right edge fitting equation.
[0014] In some embodiments, before generating a target pixel cluster based on pixels whose continuous pixel values in each row in the binary image to be detected are the first value, the method also includes: counting the number of valid pixel points whose pixel values are the first value by column in the binary image to be detected; generating a target histogram based on the number of valid pixel points obtained by column statistics, the target histogram displaying the number of pixel points whose pixel values in each column in the image to be detected are the first value; if the number of pixel points in the target histogram is greater than a second threshold, and the number of columns with the same number of pixel points whose pixel values are the first value is less than a third threshold, then it is considered that the image to be detected is an image collected at the exit road.
[0015] An embodiment of the present disclosure provides a lane line detection device, which may include: an image acquisition module to be detected, a binary image acquisition module to be detected, a target pixel cluster determination module, a candidate lane line determination module, an equation fitting module and a target lane line module.
[0016] Among them, the image to be detected acquisition module can be configured to acquire the image to be detected; the binary image to be detected acquisition module can be configured to generate a binary image to be detected based on the image to be detected; the target pixel cluster determination module can be configured to generate a target pixel cluster based on pixels with a first value in each row of continuous pixel values in the binary image to be detected; the candidate lane line determination module can be configured to determine the candidate lane line in the binary image to be detected based on the target pixel cluster in the image to be detected; the equation fitting module can be configured to determine the left edge fitting equation and the right edge fitting equation of the candidate lane line; the target lane line module can be configured to determine the candidate lane line as the target lane line based on the left edge fitting equation and the right edge fitting equation.
[0017] An embodiment of the present disclosure proposes an electronic device, which includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any of the lane line detection methods described above.
[0018] The embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the lane line detection method as described in any one of the above items is implemented.
[0019] The embodiment of the present disclosure provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above lane line detection method.
[0020] The lane line detection method, device, electronic device and computer-readable storage medium provided by the embodiments of the present disclosure convert the image to be detected into a binary image to be detected, then determine a target pixel cluster whose pixel value is a first value in the binary image to be detected to determine a candidate lane line, and then screen the candidate lane lines through an edge fitting equation to determine the target lane line. The technical solution provided by the embodiments of the present disclosure accurately and simply determines the binary image to be detected in the image to be detected.
[0021] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. The drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can also be obtained based on these drawings without creative work.
[0023] Figure 1 A schematic diagram showing an exemplary system architecture of a lane line detection method or a lane line detection device applied to an embodiment of the present disclosure is shown.
[0024] Figure 2 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown.
[0025] Figure 3 The figure is a flow chart of a lane line detection method according to an exemplary embodiment.
[0026] Figure 4 is a schematic diagram showing an image to be detected according to an exemplary embodiment.
[0027] Figure 5 is a schematic diagram showing an image to be detected according to an exemplary embodiment.
[0028] Figure 6 is a schematic diagram showing an image to be detected according to an exemplary embodiment.
[0029] Figure 7 Yes Figure 4 The schematic diagram of the binary image to be detected after the image to be detected is binarized is shown.
[0030] Figure 8 The diagram is a schematic diagram showing a target lane line drawn in a binary image to be detected according to an exemplary embodiment.
[0031] Fig. 9 yes Figure 3 Flowchart of step S4 in an exemplary embodiment.
[0032] Fig.10 yes Figure 3 Flowchart of step S6 in an exemplary embodiment.
[0033] Fig.11 The figure is a flow chart of a lane line detection method according to an exemplary embodiment.
[0034] Fig.12 is a schematic diagram of a target histogram according to an exemplary embodiment.
[0035] Fig.13 The figure is a block diagram of a lane line detection device according to an exemplary embodiment. DETAILED DESCRIPTION
[0036] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0037] The features, structures or characteristics described in the present disclosure may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.
[0038] The accompanying drawings are only schematic diagrams of the present disclosure, and the same reference numerals in the drawings represent the same or similar parts, so their repeated description will be omitted. Some block diagrams shown in the accompanying drawings do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0039] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and steps, nor must they be executed in the order described. For example, some steps can be decomposed, and some steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0040] In this specification, the terms "a", "an", "the", "said" and "at least one" are used to indicate the presence of one or more elements / components / etc.; the terms "comprising", "including" and "having" are used to express an open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first", "second" and "third" etc. are used only as labels and are not intended to limit the quantity of their objects.
[0041] The exemplary embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0042] Figure 1 A schematic diagram of an exemplary system architecture that can be applied to a lane line detection method or a lane line detection device according to an embodiment of the present disclosure is shown.
[0043] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0044] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, wearable devices, virtual reality devices, smart homes, etc.
[0045] The server 105 may be a server that provides various services, such as a background management server that provides support for devices operated by users using the terminal devices 101, 102, and 103. The background management server may analyze and process the received request data, and feed back the processing results to the terminal device.
[0046] The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms, etc. The present disclosure does not impose any restrictions on this.
[0047] The server 105 may, for example, acquire an image to be detected; the server 105 may, for example, generate a binary image to be detected based on the image to be detected; the server 105 may, for example, generate a target pixel cluster based on pixels whose continuous pixel values in each row in the binary image to be detected are the first value; the server 105 may, for example, determine a candidate lane line in the binary image to be detected based on the target pixel cluster in the image to be detected; the server 105 may, for example, determine a left edge fitting equation and a right edge fitting equation for the candidate lane line; the server 105 may, for example, determine that the candidate lane line is a target lane line based on the left edge fitting equation and the right edge fitting equation.
[0048] It should be understood that Figure 1 The number of terminal devices, networks and servers in the figure is only for illustration. The server 105 may be a physical server or may be composed of multiple servers. According to actual needs, it may have any number of terminal devices, networks and servers.
[0049] Reference below Figure 2 , which shows a schematic diagram of the structure of a computer system 200 of a terminal device suitable for implementing an embodiment of the present application. Figure 2 The terminal device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0050] like Figure 2As shown, the computer system 200 includes a central processing unit (CPU) 201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 202 or a program loaded from a storage part 208 into a random access memory (RAM) 203. In the RAM 203, various programs and data required for the operation of the computer system 200 are also stored. The CPU 201, the ROM 202, and the RAM 203 are connected to each other via a bus 204. An input / output (I / O) interface 205 is also connected to the bus 204.
[0051] The following components are connected to the I / O interface 205: an input section 206 including a keyboard, a mouse, etc.; an output section 207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 208 including a hard disk, etc.; and a communication section 209 including a network interface card such as a LAN card, a modem, etc. The communication section 209 performs communication processing via a network such as the Internet. A drive 210 is also connected to the I / O interface 205 as needed. A removable medium 211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 210 as needed, so that a computer program read therefrom is installed into the storage section 208 as needed.
[0052] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 209, and / or installed from a removable medium 211. When the computer program is executed by the central processing unit (CPU) 201, the above-mentioned functions defined in the system of the present application are executed.
[0053] It should be noted that the computer-readable storage medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable storage medium other than a computer-readable storage medium that can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0054] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0055] The modules (and / or submodules and / or) units involved in the embodiments of the present application may be implemented in software or in hardware. The modules (and / or submodules and / or) units described may also be provided in a processor, for example, may be described as: a processor including a sending unit, an acquiring unit, a determining unit, and a first processing unit. The names of these modules (and / or submodules and / or) units do not, in certain circumstances, constitute limitations on the modules (and / or submodules and / or) units themselves.
[0056] As another aspect, the present application also provides a computer-readable storage medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed by a device, the device can implement functions including: acquiring an image to be detected; generating a binary image to be detected based on the image to be detected; generating a target pixel cluster based on pixels whose continuous pixel values in each row of the binary image to be detected are the first value; determining a candidate lane line in the binary image to be detected based on the target pixel cluster in the image to be detected; determining the left edge fitting equation and the right edge fitting equation of the candidate lane line; determining the candidate lane line as the target lane line based on the left edge fitting equation and the right edge fitting equation.
[0057] In related technologies, lane line detection methods mostly use traditional computer vision methods. First, the image is dedistorted to eliminate the influence of distortion (due to the existence of distortion, the straight lane lines in reality will become curved in the image), and then a binary image is generated (pixel values greater than the threshold are set to 255, that is, white; pixel values less than the threshold are set to 0, that is, black). Then, a bird's-eye view corresponding to the binary image is generated through perspective transformation, and finally, the white pixel points on the lane line are searched through the sliding window search method.
[0058] Existing lane line detection methods need to rely on the recognition results of the previous frame. Therefore, in scenes where lane lines are irregularly distributed, such as intersections, existing lane line detection methods are prone to recognition errors. To solve the problem of identifying lane lines at intersections, each frame of the image must be processed independently.
[0059] Figure 3 is a flow chart of a lane line detection method according to an exemplary embodiment. The method provided by the embodiment of the present disclosure can be executed by any electronic device with computing and processing capabilities. For example, the method can be executed by the above Figure 1 The server or terminal device in the embodiment may be executed, or the server and the terminal device may be executed together. In the following embodiments, the server is used as the execution subject for example, but the present disclosure is not limited to this.
[0060] Reference Figure 3 The lane line detection method provided by the embodiment of the present disclosure may include the following steps.
[0061] In step S1, an image to be detected is obtained.
[0062] In some embodiments, the image to be detected may refer to an image that needs lane line detection, such as Figure 4 An image of the trip shown away from the junction, or Figure 5 The trip image captured when entering the intersection as shown, or Figure 6 The travel image shown is taken at the exit, and the present disclosure does not limit this.
[0063] In step S2, a binary image to be detected is generated according to the image to be detected.
[0064] After obtaining the image to be detected, the distortion of the image can be eliminated based on the camera distortion coefficient calibrated in advance.
[0065] Then, the dynamic threshold is calculated by the median filtering method to generate a binary image to be detected of the image to be detected. Specifically, it may include: traversing the pixels of the image to be detected row by row, finding the pixel median of N (for example, 90) pixels before and after the current pixel, as the threshold of the current pixel; if the current pixel value is greater than the threshold, it is set to the first value (for example, 255); if it is less than the threshold, it is set to the second value (for example, 0), and N is a positive integer greater than or equal to 1.
[0066] In the case of Figure 4 After the image to be detected is binarized, the following can be obtained: Figure 7 The binary image to be detected is shown.
[0067] In step S3, a target pixel cluster is generated according to pixels in each row whose continuous pixel values in the binary image to be detected are the first value.
[0068] For example, if a row in the binary image to be detected includes 36 columns, where the pixel values corresponding to the 10th to 15th columns are all first values, and the pixel values corresponding to the 20th to 30th columns are also the first values, then the target pixel cluster can be generated based on the pixels corresponding to the 10th to 15th and 20th to 30th columns of the row.
[0069] In step S4, candidate lane lines are determined in the binary image to be detected according to the target pixel clusters in the image to be detected.
[0070] In some embodiments, the upper and lower continuous pixel clusters in the binary image to be detected can be integrated into candidate lane clusters, and then the candidate lane clusters whose width and length meet preset conditions (for example, the width is in a first range and the length is in a second range, and the first range and the second range are both pre-set according to the actual situation of the lane line) are used as candidate lane lines.
[0071] In step S5, a left edge fitting equation and a right edge fitting equation of the candidate lane line are determined.
[0072] In some embodiments, each candidate lane line should have a width, that is, each candidate lane line has a left edge and a right edge. The left edge and the right edge of the candidate lane line can be fitted respectively to determine the left edge fitting equation and the right edge fitting equation.
[0073] In step S6, the candidate lane line is determined to be a target lane line according to the left edge fitting equation and the right edge fitting equation.
[0074] In some embodiments, whether the width, shape, etc. of the candidate lane line meets the requirements of the actual lane line can be determined based on the left edge fitting equation and the right edge fitting equation of the candidate lane line. If it is determined based on the left edge fitting equation and the right edge fitting equation that the candidate lane line does meet the requirements of the actual lane line, then the candidate lane line is determined to be the target lane line.
[0075] In some embodiments, after determining that the candidate lane line is the target lane line, the fitting equation of the target lane line can also be determined according to the left edge fitting equation and the right edge fitting equation of the candidate lane line, so as to accurately draw the target lane line in the binary image to be detected or the image to be detected. Figure 8 A target lane line drawn in a binary image to be detected is shown according to an exemplary embodiment.
[0076] The present invention proposes an image-based lane line detection method for intersections, which can improve the recognition accuracy and robustness of lane lines.
[0077] Fig. 9 yes Figure 3 Flowchart of step S4 in an exemplary embodiment. Fig. 9 , the above step S4 may include the following steps.
[0078] In step S41 , target pixel clusters whose pixel numbers are not within the first range are eliminated to determine candidate pixel clusters.
[0079] In some embodiments, the target pixel clusters whose number of pixels is not within the first range (the first range may be 6 to 20 pixels) may be eliminated, and then the candidate lane line is generated in the binary image to be detected based on the target pixel clusters after the elimination operation. Through the above pixel cluster elimination operation, it can be ensured that the width of the target lane line finally determined is within the preset range.
[0080] In some embodiments, after determining that the width of the target pixel cluster meets the conditions, it is also necessary to ensure that the length and shape of the target pixel cluster also meet the preset conditions. The specific process may include the following steps.
[0081] In step S42, any one pixel cluster among the candidate pixel clusters is determined as the current pixel cluster.
[0082] In step S43, the pixel at the center of the current pixel cluster is used as the target pixel.
[0083] In step S44, starting from the target pixel, a search is performed in the upward and downward directions along the column direction to determine the previous pixel cluster where the previous pixel of the target pixel is located and the next pixel cluster where the next pixel of the target pixel is located.
[0084] In step S45, if the difference in the number of pixels between the previous pixel cluster and the next pixel cluster is less than a first threshold (eg, 8 pixels), the current pixel cluster where the target pixel is located is determined to be a valid pixel cluster.
[0085] In step S46, the next pixel cluster of the current pixel cluster is used as the current pixel cluster to continue searching for valid pixel clusters.
[0086] In step S47, if the difference in the number of pixels between the previous pixel cluster of the current pixel and the next pixel cluster is greater than or equal to the first threshold, the next pixel cluster of the current pixel cluster is no longer searched for a valid pixel cluster.
[0087] That is, if the difference in the number of pixels between the previous pixel cluster and the next pixel cluster of the current pixel is less than the first threshold, the search for valid pixels in the downward direction of the current pixel continues (that is, the next pixel cluster of the current pixel is taken as the current pixel, and the search for valid pixels continues); if the number of pixels between the previous pixel cluster and the next pixel cluster of the current pixel is greater than or equal to the first threshold, the search for valid pixels in the downward direction of the current pixel is no longer performed.
[0088] In some embodiments, after completing the search in the downward direction, if it is necessary to search for valid pixels in the upward direction, the search may specifically include the following steps.
[0089] In step S48, the previous pixel cluster of the current pixel cluster is used as the current pixel cluster, and the search for valid pixel clusters is continued upward.
[0090] In some embodiments, when the search in the upward direction or the downward direction is completed, it can be considered that the search for the valid pixel cluster is completed.
[0091] In step S49, after the search is completed, the upper and lower continuous pixel clusters are integrated into a lane line candidate cluster.
[0092] In step S410, when the number of pixel clusters of the lane line candidate cluster is greater than a preset number, the candidate lane line is generated according to the lane line candidate cluster.
[0093] It should be noted that there may be multiple clustered target pixel clusters in the binary image to be detected, and the above method only provides a search method for the effectiveness of a group of clustered pixel clusters. Those skilled in the art can complete the search for all target pixel clusters in the binary image to be detected according to the above search method.
[0094] Fig.10 yes Figure 3 Flowchart of step S6 in an exemplary embodiment. Figure 3 Step S6 in may include: determining, according to the left edge fitting equation and the right edge fitting equation, that the lane line width of the candidate lane line satisfies a first condition, the lane line shape of the candidate lane line satisfies a second condition, and the left edge curve corresponding to the left edge fitting equation is parallel to the right edge curve corresponding to the right edge fitting equation; and determining that the candidate lane line is the target lane line.
[0095] Among them, the first condition, the second condition, etc. can be determined according to the actual situation of the lane line, and the present disclosure does not impose any restrictions on this.
[0096] The step S6 may specifically include the following steps: Fig.10 Steps shown.
[0097] In step S61, if the difference between the constant term of the left edge fitting equation and the constant term of the right edge fitting equation is within a second range, it is determined that the lane line width of the candidate lane line satisfies the first condition.
[0098] In some embodiments, the first condition can be set according to the actual width of the lane line. For example, it can be set to the constant term of the left edge fitting equation and the constant term of the right edge fitting equation within a second range (e.g., 6 to 20) so that the lane line width of the candidate lane line is within the range of 6 to 20 pixels.
[0099] In step S62, if the quadratic term coefficient of the left edge fitting equation and the quadratic term coefficient of the right edge fitting equation are both within a third range, it is determined that the lane line shape of the candidate lane line satisfies the second condition.
[0100] In some embodiments, since the quadratic term of the fitting equation controls the curvature of the curve, the actual lane line in the binary image to be detected is either perpendicular to the image horizontal axis coordinate system (assuming that the image to be detected corresponding to the binary image to be detected is collected by a moving vehicle, the image coordinate axis of the binary image to be detected can be constructed with the driving direction of the vehicle as the vertical axis and the direction perpendicular to the vertical axis as the horizontal and vertical axes), or has an angle with the horizontal axis coordinate system and cannot be parallel to the horizontal axis. Therefore, the quadratic term coefficient of the left edge fitting equation and the quadratic term coefficient of the right edge fitting equation can be made greater than a certain threshold to ensure that the shape of the target lane line conforms to the shape of the actual lane line in the actual image.
[0101] In step S63, if the linear coefficient of the left edge fitting equation and the linear coefficient of the right edge fitting equation are within the fourth range, and the quadratic coefficient of the left edge fitting equation and the quadratic coefficient of the right edge fitting equation are within the fifth range, then the left edge curve corresponding to the left edge fitting equation is parallel to the right edge curve corresponding to the right edge fitting equation.
[0102] For example, the difference between the linear coefficient of the left edge fitting equation and the linear coefficient of the right edge fitting equation can be made very small, and the difference between the quadratic coefficient of the left edge fitting equation and the quadratic coefficient of the right edge fitting equation can also be made very small to ensure that the edges of the target lane lines are approximately parallel.
[0103] Through the above steps, the target lane line whose lane line width satisfies the first condition (ensuring that the lane line width meets the condition), whose lane line shape (i.e. ensuring that the lane line shape meets the condition) meets the second condition and whose edges are approximately parallel can be found in the binary image to be detected.
[0104] In actual situations, the lane lines in the image to be detected taken by the vehicle at the intersection will have different degrees of curvature. If the lane lines are simply identified using the image recognition technology in the prior art, the lane lines cannot be accurately identified.
[0105] The present disclosure provides a Fig.11 The lane line detection method shown in the figure assumes that the road information near the intersection in the image to be detected can include three situations: entering the intersection, in the intersection, and exiting the intersection. When entering the intersection, the lane lines are still regular and can be identified according to traditional methods (such as traditional image recognition methods); in the intersection, there are no lane lines and no recognition is required; when exiting the intersection, the lane lines are identified using the method proposed in the present disclosure.
[0106] Then the method to determine the current state at the intersection is as follows:
[0107] In the binary image to be detected, the number of valid pixels whose pixel values are the first value (for example, 255) is counted by column; a target histogram is generated according to the number of valid pixels obtained by column statistics ( Fig.12 Yes Figure 7 The target histogram is obtained after the histogram statistics of the binary image to be detected as shown in the figure), the target histogram shows the number of pixels in each column of the image to be detected whose pixel value is the first value. For example, the number of white (255) pixels in each column of the binary image to be detected is counted using the histogram; when entering the intersection, the parallel characteristics of the zebra crossings at the intersection (such as Figure 5 As shown), the number of white pixels in the column where the zebra crossing is located is similar. Therefore, if the number of pixels in the target histogram is greater than the second threshold, and the number of columns with the same number of pixels whose pixel value is the first value is greater than or equal to the third threshold, the image to be detected is considered to be an image collected when entering the road; if the number of pixels in the target histogram is less than or equal to the second threshold (that is, it is determined that there are not enough white pixels in the binary image to be detected), the image to be detected is considered to be an image collected at the intersection; if the number of pixels in the target histogram is greater than the second threshold (that is, it is determined that there are enough white pixels in the binary image to be detected), and the number of columns with the same number of pixels whose pixel value is the first value (for example, 255) is less than the third threshold, the image to be detected is considered to be an image collected when exiting the road.
[0108] The technical solution provided in this embodiment can not only ensure the accuracy of lane line detection, but also save computing resources and improve lane line detection efficiency.
[0109] Fig.13 is a block diagram of a lane line detection device according to an exemplary embodiment. Fig.13 The lane line detection device 1300 provided in the embodiment of the present disclosure may include: a binary image acquisition module 1301 to be detected, a target pixel cluster determination module 1302, a candidate lane line determination module 1303, an equation fitting module 1304 and a target lane line module 1305.
[0110] Among them, the binary image acquisition module 1301 to be detected can be configured to acquire the image to be detected and generate a binary image to be detected based on the image to be detected; the target pixel cluster determination module 1302 can be configured to generate a target pixel cluster based on pixels whose continuous pixel values in each row in the binary image to be detected are the first value; the candidate lane line determination module 1303 can be configured to determine the candidate lane line in the binary image to be detected based on the target pixel cluster in the image to be detected; the equation fitting module 1304 can be configured to determine the left edge fitting equation and the right edge fitting equation of the candidate lane line; the target lane line module 1305 can be configured to determine the candidate lane line as the target lane line based on the left edge fitting equation and the right edge fitting equation.
[0111] In some embodiments, the candidate lane line determination module 1303 may include: a rejection submodule and a candidate lane line determination submodule.
[0112] Among them, the elimination submodule can be configured to eliminate the target pixel cluster whose number of pixels is not within the first range to determine the candidate pixel cluster; the candidate lane line determination submodule can be configured to determine the candidate lane line in the binary image to be detected based on the candidate pixel cluster.
[0113] In some embodiments, the candidate lane line determination submodule may include: a current pixel cluster determination unit, a target pixel determination unit, a search unit, a valid pixel cluster determination unit, a valid pixel cluster continued search unit, a lane candidate cluster determination unit, and a candidate lane line determination unit.
[0114] Wherein, the current pixel cluster determination unit can be configured to determine any pixel cluster in the candidate pixel cluster as the current pixel cluster; the target pixel determination unit can be configured to use the pixel at the center of the current pixel cluster as the target pixel; the search unit can be configured to search in the upper and lower directions in the column direction starting from the target pixel to determine the previous pixel cluster where the previous pixel of the target pixel is located and the next pixel cluster where the next pixel of the target pixel is located; the valid pixel cluster determination unit can be configured to determine that the current pixel cluster where the target pixel is located is a valid pixel cluster if the difference in the number of pixels between the previous pixel cluster and the next pixel cluster is less than a first threshold; the valid pixel cluster continuation search unit can be configured to use the next pixel cluster of the current pixel cluster as the current pixel cluster to continue searching for valid pixel clusters; the lane candidate cluster determination unit can be configured to integrate the upper and lower continuous pixel clusters into a lane line candidate cluster after the search is completed; the candidate lane line determination unit can be configured to generate the candidate lane line according to the lane line candidate cluster when the number of pixel clusters of the lane line candidate cluster is greater than a preset number.
[0115] In some embodiments, the previous pixel cluster of the current pixel cluster is a valid pixel cluster; wherein the lane line detection device further includes: a stop search unit and an upward search unit.
[0116] Among them, the stop search unit can be configured to stop searching for a valid pixel cluster for the next pixel cluster of the current pixel cluster if the difference in the number of pixels between the previous pixel cluster of the current pixel and the next pixel cluster is greater than or equal to a first threshold; the upward search unit can be configured to take the previous pixel cluster of the current pixel cluster as the current pixel cluster and continue to search for valid pixel clusters upward.
[0117] In some embodiments, the target lane line module 1305 may include: a condition judgment submodule and a target lane line determination submodule.
[0118] Among them, the condition judgment submodule can be configured to determine that the lane line width of the candidate lane line satisfies the first condition, the lane line shape of the candidate lane line satisfies the second condition, and the left edge curve corresponding to the left edge fitting equation is parallel to the right edge curve corresponding to the right edge fitting equation according to the left edge fitting equation; the target lane line determination submodule can be configured to determine that the candidate lane line is the target lane line.
[0119] In some embodiments, the condition judgment submodule may include: a width judgment unit, a shape judgment unit, and a parallel judgment unit.
[0120] Among them, the width judgment unit can be configured to determine that the lane line width of the candidate lane line satisfies the first condition if the difference between the constant term of the left edge fitting equation and the constant term of the right edge fitting equation is within the second range; the shape judgment unit can be configured to determine that the lane line shape of the candidate lane line satisfies the second condition if the quadratic term coefficient of the left edge fitting equation and the quadratic term coefficient of the right edge fitting equation are both within the third range; the parallel judgment unit can be configured to determine that if the linear term coefficient of the left edge fitting equation and the linear term coefficient of the right edge fitting equation are within the fourth range, and the quadratic term coefficient of the left edge fitting equation and the quadratic term coefficient of the right edge fitting equation are within the fifth range, then the left edge curve corresponding to the left edge fitting equation is parallel to the right edge curve corresponding to the right edge fitting equation.
[0121] In some embodiments, the lane line detection device further includes: a valid pixel number determination module, a histogram statistics unit, and an exit image determination unit.
[0122] Among them, the effective pixel number determination module can be configured to count the number of effective pixel points with the first value in the binary image to be detected by column; the histogram statistics unit can be configured to generate a target histogram based on the number of effective pixel points obtained by column statistics, and the target histogram displays the number of pixel points in each column of the image to be detected with the first value as the pixel value; the exit image determination unit can be configured to consider that the image to be detected is an image collected when the exit road is, if the number of pixel points in the target histogram is greater than a second threshold, and the number of columns with the same number of pixel points with the first value as the pixel value is less than a third threshold.
[0123] Since the various functional modules of the lane line detection device 1300 of the exemplary embodiment of the present disclosure correspond to the steps of the exemplary embodiment of the lane line detection method described above, they will not be described in detail here.
[0124] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software, or by combining software with necessary hardware. Therefore, the technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for a computing device (which can be a personal computer, a server, a mobile terminal, or a smart device, etc.) to execute the method according to the embodiment of the present disclosure, for example Figure 3 One or more of the steps shown.
[0125] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0126] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not applied for by the present disclosure. The specification and embodiments are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0127] It should be understood that the present disclosure is not limited to the detailed structures, drawings or implementations shown herein, but rather the present disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims
1. A lane line detection method, It is characterized in that include: Acquire the image to be detected; Generate a binary image to be detected according to the image to be detected; Generate a target pixel cluster according to pixels whose continuous pixel values in each row of the binary image to be detected are the first value; Determine a candidate lane line in the binary image to be detected according to a target pixel cluster in the image to be detected; Determine a left edge fitting equation and a right edge fitting equation of the candidate lane line; Determine the candidate lane line as a target lane line according to the left edge fitting equation and the right edge fitting equation; Wherein, determining the candidate lane line in the binary image to be detected according to the target pixel cluster in the image to be detected includes: Eliminate the target pixel cluster whose number of pixels is not within the first range to determine the candidate pixel cluster; Determining the candidate lane line in the binary image to be detected according to the candidate pixel cluster; wherein determining the candidate lane line in the binary image to be detected according to the candidate pixel cluster comprises: Determine any one pixel cluster among the candidate pixel clusters as a current pixel cluster; Taking the pixel at the center of the current pixel cluster as the target pixel; Taking the target pixel as a starting point, searching in the upward and downward directions along the column direction to determine the previous pixel cluster where the previous pixel of the target pixel is located and the next pixel cluster where the next pixel of the target pixel is located; If the difference in the number of pixels between the previous pixel cluster and the next pixel cluster is less than a first threshold, determining that the current pixel cluster where the target pixel is located is a valid pixel cluster; Taking the next pixel cluster of the current pixel cluster as the current pixel cluster to continue searching for a valid pixel cluster; When the search is completed, the upper and lower continuous pixel clusters are integrated into lane line candidate clusters; When the number of pixel clusters of the lane line candidate cluster is greater than a preset number, generating the candidate lane line according to the lane line candidate cluster; the method further includes: If the difference in the number of pixels between the previous pixel cluster of the current pixel cluster and the next pixel cluster is greater than or equal to the first threshold, no longer searching for a valid pixel cluster for the next pixel cluster of the current pixel cluster; The previous pixel cluster of the current pixel cluster is used as the current pixel cluster, and the search for valid pixel clusters is continued upward.
2. The method according to claim 1, It is characterized in that Determining the candidate lane line as a target lane line according to the left edge fitting equation and the right edge fitting equation includes: Determine, according to the left edge fitting equation and the right edge fitting equation, that the lane line width of the candidate lane line satisfies a first condition, the lane line shape of the candidate lane line satisfies a second condition, and the left edge curve corresponding to the left edge fitting equation is parallel to the right edge curve corresponding to the right edge fitting equation; Determine the candidate lane line as the target lane line.
3. The method according to claim 2, It is characterized in that The determining, according to the left edge fitting equation and the right edge fitting equation, that the lane line width of the candidate lane line satisfies a first condition, that the lane line shape of the candidate lane line satisfies a second condition, and that the left edge curve corresponding to the left edge fitting equation is parallel to the right edge curve corresponding to the right edge fitting equation comprises: If the difference between the constant term of the left edge fitting equation and the constant term of the right edge fitting equation is within a second range, determining that the lane line width of the candidate lane line satisfies the first condition; If the quadratic term coefficient of the left edge fitting equation and the quadratic term coefficient of the right edge fitting equation are both within a third range, determining that the lane line shape of the candidate lane line satisfies the second condition; If the linear coefficient of the left edge fitting equation and the linear coefficient of the right edge fitting equation are within the fourth range, and the quadratic coefficient of the left edge fitting equation and the quadratic coefficient of the right edge fitting equation are within the fifth range, then the left edge curve corresponding to the left edge fitting equation is parallel to the right edge curve corresponding to the right edge fitting equation.
4. The method according to claim 1, It is characterized in that Before generating a target pixel cluster according to pixels whose continuous pixel values in each row in the binary image to be detected are the first value, the method further comprises: Counting the number of valid pixel points whose pixel values are the first value in the binary image to be detected by column; Generate a target histogram according to the number of valid pixels obtained by column statistics, wherein the target histogram displays the number of pixels whose pixel value in each column of the image to be detected is the first value; If the number of pixels in the target histogram is greater than the second threshold, and the number of columns with the same number of pixels having the first value is less than the third threshold, it is considered that the image to be detected is an image collected at the exit.
5. A lane line detection device, It is characterized in that include: An image acquisition module to be detected, configured to acquire an image to be detected; A binary image acquisition module to be detected, configured to generate a binary image to be detected according to the image to be detected; A target pixel cluster determination module, configured to generate a target pixel cluster according to pixels whose continuous pixel values in each row in the binary image to be detected are the first value; A candidate lane line determination module is configured to determine a candidate lane line in the binary image to be detected according to a target pixel cluster in the image to be detected; an equation fitting module, configured to determine a left edge fitting equation and a right edge fitting equation of the candidate lane line; A target lane line module, configured to determine the candidate lane line as a target lane line according to the left edge fitting equation and the right edge fitting equation; The candidate lane line determination module includes: a rejection submodule and a candidate lane line determination submodule; wherein, The elimination submodule is configured to eliminate the target pixel clusters whose number of pixels is not within the first range to determine the candidate pixel clusters; The candidate lane line determination submodule is configured to determine the candidate lane line in the binary image to be detected according to the candidate pixel cluster; The candidate lane line determination submodule includes: a current pixel cluster determination unit, a target pixel determination unit, a search unit, a valid pixel cluster determination unit, a valid pixel cluster continued search unit, a lane candidate cluster determination unit and a candidate lane line determination unit; wherein, The current pixel cluster determining unit is configured to determine any one pixel cluster among the candidate pixel clusters as the current pixel cluster; The target pixel determination unit is configured to take the pixel at the center of the current pixel cluster as the target pixel; The search unit is configured to search in two directions, upward and downward, in a column direction starting from the target pixel, so as to determine a previous pixel cluster where a previous pixel of the target pixel is located and a next pixel cluster where a next pixel of the target pixel is located; The valid pixel cluster determining unit is configured to determine that the current pixel cluster where the target pixel is located is a valid pixel cluster if the difference in the number of pixels between the previous pixel cluster and the next pixel cluster is less than a first threshold; The valid pixel cluster continuing searching unit is configured to use the next pixel cluster of the current pixel cluster as the current pixel cluster to continue searching for valid pixel clusters; The lane candidate cluster determination unit is configured to integrate upper and lower continuous pixel clusters into a lane line candidate cluster after the search is completed; The candidate lane line determination unit is configured to generate the candidate lane line according to the lane line candidate cluster when the number of pixel clusters in the lane line candidate cluster is greater than a preset number; The lane line detection device further includes: a stop search unit and an upward search unit; wherein, The stop searching unit is configured to stop searching for a valid pixel cluster for the next pixel cluster of the current pixel cluster if the difference in the number of pixels between the previous pixel cluster of the current pixel cluster and the next pixel cluster is greater than or equal to the first threshold; The upward search unit is configured to use the previous pixel cluster of the current pixel cluster as the current pixel cluster, and continue to search for valid pixel clusters upward; The target lane line module includes: a condition judgment submodule and a target lane line determination submodule; wherein, The condition judgment submodule is configured to determine, according to the left edge fitting equation and the right edge fitting equation, that the lane line width of the candidate lane line satisfies a first condition, the lane line shape of the candidate lane line satisfies a second condition, and the left edge curve corresponding to the left edge fitting equation is parallel to the right edge curve corresponding to the right edge fitting equation; The target lane line determination submodule is configured to determine the candidate lane line as the target lane line.
6. An electronic device, It is characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.
7. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Method and device for detecting lane line
CN105260713A
Road marking line extracting method based on forward camera head in automatic driving
CN105718870A
A method and apparatus for detecting lane lines
CN109034047A
Lane line detection method and device and vehicle-mounted device
CN109977776A
Lane line detection method, lane line detection device and computer storage medium
CN110084095A
