A method for extracting centerline of line structured light based on bright channel exposure adaptation
Through the bright channel exposure adaptive method, the problem of difficulty in extracting the centerline of the laser stripe in industrial environments is solved, and high-precision three-dimensional measurement under complex conditions is achieved, which improves the speed and robustness of the measurement.
Patent Information
- Application Number
- CN202411076941.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2024-11-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In industrial environments, linear structure light measurement technology faces noise and unstable light source conditions, which leads to difficulty in extracting the centerline of the laser stripe, affecting measurement accuracy and speed.
Using a method based on bright channel exposure adaptation, by acquiring the bright channel information of the image, adaptive grayscale conversion and background noise denoising, optimizing the low-exposure image, extracting the laser center line, and generating a three-dimensional point cloud based on the system calibration information.
Effectively extract the laser stripe centerline under complex conditions, reduce noise, improve the accuracy and speed of three-dimensional measurements, and meet the robustness requirements of the industrial environment.
Smart Images

Figure CN118608592B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method for extracting center lines of line structured light based on bright channel exposure adaptation. Background Art
[0002] As a typical non-contact measurement method, line structured light measurement technology has the advantages of fast speed, high precision and high flexibility. It has been widely used in many industrial fields such as rail section detection, surface modeling, and dimensional accuracy measurement. The laser measurement technology system emits a laser beam by line structured light. The laser beam generates laser stripes on the surface of the object being measured. The camera captures the original image of the laser stripe and extracts the center line of the laser stripe. The height information is calculated based on the center line and the calibrated position. Therefore, accurate extraction of the center line of the laser stripe is crucial for laser measurement technology. Its speed, precision and robustness directly affect the overall performance of the system.
[0003] Under ideal working conditions, such as a stable environment, moderate laser light source intensity, a flat surface of the object to be measured, and weak background reflection, it is easy to extract the center of the laser stripe and ensure speed, accuracy, and robustness. However, in an industrial environment, it is often impossible to meet absolute ideal conditions. Changes in these conditions will bring noise to the image, which poses a considerable challenge to the accurate extraction of the laser line. Unsatisfactory images obtained due to external reasons are often sudden and uncontrollable. When faced with strong reflective materials, sudden changes in background brightness, complex shapes of the measured objects, and scanning at the edges and corners of the measured objects, laser stripes with large noise or overall darker or even incomplete laser stripes will be generated. In order to eliminate this effect, the simplest and most effective way is to change the brightness of the laser or adjust the exposure of the camera. However, a large number of images will be generated during the measurement process, and it is impossible to make adjustments for each frame of the image. Only a parameter that satisfies most of the images can be set. In this case, the "sacrificed" part of the image will have the problem of too high or too low exposure (brightness), making it impossible to accurately extract the center line of the laser stripe. Therefore, it is necessary to design a widely applicable laser line extraction method for this application requirement, so as to obtain a more accurate three-dimensional reconstruction model. Summary of the invention
[0004] In view of the above defects or improvement needs of the prior art, the present invention provides a line structured light center line extraction method based on bright channel exposure adaptation, which can adaptively convert grayscale and accurately extract the laser center line under complex and changing conditions.
[0005] According to a first aspect of the present invention, a method for extracting center lines of line structured light based on bright channel exposure adaptation is provided, the method comprising:
[0006] S1, obtaining an image to be processed, performing data processing on the image, and obtaining the pixel value ratio of each color channel and bright channel information of the image;
[0007] S2, judging the image exposure or brightness by a formula according to the obtained bright channel information;
[0008] S3, selecting different calculation methods according to the exposure level, and obtaining the adaptive grayscale image conversion weight from the pixel value ratio and bright channel information of the image;
[0009] S4, calculating the image background denoising threshold according to the adaptive grayscale conversion weight;
[0010] S5, performing threshold denoising using the image background denoising threshold, and denoising the image using a connected area statistical denoising method;
[0011] S6, optimizing the low-exposure image, inverting the image, and then filling the central hole of the low-exposure image;
[0012] S7, obtaining the ROI area according to the denoised image and extracting the laser center line;
[0013] S8. Finally, the three-dimensional coordinate information of the point cloud can be calculated according to the system calibration information and the center line to generate the point cloud.
[0014] Furthermore, the method for performing data processing in step S1 is specifically as follows:
[0015] First, for a The pixel value ratio of the image is obtained according to the pixel value and color channel information:
[0016]
[0017] in They are The pixel value ratio of the three channels, For this image The sum of the pixel values of the three channels.
[0018] Secondly, find the number of bright channels for each pixel in the image as follows:
[0019] Let the channel with the largest value among the three channels in each pixel grid be the lit channel:
[0020]
[0021] And count them into the corresponding set to get the number of bright channels of the image:
[0022]
[0023] in, For point The bright channel value of Points exist Pixel values of three channels; are the number of bright channels of each color channel of the image, card ( ) indicates the number of elements in the set. Represents the midpoint of the original image The pixel value of is the threshold for removing darker pixels outside the laser line.
[0024] Furthermore, the specific method of step S2 is:
[0025] According to the number of bright channels obtained, the following formula is established to determine the exposure level of the image:
[0026]
[0027] in It indicates the line width of the laser when it hits the zero plane. When the image is high-exposure (brightness) image, it is considered to be a low-exposure (brightness) image.
[0028] Furthermore, the specific method of step S3 is:
[0029] The traditional grayscale conversion weights are obtained by the traditional grayscale image conversion method:
[0030]
[0031]
[0032] If the image is a high exposure (brightness) image, the grayscale image conversion weight is obtained by the following method:
[0033] First, the pixel value ratio is changed as follows:
[0034]
[0035] Normalization:
[0036]
[0037] Will Arrange in ascending order into a new matrix , the final conversion weight of the high exposure (brightness) image is obtained as follows:
[0038]
[0039] If the image is a low exposure (brightness) image, the grayscale image conversion weight is obtained by the following method:
[0040] The following formula normalizes the pixel value ratio:
[0041]
[0042] Will Arrange in descending order into a new matrix , the final conversion weight of the low exposure (brightness) image is obtained as follows:
[0043]
[0044] After obtaining the grayscale image conversion weight according to the image exposure (brightness), the grayscale image is obtained from the conversion weight.
[0045] Furthermore, the specific method of step S4 is:
[0046] Calculate the background denoising threshold based on the obtained weight:
[0047]
[0048] Furthermore, the specific method of step S5 is:
[0049] The image is subjected to background denoising using the obtained background denoising threshold, and then other noises are removed using the area statistical filtering method.
[0050] Furthermore, the specific method of step S6 is:
[0051] Preserve edges for non-zero parts of low-exposure (brightness) images The pixels remain unchanged, and the rest of the non-zero parts of the image are inverted:
[0052]
[0053] Fill the hole in the middle of the image:
[0054]
[0055] in, Indicates that low exposure images are The pixel value at the coordinate, Represents the inverted pixel value. Indicates Row (column), with coordinates Centered at A one-dimensional window of satisfy .
[0056] Furthermore, the specific method of step S7 is:
[0057] In size Do the following in the picture:
[0058] Step 1: Get the Row data;
[0059] Step 2: Judgement Is it 0 or Whether the row is empty. If so, perform an initial search to obtain the ROI area, otherwise, perform an extended search to obtain the ROI area;
[0060] Initialize the search: Take the first non-zero point in the row as the ROI Search from the starting point of the area to the right, and stop searching when the end condition is reached. The area within the search range is the row. ROI area.
[0061] Expand your search: Centerline position of the row Determine OK ROI Area search starting point for , search in the positive and negative directions through this point respectively, and stop searching when the end condition is reached. The search range is the final value of the row. ROI area.
[0062] Step 3: ROI Backward difference calculation is performed on the points in the area:
[0063]
[0064] in is the difference window size, for The pixel value at coordinates.
[0065] The maximum value of the backward difference is obtained where the gray value of the row changes the most. and minimum value After obtaining the coordinates of the two extreme values, the average of the maximum and minimum values is used as the center line position of the row. .
[0066] Step 4: Determine the Is the line the last line? If not, set , and return to Step 1. If yes, it means the center line of the image has been obtained.
[0067] Furthermore, the specific method of step S8 is:
[0068] The line structured light reference position and laser angle are determined according to the calibrated camera parameters and line structured light plane parameters. The height information corresponding to each point is calculated according to the offset distance between the obtained center line coordinates and the reference position. The image coordinate information obtained in real time during image acquisition is combined with the height information to obtain the three-dimensional information of each point.
[0069] According to a second aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the line structured light centerline extraction method based on bright channel exposure adaptation described in any one of the above are implemented.
[0070] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects compared with the prior art:
[0071] The present invention can effectively highlight the center part of the laser stripe and weaken the noise part under complex and changeable conditions, so that the grayscale image is more consistent with the Gaussian distribution, and thus can extract the center line of the laser stripe faster while ensuring accuracy, and can meet the special requirements of three-dimensional measurement and three-dimensional reconstruction for accuracy, speed and robustness in complex and changeable industrial environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] Figure 1 It is a flow chart of a method for extracting center line of line structured light based on bright channel exposure adaptation according to an embodiment of the present invention;
[0073] Figure 2 is the original image of the laser stripes in the embodiment of the present invention; wherein, Figure 2 (a) in the figure is the original high exposure (brightness) image. Figure 2 (b) in the figure is the original low-exposure (brightness) image;
[0074] Figure 3 is a grayscale image of laser stripes according to an embodiment of the present invention; wherein, Figure 3 (a) in the figure is a high exposure (brightness) grayscale image. Figure 3 (b) in the figure is a low exposure (brightness) grayscale image;
[0075] Figure 4 is a denoised grayscale image according to an embodiment of the present invention; wherein, Figure 4 (a) in the figure is the grayscale image after high exposure (brightness) denoising. Figure 4 (b) in the figure is the grayscale image after low exposure (brightness) denoising;
[0076] Figure 5 A grayscale image after low exposure (brightness) optimization according to an embodiment of the present invention;
[0077] Figure 6 A flowchart of searching the ROI area and extracting the laser center line according to an embodiment of the present invention;
[0078] Figure 7 A schematic diagram of a ROI region search method according to an embodiment of the present invention;
[0079] Figure 8 A schematic diagram of a laser centerline extraction method according to an embodiment of the present invention;
[0080] Fig. 9 This is a result diagram of the laser centerline extraction according to an embodiment of the present invention; wherein, Fig. 9 (a) is the result of laser centerline extraction of high exposure (brightness) image. Fig. 9 (b) is the result of laser centerline extraction of low exposure (brightness) image;
[0081] Fig.10 A three-dimensional point cloud image of a workpiece under test according to an embodiment of the present invention;
[0082] Fig.11 A schematic diagram of the structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0083] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0084] The present invention discloses a method for extracting the center line of a line structured light based on adaptive exposure of a bright channel, comprising the following steps: obtaining the pixel value ratio and bright channel information of the current frame image; judging the exposure or brightness of the image according to the obtained bright channel information; obtaining an adaptive grayscale image conversion weight according to the exposure level and the pixel value ratio and bright channel information of the image; obtaining the image background denoising threshold according to the adaptive grayscale conversion weight; image denoising; optimizing the low-exposure image by taking the inverse and filling the central hole; obtaining the ROI area and extracting the laser center line; finally calculating the three-dimensional information of the point cloud according to the center line and calibration information and generating the point cloud. The present invention can adaptively convert grayscale and accurately extract the laser center line under complex conditions such as complex shapes of the measured object, different reflectivities of different parts of the measured object, sudden changes in laser intensity, etc., establish an accurate three-dimensional model, and then select any position in the three-dimensional point cloud window to obtain the surface contour information and height difference information of the point cloud in different directions.
[0085] Embodiment 1
[0086] The method for extracting the center line of the line structured light based on bright channel exposure adaptation in the embodiment of the present invention is as follows: Figure 1As shown, the specific calculation process is as follows:
[0087] S1. Take the current frame image. Since the algorithm has different processing methods for images with different exposure (brightness), a high exposure (brightness) image and a low exposure image are selected respectively, such as Figure 2 As shown in (a) and (b), the sizes of both images are 816*2048.
[0088] First, for a The pixel value ratio of the image is obtained according to the pixel value and color channel information:
[0089] in They are The pixel value ratio of the three channels, For this image The sum of the pixel values of the three channels.
[0090] Secondly, find the number of bright channels for each pixel in the image as follows:
[0091] Let the channel with the largest value among the three channels in each pixel grid be the lit channel:
[0092]
[0093] And count them into the corresponding set to get the number of bright channels of the image:
[0094] In the formula, For point The bright channel value of Points exist Pixel values of three channels; are the number of bright channels of each color channel of the image, card ( ) indicates the number of elements in the set. Represents the midpoint of the original image The pixel value of is the threshold for removing darker pixels outside the laser line.
[0095] S2. According to the number of bright channels obtained, the following formula is used to determine the exposure level of the image:
[0096] in It indicates the line width of the laser when it hits the zero plane. When the image is high-exposure (brightness) image, it is considered to be a low-exposure (brightness) image.
[0097] Select here Pixel.
[0098] If the formula is established, the image is considered to be a high-exposure (brightness) image, otherwise it is a low-exposure (brightness) image.
[0099] S3. Obtain the traditional grayscale conversion weight through the traditional grayscale image conversion method:
[0100] If the image is a high exposure (brightness) image, the grayscale image conversion weight is obtained by the following method:
[0101] The following formula changes the pixel value ratio:
[0102] Normalization:
[0103] Will Arrange in ascending order into a new matrix , the final conversion weight of the high exposure (brightness) image is obtained as follows:
[0104] The final conversion weight of the high exposure (brightness) image is obtained as follows:
[0105] If the image is a low exposure (brightness) image, the grayscale image conversion weight is obtained in the following way.
[0106] The following formula normalizes the pixel value ratio:
[0107] Will Arrange in descending order into a new matrix , the final conversion weight of the low exposure (brightness) image is obtained as follows:
[0108] Weighted calculation:
[0109] After obtaining the grayscale image conversion weight according to the image exposure (brightness), the grayscale image is obtained by the conversion weight, such as Figure 3 As shown in (a) and (b) in .
[0110] S4. Calculate the background denoising threshold.
[0111] Calculate the background denoising threshold based on the obtained weight:
[0112] The threshold of the high-exposure image is used to perform background denoising on the high-exposure image, and the threshold of the low-exposure image is used to perform background denoising on the low-exposure image.
[0113] S5. Image denoising.
[0114] The image is subjected to background denoising using the background denoising threshold, and then other noises are removed using the area statistical filtering method, such as Figure 4 The area filtering method is to divide the connected area by the eight-connected method, and then set the denoising threshold according to the area of the connected area to remove the connected area with an area below the threshold.
[0115] S6. Optimize low exposure images.
[0116] Preserve edges for non-zero parts of low-exposure (brightness) images The pixels remain unchanged, and the rest of the non-zero parts of the image are inverted:
[0117] Select here .
[0118] Fill the hole in the middle of the image:
[0119] in, Indicates that low exposure images are The pixel value at the coordinate, Represents the inverted pixel value. Indicates Row (column), with coordinates Centered at A one-dimensional window of satisfy . W The one-dimensional window is perpendicular to the laser line.
[0120] Select here The optimized image is as follows Figure 5 shown.
[0121] The hole in the middle is caused by the discontinuity of the laser line due to low exposure when the laser hits the object, resulting in low pixel values in some places.
[0122] S7. Acquisition ROI area and extract the laser centerline.
[0123] In size Do the following operations in the picture, the flow chart is as follows Figure 6 As shown:
[0124] Step 1: Get the Row data;
[0125] Step 2: Judgement Is it 0 or Is the row empty? If so, the initialization search method is executed to obtain the ROI area. Otherwise, the expansion search method is executed to obtain the ROI area, such as Figure 7 As shown;
[0126] Initialize the search: start the search from the first non-zero point of the row as the starting point of the ROI area of the row and search to the right. When the end condition is reached, stop the search. The area within the search range is the ROI area of the row.
[0127] Expand your search: Centerline position of the row Determine The starting point of the ROI area search for , search in the positive and negative directions through this point respectively, and stop searching when the end condition is reached. The search range is the final value of the row. ROI area.
[0128] The cut-off conditions are selected as follows:
[0129] The pixel values of 5 consecutive points satisfy .
[0130] Step 3: ROI Backward difference calculation is performed on the points in the area:
[0131] in is the difference window size, for The pixel value at the coordinate. .
[0132] The maximum value of the backward difference is obtained where the gray value of the row changes the most. and minimum value After obtaining the coordinates of the two extreme values, the average of the maximum and minimum values is used as the center line position of the row. ,like Figure 8 shown.
[0133] Step 4: Determine the Is the line the last line? If not, set , and return to Step 1. If yes, it means that the center line of the image has been obtained, such as Fig. 9 As shown in (a) and (b) in .
[0134] Embodiment 2
[0135] The present invention also provides a three-dimensional measurement method for complex workpiece surfaces based on line structured light scanning, such as Figure 1 As shown, the following steps are included:
[0136] S1, obtaining an image to be processed, performing data processing on the image, and obtaining the pixel value ratio of each color channel and bright channel information of the image;
[0137] S2, judging the image exposure or brightness by a formula according to the obtained bright channel information;
[0138] S3, selecting different calculation methods according to the exposure level, and obtaining the adaptive grayscale image conversion weight from the pixel value ratio and bright channel information of the image;
[0139] S4, calculating the image background denoising threshold according to the adaptive grayscale conversion weight;
[0140] S5, performing threshold denoising using the image background denoising threshold, and denoising the image using a connected area statistical denoising method;
[0141] S6, optimizing the low-exposure image, inverting the image, and then filling the central hole of the low-exposure image;
[0142] S7, obtaining the ROI area according to the denoised image and extracting the laser center line;
[0143] S8. Finally, the three-dimensional coordinate information of the point cloud can be calculated according to the system calibration information and the center line to generate the point cloud.
[0144] The specific method of step S8 is as follows:
[0145] The line structured light reference position and laser angle are determined according to the calibrated camera parameters and line structured light plane parameters. The height information corresponding to each point is calculated according to the offset distance between the obtained center line coordinates and the reference position. The image coordinate information obtained in real time during image acquisition is combined with the height information to obtain the three-dimensional information of each point. The surface contour information of the object being measured is obtained using projection filtering, such as Fig.10 As shown, by selecting any position in the 3D point cloud window, the surface contour information and height information of the point cloud in different directions can be obtained.
[0146] Embodiment 3
[0147] like Fig.11 The figure is a schematic diagram of the structure of a computer device provided by an embodiment of the present invention, such as a smart phone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including an independent server, or a server cluster composed of multiple servers) that can execute programs. The computer device 20 of this embodiment includes at least but is not limited to: a memory 21 and a processor 22 that can communicate with each other via a system bus, such as Fig.11 It should be pointed out that Fig.11Only computer device 20 is shown with components 21 - 22 , but it should be understood that implementing all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0148] In this embodiment, the memory 21 (i.e., readable storage medium) includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM). The memory 21 may also be an external storage device of the computer device 20, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 20. Of course, the memory 21 may also include both the internal storage unit of the computer device 20 and its external storage device. In this embodiment, the memory 21 is generally used to store the operating system and various application software installed on the computer device 20, such as the program code of the line structure light center line extraction method based on bright channel exposure adaptation in the method embodiment. In addition, the memory 21 may also be used to temporarily store various data that have been output or are to be output.
[0149] In some embodiments, the processor 22 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 22 is generally used to control the overall operation of the computer device 20. In this embodiment, the processor 22 is used to run the program code stored in the memory 21 or process data, for example, to run a device storing the program code of the line structured light center line extraction method based on bright channel exposure adaptation, so as to implement the line structured light center line extraction method based on bright channel exposure adaptation in the method embodiment.
[0150] Embodiment 4
[0151] The present application also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, and the program realizes corresponding functions when executed by a processor. The computer-readable storage medium of this embodiment is used to store the program code of the line structured light center line extraction method based on bright channel exposure adaptation, and when executed by the processor, the line structured light center line extraction method based on bright channel exposure adaptation of the method embodiment is realized.
[0152] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0153] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0154] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0155] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0156] In summary, the present invention proposes a line structured light centerline extraction method based on bright channel exposure adaptation, which can adaptively convert grayscale and accurately extract the laser centerline under complex conditions such as complex shape of the measured object, different reflectivity of different parts of the measured object, sudden change of laser intensity, etc., establish an accurate three-dimensional model, and obtain surface contour information and height difference information in different directions of the point cloud by selecting any position in the three-dimensional point cloud window.
[0157] It should be noted that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0158] It should be pointed out that, according to the needs of implementation, the various steps / components described in this application can be split into more steps / components, and two or more steps / components or partial operations of steps / components can be combined into new steps / components to achieve the purpose of the present invention.
[0159] It will be easily understood by those skilled in the art that the above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for extracting the center line of line structured light based on bright channel exposure adaptation. It is characterized in that The method includes: Obtaining the original image of the laser stripes, and obtaining the pixel value ratio of each color channel and the number of bright channels of the image according to the color channels and pixel values of the image; Determining an image exposure type according to the number of bright channels of each color channel of the image; wherein the image exposure type includes a high-exposure image and a low-exposure image; According to the image exposure type, the adaptive grayscale image conversion weight is obtained by combining the pixel value ratio of each color channel and the number of bright channels of the image, and then converted into a grayscale image; Calculate the image background denoising threshold according to the adaptive grayscale image conversion weight, and perform background denoising; If the image is a low-exposure image, optimize the low-exposure image, invert the middle part of the image and fill the holes; Finally, the ROI area is obtained and the center line is extracted.
2. According to the method for extracting center line of line structured light based on bright channel exposure adaptation in claim 1, It is characterized in that According to the color channels and pixel values of the image, the pixel value ratio of each color channel and the bright channel information of the image are obtained, including: The original laser stripe image is converted into an RGB image, and the pixel value ratio of each color channel of the image is calculated according to the following formula: In the formula, The images are The pixel value ratio of the three channels, For this image The sum of the pixel values of the three channels; Let the channel with the largest value among the three channels in each pixel grid be the lit channel: In the formula, For point The bright channel value of Points exist Pixel values of three channels; Count into the corresponding set and get the number of bright channels for each color channel of the image: In the formula, are the number of bright channels of each color channel of the image, card ( ) indicates the number of elements in the set. Represents the midpoint of the original image The pixel value of is the threshold for removing darker pixels outside the laser line.
3. The method for extracting centerline of structured light based on bright channel exposure adaptation according to claim 2, It is characterized in that The image exposure type is determined based on the number of bright channels of each color channel of the image, including: The following formula is used to determine the exposure of the image: In the formula, Indicates the exposure of the image. It indicates the line width of the laser hitting the zero plane under standard conditions; like , then the image is a high-exposure image, otherwise it is a low-exposure image.
4. The method for extracting centerline of structured light based on bright channel exposure adaptation according to claim 2, It is characterized in that According to the image exposure type, the adaptive grayscale image conversion weight is obtained by combining the pixel value ratio of each color channel and the number of bright channels of the image, including: Get the traditional grayscale conversion weight ; If the image is a high-exposure image, the adaptive grayscale image conversion weight calculation method is as follows: Change the pixel value ratio by the following formula: In the formula, are the ratios of pixel values after the change respectively; Normalization: In the formula, are the normalized pixel value ratios; Convert traditional grayscale to weight Arrange in ascending order into a new matrix , the adaptive grayscale image conversion weight of the high exposure image is obtained by the following formula: If the image is a low-exposure image, the adaptive grayscale image conversion weight calculation method is as follows: Normalize the pixel value ratio directly: In the formula, Respectively represent the pixel value ratio after direct normalization; Convert traditional grayscale to weight Arrange in descending order into a new matrix , the adaptive grayscale image conversion weight of the low exposure image is obtained by the following formula: In the formula, They represent the adaptive grayscale image conversion weights respectively.
5. According to claim 4, the method for extracting center line of line structured light based on bright channel exposure adaptation, It is characterized in that The image background denoising threshold is calculated based on the adaptive grayscale image conversion weight, including: In the formula, is the image background denoising threshold.
6. The method for extracting center line of line structured light based on bright channel exposure adaptation according to claim 1, It is characterized in that The method further includes: After background denoising, the image is denoised using the connected area statistics denoising method.
7. The method for extracting centerline of line structured light based on bright channel exposure adaptation according to claim 1, It is characterized in that The method to optimize low exposure images is: Preserve edges for non-zero parts of low-exposure images The pixels remain unchanged, and the rest of the non-zero parts of the image are inverted: Then fill the hole in the middle of the image: in, Indicates that low exposure images are The pixel value at the coordinate, Represents the inverted pixel value. Indicates perpendicular to the laser line, and with coordinates Centered at A one-dimensional window, satisfy , Indicates the padding value.
8. The method for extracting center line of structured light based on bright channel exposure adaptation according to claim 1, It is characterized in that Get the ROI area and extract the center line, including: Step 1: Get the Row data; Step 2: Judgement Is it 0 or Whether the row is empty; if so, execute the initialization search method to obtain the ROI area, otherwise execute the expansion search method to obtain the ROI area; The initialization search method is: start from the first non-zero point of the row as the search starting point of the ROI area of the row and search to the right. When the search reaches the end condition, stop the search. The area within the search range is the ROI area of the row. The expanded search method is: Centerline position of the row Determine The starting point of the ROI area search for , search in the positive and negative directions through this point respectively, and stop searching when the cutoff condition is reached. The search range is the final ROI area of the row; Step 3: Perform backward difference calculation on the points in the ROI area: in, for The difference value at the coordinate, is the difference window size, for Pixel value at coordinates; The maximum value of the backward difference is obtained where the gray value of the row changes the most. and minimum value After obtaining the coordinates of the two extreme values, the average of the maximum and minimum values is used as the center line position of the row. ; Step 4: Determine the Is the line the last line? If not, set , and return to Step 1; if yes, it means that the center line of the image has been obtained.
9. The method for extracting centerline of structured light based on bright channel exposure adaptation according to claim 1, It is characterized in that The method further includes: The three-dimensional coordinate information of the point cloud is calculated based on the system calibration information and the center line to generate the point cloud of the workpiece to be measured.
10. A computer-readable storage medium, It is characterized in that A computer program is stored thereon, and when the computer program is executed by a processor, the steps of the method for extracting the center line of line structured light based on bright channel exposure adaptation described in any one of claims 1 to 9 are implemented.
