A laser projector production line light adjustment and focusing detection method and system
By combining Gaussian blur filtering and Canny edge detection, along with Otsu binarization and Gaussian curve fitting, the problem of accurately identifying the light spot boundary and grid line width was solved, improving the efficiency and yield of the dimming and focusing process and reducing labor costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HRG INT INST FOR RES & INNOVATION
- Filing Date
- 2022-09-06
- Publication Date
- 2026-06-02
AI Technical Summary
In existing technologies, it is difficult to accurately identify the light spot boundary and quantize the grid line width, resulting in low efficiency, low yield, and high labor costs in the dimming and focusing process.
Image preprocessing is performed by combining Gaussian blur filtering and Canny edge detection. The light spot boundary is identified by ellipse fitting, and the grid line width is quantized by Otsu binarization. Combined with Gaussian curve fitting and adaptive thresholding, accurate identification of light spots and grids is achieved.
It improves the efficiency and yield of the dimming and focusing process, saves labor costs, and enhances production efficiency and economic benefits.
Smart Images

Figure CN115424008B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of laser projectors and machine vision, and specifically to a method and system for dimming and focusing detection in a laser projector production line. Background Technology
[0002] In April 2022, IDC released its "China Projector Market Tracker Report, Q4 2021". The report showed that the Chinese projector market grew by 12.6% year-on-year in 2021, with total shipments reaching 4.7 million units. Sales revenue also exceeded RMB 21.4 billion, a year-on-year increase of 15.5%. IDC also predicted that projector sales in China would exceed 5.6 million units in 2022, with smart projectors becoming a strong competitor to traditional TVs, and reaching a total of 7 million units by 2023.
[0003] Research indicates that existing laser projector production lines heavily rely on manual labor for processes such as beam adjustment and focus adjustment. Each worker needs to work continuously for 10 hours a day, leading to a high rate of misjudgments due to visual fatigue and other factors. For example, data from one factory shows that the beam adjustment process has an average yield of only 85%, while the focusing process has an average yield of 90%. The beam adjustment environment is a fixed scene with minimal light interference. The process involves first adjusting the beam size. Since a standard circle is used as a reference in the background image, the beam size should be as close to the standard circle as possible during adjustment, allowing for a certain margin of error. For example, one factory's production line requires a beam size of 140±5mm. Furthermore, in addition to meeting the beam size requirement, the edges of the beam image must be clear. However, due to workers' long working hours (up to 10 hours a day), visual fatigue and other factors frequently result in quality problems such as unqualified beam size and unclear beam edges.
[0004] The focusing environment is set to low light, with the background relatively dark except for the projected grid, which is bright. The process involves adjusting the focus to make the grid projection clear and the grid lines as thin as possible. However, due to the lack of a unified standard, quantitative reference indicators cannot be provided in real time during the debugging process. Therefore, the product quality varies between different operators. Furthermore, factory management faces challenges such as difficulty in recruiting and training workers, managing employee leave and departures, and increasing labor costs. Therefore, it is necessary to automate key positions as soon as possible to improve the overall automation level of the production line.
[0005] The existing invention patent application document CN108803209A, entitled "A Laser Controlled Projector System and Control Method, Information Processing Terminal," describes a laser controlled projector system comprising: a light source module, a parameter configuration module, a central control module, a collimation processing module, a homogenization processing module, a focusing processing module, an image correction module, and a projection module. From the embodiments of this prior art, it can be seen that the prior art adjusts the pixel laser emission angle, and based on the relationship between the driving current value of the projection device, the light source brightness value, and the target color temperature value, it can only solve the problem of image pixel distortion. However, from the specific implementation logic of this prior art, it is clear that this prior art still cannot solve the defect of difficult-to-accurately identify the light spot boundary. This prior art only adjusts the color temperature and laser emission angle, and cannot quantify the grid width.
[0006] The existing invention patent application document CN114487115A, entitled "A High-Resolution Non-Destructive Testing Method for Defects Based on the Combination of Canny Operator and Ultrasonic Plane Wave Imaging," includes the following steps: Step 1: Emitting a plane wave to the workpiece under test using ultrasonic coherence and receiving echo data after filtering out random noise in the signal; Step 2: Performing full-focus imaging on the echo data from Step 1 using the DMAS algorithm; Step 3: Performing edge detection on the image obtained from the full-focus imaging in Step 2 using the Canny operator; Step 4: Based on the defect edge detection in Step 3, performing fine scanning on the obtained defects using a point-by-point focusing method. Although this prior art uses the Canny operator to detect defect edges, it is applied to ultrasonic planar imaging. From the specific implementation logic of this prior art, it can be seen that although the prior art establishes and uses the imaging plane grid center matrix according to parameters such as the number and direction of grid division, this prior art is mainly for the detection of damage location and edges in ultrasonic planar imaging, and cannot be directly used to solve the problems of difficult spot boundary identification and grid quantization in laser imaging. Meanwhile, before applying the Canny operator to detect the edges of defective images, the existing technology requires the use of the DMAS algorithm for full-focus imaging. It cannot directly process the pre-processed and filtered images with the Canny operator, and its pre-processing process is relatively complicated, which reduces the robustness of the algorithm implemented by the existing solution and is also limited in terms of operational efficiency.
[0007] In summary, existing technologies have technical challenges such as difficulty in accurately identifying light spot boundaries and difficulty in quantifying grid line widths. This technology improves the efficiency and yield of the dimming and focusing process, saves labor costs, and brings economic benefits to customers. Summary of the Invention
[0008] This invention solves the technical problems of difficult spot boundary identification and grid line width quantification in the prior art, improves the efficiency and yield of dimming and focusing process, saves labor costs, and brings economic benefits to customers.
[0009] This invention solves the above-mentioned technical problems by employing the following technical solution: A method for dimming and focusing detection in a laser projector production line includes:
[0010] Methods for adjusting the light spot include:
[0011] S1. The original image is filtered using the Gaussian blur filtering method, and the image edge contour is obtained using the Canny edge detection method. Based on this, contour discovery and ellipse fitting operations are performed to detect and obtain the standard circle contour. The first minimum bounding rectangle is fitted according to the standard circle contour, and the original image is cropped according to the first rectangle parameter of the first minimum bounding rectangle to obtain the first region of interest, thereby completing the image preprocessing.
[0012] S2. The first region of interest is filtered using the edge protection filtering method. Based on this, the adaptive threshold is found using the Gaussian curve fitting method. Based on this, the light spot boundary is found. The image edge contour is then obtained using the Canny edge detection method. Based on this, contour discovery and ellipse fitting operations are performed to obtain the light spot ellipse fitting parameters. Based on this, light spot recognition is performed to obtain the light spot recognition result.
[0013] S3. Calculate the ratio of the area of the fitted ellipse of the identified spot to the area of the fitted ellipse of the standard circle based on the spot recognition results. Verify whether the spot size in the spot recognition results meets the preset standard based on the preset spot size threshold.
[0014] S4. Based on the first region of interest, at least two Gaussian distributions are obtained. The pixel value corresponding to the minimum value between the Gaussian distributions is calculated. The edge of the spot is distinguished as clear according to the preset spot clarity threshold. The gray value of the spot edge is calculated. The gray value of the spot is distinguished as meeting the preset standard according to the preset spot gray value threshold.
[0015] Focusing methods include:
[0016] S1', Image preprocessing stage: Otsu binarizes the original image to obtain a binarized image, dilates the binarized image to find the grid outline, fits the second minimum bounding rectangle of the grid outline, and truncates the binarized image according to the second rectangle parameters of the second minimum bounding rectangle to obtain the second region of interest, and obtains the focused preprocessed image.
[0017] S2', Raster verification stage: Calculate the average gray value of the focused preprocessed image, and determine whether the raster meets the preset standard based on the preset raster resolution threshold.
[0018] This invention solves the problem of accurately identifying light spot boundaries. Through image preprocessing and grid verification, it addresses the difficulty in quantifying grid line widths. This improves the efficiency and yield of the dimming and focusing process, saves labor costs, and brings economic benefits to customers. This invention, based on machine vision for dimming and focusing detection of laser projectors, offers advantages such as high yield, reduced rework time, and lower labor costs, making it a crucial guarantee for enterprises to improve production efficiency and enhance their competitiveness.
[0019] In a more specific technical solution, step S1 includes:
[0020] S11, the first minimum bounding rectangle for fitting the standard circular profile;
[0021] S12. Obtain the center point coordinates and width and height parameters of the first minimum bounding rectangle, and enlarge the width and height of the rectangle accordingly;
[0022] S13. Extract the first region of interest containing the standard circle from the original image.
[0023] In a more specific technical solution, step S2 includes:
[0024] S21. Detect image edge contours using the Canny edge detection method and perform morphological closing operations on the image edge contours.
[0025] S22. Find all outer contours according to the image edge contour discovery method, and process the outer contours in descending order of contour area.
[0026] S23 traverses the outer contour, performs ellipse fitting on the outer contour to obtain a fitted ellipse, and filters according to the major and minor axes of the fitted ellipse to find the fitting parameters for the light spot ellipse.
[0027] In a more specific technical solution, step S2 also includes:
[0028] S201. Perform channel separation on the ROI of edge protection filtering to obtain the green channel;
[0029] S202. Count the number of pixels for each pixel value, and apply moving average filtering to the pixel count to obtain the pixel Gaussian distribution;
[0030] S203. Based on the pixel Gaussian distribution, extract the low pixel value Gaussian distribution data, and use it to fit a Gaussian curve to obtain the mean and standard deviation of the Gaussian curve, and then process it to obtain an adaptive threshold.
[0031] S204. Traverse the green channel, process each pixel value of the green channel, and obtain the light spot boundary accordingly.
[0032] To address the problem of accurately identifying the true boundary of the light spot during actual light spot adjustment, which affects the product yield, this invention employs a channel separation and Gaussian curve fitting method. First, the green channel is obtained, and then the number of values for each pixel is counted, revealing that the pixel values at the edge of the light spot conform to a Gaussian distribution.
[0033] In a more specific technical solution, step S202 uses the following logic to represent the pixel Gaussian distribution:
[0034]
[0035] Where f(x) represents a Gaussian distribution, μ is the mean of the Gaussian curve, and δ is the standard deviation.
[0036] In a more specific technical solution, step S203 uses the following logical processing to obtain the adaptive threshold:
[0037] threshold = μ + 3*δ.
[0038] In a more specific technical solution, in step S204, each pixel value of the green channel is processed using the following logic to obtain the light spot boundary:
[0039]
[0040] Where x and y are the row and column indices of the pixel.
[0041] This invention obtains the mean and standard deviation parameters of the Gaussian distribution of the pixel values at the edge of the light spot by performing moving mean filtering on the data and then fitting the data with a Gaussian curve. The binarization threshold is found by this method, thereby finding the boundary of the light spot.
[0042] In a more specific technical solution, step S4 includes:
[0043] S41. Based on the ellipse parameters fitted by the standard circle, calculate the four intersection points of the ellipse with the straight line passing through the center of the ellipse and having a slope of positive 1 and negative 1.
[0044] S42. Select a region within the ellipse and calculate the average gray value of the four regions to verify whether the gray value of the spot meets the preset standard.
[0045] In a more specific technical solution, step S42 verifies whether the grayscale of the light spot meets the preset standard using the following logic:
[0046] S = π*a*b
[0047]
[0048] Where, score is the similarity score between the light spot and the standard circle, S gtS is the area of the ellipse fitted to the standard circle. dt Let be the area of the fitted ellipse for the light spot, and a and b be the major and minor axes of the ellipse, respectively.
[0049] To address the difficulty in quantifying grid width during focus adjustment, this invention transforms the problem into determining the grayscale value of the grid region. The image is binarized using the Otsu binarization method, resulting in a binarized image where the grid is white and the background is black. The wider the grid lines, the higher the overall grayscale value of the image. By setting a reasonable threshold based on actual production line conditions, the accuracy of focus qualification differentiation is improved.
[0050] In a more specific technical solution, a laser projector production line dimming and focusing detection system includes:
[0051] The dimming module includes:
[0052] The image preprocessing module uses Gaussian blur filtering to process the original image and Canny edge detection to obtain the image edge contour. Based on this, contour discovery and ellipse fitting operations are performed to detect and obtain a standard circular contour. A first minimum bounding rectangle is fitted based on the standard circular contour. The original image is then cropped based on the first rectangle parameters of the first minimum bounding rectangle to obtain the first region of interest, thereby completing the image preprocessing.
[0053] The spot recognition module is used to filter the first region of interest using the edge protection filtering method, find the adaptive threshold using the Gaussian curve fitting method, find the spot boundary, obtain the image edge contour using the Canny edge detection method, perform contour discovery and ellipse fitting operation to obtain the spot ellipse fitting parameters, and then perform spot recognition to obtain the spot recognition result. The spot recognition module is connected to the spot image preprocessing module.
[0054] The spot resolution module is used to calculate the ratio of the area of the fitted ellipse of the identified spot to the area of the fitted ellipse of the standard circle based on the spot recognition result. According to the preset spot size threshold, it verifies whether the spot size in the spot recognition result meets the preset standard. The spot resolution module is connected to the spot recognition module.
[0055] The spot grayscale resolution module is used to process at least two Gaussian distributions based on the first region of interest, calculate the pixel value corresponding to the minimum value between the Gaussian distributions, distinguish whether the edge of the spot is clear according to a preset spot clarity threshold, calculate the grayscale value of the spot edge, and distinguish whether the grayscale of the spot meets the preset standard according to the preset spot grayscale threshold. The spot grayscale resolution module is connected to the spot image preprocessing module and the spot recognition module.
[0056] The focus adjustment module includes:
[0057] The focus adjustment preprocessing module is used to binarize the original image to obtain a binarized image, dilate the binarized image to find the grid outline, fit the second minimum bounding rectangle of the grid outline, and crop the binarized image according to the second rectangle parameters of the second minimum bounding rectangle to obtain the second region of interest, thereby obtaining the focus adjustment preprocessed image.
[0058] The grid resolution module is used to calculate the average gray value of the focused preprocessed image and to verify whether the grid meets the preset standard according to the preset grid resolution threshold. The grid resolution module is connected to the focused preprocessing module.
[0059] Compared with existing technologies, this invention has the following advantages: It solves the problems of difficult-to-accurately identify light spot boundaries and difficult-to-quantify grid line width. It improves the efficiency and yield of the dimming and focusing process, saves labor costs, and brings economic benefits to customers. This invention, based on machine vision for dimming and focusing detection of laser projectors, has advantages such as high yield, reduced rework time, and reduced labor costs, making it an important guarantee for enterprises to improve production efficiency and enhance their competitiveness.
[0060] To address the problem of accurately identifying the true boundary of the light spot during actual light spot adjustment, which affects the product yield, this invention employs a channel separation and Gaussian curve fitting method. First, the green channel is obtained, and then the number of values for each pixel is counted, revealing that the pixel values at the edge of the light spot conform to a Gaussian distribution.
[0061] This invention obtains the mean and standard deviation parameters of the Gaussian distribution of the pixel values at the edge of the light spot by performing moving mean filtering on the data and then fitting the data with a Gaussian curve. The binarization threshold is found by this method, thereby finding the boundary of the light spot.
[0062] To address the difficulty in quantifying grid width during focus adjustment, this invention transforms the problem into determining the grayscale value of the grid region. The image is binarized using the Otsu binarization method, resulting in a binarized image where the grid is white and the background is black. The wider the grid lines, the higher the overall grayscale value of the image. By setting a reasonable threshold based on actual production line conditions, the accuracy of focus qualification differentiation is improved.
[0063] This invention solves the technical problems in the prior art, such as the difficulty in accurately identifying the light spot boundary and the difficulty in quantifying the grid line width, thereby improving the efficiency and yield of the dimming and focusing process, saving labor costs, and bringing economic benefits to customers. Attached Figure Description
[0064] Figure 1 This is a schematic diagram of the basic steps of a laser projector production line dimming and focusing detection method according to Embodiment 1 of the present invention;
[0065] Figure 2 This is a schematic diagram illustrating the detailed image preprocessing steps in the dimming spot processing process of Embodiment 1 of the present invention.
[0066] Figure 3 This is the original image of the light spot detection in Embodiment 1 of the present invention;
[0067] Figure 4 This is an image edge contour effect diagram of Embodiment 1 of the present invention;
[0068] Figure 5 This is a diagram showing the fitted ellipse effect of Embodiment 1 of the present invention;
[0069] Figure 6 This is a schematic diagram illustrating the specific steps of spot recognition in Embodiment 1 of the present invention;
[0070] Figure 7 This is a statistical distribution diagram of the number of green channel pixel values in Embodiment 1 of the present invention;
[0071] Figure 8 This is a diagram showing the Gaussian curve fitting effect of Embodiment 1 of the present invention;
[0072] Figure 9 This is a diagram showing the binarization effect of Embodiment 1 of the present invention;
[0073] Figure 10 This is an actual effect diagram of ellipse fitting in Embodiment 1 of the present invention;
[0074] Figure 11 This is a schematic diagram illustrating the specific steps of spot verification in Embodiment 1 of the present invention;
[0075] Figure 12 This is a schematic diagram illustrating the detailed image preprocessing steps during the focusing process in Embodiment 1 of the present invention;
[0076] Figure 13 This is the original image of the focused detection in Embodiment 1 of the present invention;
[0077] Figure 14 This is a schematic diagram illustrating the specific steps of grid verification in Embodiment 1 of the present invention;
[0078] Figure 15 This is a screenshot of the ROI to be detected in Embodiment 1 of the present invention;
[0079] Figure 16 This is a grid verification result diagram of Embodiment 1 of the present invention. Detailed Implementation
[0080] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0081] Example 1
[0082] like Figure 1 As shown, the laser projector production line dimming and focusing detection method provided by the present invention includes the following dimming spot processing steps:
[0083] S1. Image preprocessing is performed using Gaussian blur filtering, edge detection, contour discovery, and ellipse fitting.
[0084] like Figure 2 As shown, in this embodiment, step S1 further includes the following specific steps:
[0085] In the image preprocessing stage, S11 filters the original image using a Gaussian blur filtering method and obtains the image edge contours using an edge detection method.
[0086] S12. Detect standard circular contours using contour discovery and ellipse fitting methods;
[0087] S13. Based on the standard circular outline, the original image is cropped to obtain the region of interest.
[0088] In this embodiment, the ellipse fitting method for the standard circle in the image preprocessing stage is characterized by: detecting the image edge contours using the Canny edge detection method and performing a morphological closing operation on them; finding all outer contours using a contour discovery method and sorting the contours in descending order based on their area; traversing the contours and performing ellipse fitting on them; and filtering according to the major and minor axes of the fitted ellipse to find the fitting parameters for the standard circle.
[0089] In this embodiment, the image cropping method in the image preprocessing stage is characterized by: fitting the minimum bounding rectangle of the standard circle contour, obtaining the center point coordinates and width and height parameters of the rectangle, enlarging the width and height of the rectangle, and cropping the ROI containing the standard circle from the original image.
[0090] like Figure 3 As shown, in this embodiment, the original image is filtered using a Gaussian blur filtering method, where the Gaussian kernel parameter is (3,3). The image edge contour is obtained using the Canny edge detection method, where the threshold1 parameter is 80 and the threshold2 parameter is 160.
[0091] like Figure 4 As shown, the image edge contour is obtained through morphological closing operations. In this embodiment, all outer contours are found using a contour discovery method, and the contours are sorted in descending order based on their area. The contours are then traversed, and ellipse fitting is performed. Ellipse fitting is used here primarily because, due to the camera's perspective, the image of a standard circle is an ellipse. The ellipse fitting parameters for the standard circle are found by filtering according to rules based on the major axis a and minor axis b of the fitted ellipse. These rules stipulate that the lengths of the major and minor axes must be within a specific range, and the ratio of the major to minor axis must also meet a specific range. The specific values need to be adjusted according to the production line conditions.
[0092] like Figure 5 As shown, the minimum bounding rectangle of the fitted standard circle contour is obtained, along with its center point coordinates (cx, cy), width, and height. The rectangle's width and height are then enlarged and cropped. Specifically, a rectangle with N*width and M*height centered at (cx, cy) is obtained, where N and M are greater than 1. Based on this rectangle, a Region of Interest (ROI) containing the standard circle is extracted from the original image. Figure 4 The red line marks the fitted ellipse result of the standard circle.
[0093] S2. Spot recognition is performed using edge protection filtering, Gaussian curve fitting, binarization, and ellipse fitting.
[0094] like Figure 6 As shown, in this embodiment, step S2 further includes the following specific steps:
[0095] S21. In the spot recognition stage, the ROI is filtered using an edge protection filtering method.
[0096] S22. By using the Gaussian curve fitting method, an adaptive threshold can be found, and the boundary of the light spot can be accurately found based on the adaptive threshold.
[0097] S23. Image edge contours can be obtained through edge detection methods, and ellipse fitting parameters for light spots can be obtained through contour discovery and ellipse fitting methods.
[0098] In this embodiment, the Gaussian curve fitting method in the spot recognition stage is characterized by: performing channel separation on the ROI after edge protection filtering to obtain the green channel, and counting the number of pixels for each pixel value; after performing moving mean filtering on the number of pixels, performing Gaussian curve fitting on the data to obtain the mean and standard deviation of the Gaussian curve, and calculating the adaptive threshold based on the mean and standard deviation.
[0099] In the spot recognition stage, the ROI is filtered using an edge protection filter method, where the sigma_s parameter is 100 and the sigma_r parameter is 0.5. The purpose of using edge protection filtering is to preserve the image edge information while filtering.
[0100] An adaptive threshold is found using Gaussian curve fitting, which accurately locates the light spot boundary. This step is implemented as follows: the ROI image is separated into channels; since the light spot is green, the green channel is selected. The number of pixels for each pixel value is counted, and then a moving average filter is applied to the pixel count, with the filter window set to 15.
[0101] like Figure 7 As shown in the figure, the horizontal axis represents the pixel value and the vertical axis represents the number of pixels corresponding to the pixel value. It is easy to see that its distribution conforms to a Gaussian distribution.
[0102]
[0103] like Figure 8 As shown, Gaussian distribution data with lower pixel values is extracted, and a Gaussian curve is fitted to the data. The mean μ and standard deviation δ of the Gaussian curve are obtained. The binarization adaptive threshold threshold can be calculated using the following formula:
[0104] threshold=μ+3*δ
[0105] like Figure 9 As shown, by iterating through the green channel and processing each pixel value according to the following formula, a binarized image can be obtained:
[0106]
[0107] Image edges are obtained using the Canny edge detection method, and the outer contour of the light spot is found through contour discovery.
[0108] like Figure 10 As shown, ellipse fitting can be performed on the light spot contour to obtain the ellipse fitting parameters.
[0109] S3. Calculate the spot size and gray level to complete the spot verification.
[0110] like Figure 11 As shown, step S3 also includes the following specific steps:
[0111] S31. In the spot verification stage, the ratio of the area of the fitted ellipse of the identified spot to the area of the fitted ellipse of the standard circle is calculated. By setting a reasonable threshold, it can be determined whether the spot size meets the standard.
[0112] S32. Calculate the pixel value corresponding to the minimum value between two Gaussian distributions. By setting a reasonable threshold, it can be used to distinguish whether the edge of the light spot is blurred.
[0113] S33. Calculate the gray value of the light spot edge. By setting a reasonable threshold, it can be determined whether the gray value of the light spot meets the standard.
[0114] In this embodiment, the method for calculating the gray value of the edge of the light spot in the light spot verification stage is characterized by: calculating the four intersection points of the ellipse with the straight line passing through the center of the ellipse and having a slope of positive 1 and negative 1 according to the ellipse parameters fitted by the standard circle; selecting a region inside the ellipse for each region; and calculating the average gray value of the four regions to verify whether the gray value of the light spot meets the requirements.
[0115] During the spot verification stage, the area S of the fitted ellipse of the identified spot is calculated using the following formula. dt The area S of the fitted ellipse of the standard circle gt And the score. Setting a reasonable threshold for the score, such as 100±1.5, can distinguish whether the size of the light spot meets the standard.
[0116] S = π*a*b
[0117]
[0118] The method for determining whether the edge of a light spot is clear during the light spot verification stage is as follows: Since the Gaussian distributions of clear and blurry images are different, by calculating the pixel value corresponding to the minimum value between the two Gaussian distributions and setting an appropriate threshold, it is possible to effectively distinguish whether the edge of the light spot is clear.
[0119] The method for calculating the grayscale value of the light spot edge during the light spot verification stage is as follows: Based on the ellipse parameters fitted to the standard circle, calculate the four intersection points of the ellipse with a straight line passing through the center of the ellipse and having a slope of +1 and -1. Select a region within each ellipse, with a region size of 5*5 pixels, and calculate the average grayscale value of the four pixel blocks. By setting a reasonable threshold according to the actual production line conditions, it is possible to verify whether the grayscale value of the light spot meets the requirements.
[0120] The focus detection method includes steps such as image preprocessing and raster verification.
[0121] like Figure 1 As shown, the grid adjustment algorithm involved in the laser projector production line dimming and focusing detection method provided by the present invention further includes the following steps:
[0122] S1': Perform raster image preprocessing using Otsu binarization, contour discovery, minimum bounding rectangle, and image cropping operations;
[0123] like Figure 12As shown, in this embodiment, step S1' further includes the following specific steps:
[0124] S11' In the image preprocessing stage, the original image is binarized using the Otsu binarization (OSTU) method;
[0125] S12' Perform a dilation operation on the binarized image, and the grid contour can be found using the contour discovery method;
[0126] S13': Find the smallest bounding rectangle of the fitted raster outline. By cropping the binarized image according to the rectangle parameters, the ROI can be obtained.
[0127] like Figure 13 The image shown is the original image for focus detection. In the image preprocessing stage, the original image is converted to grayscale and then binarized using the Otsu binarization method. After this processing, the raster color is white and the background color is black. A dilation operation is then performed on the binarized image, with a kernel size of (19, 19). The raster contour is found using a contour discovery method. By fitting the minimum bounding rectangle of the raster contour and cropping the binarized image according to the rectangle parameters, the Region of Interest (ROI) can be obtained.
[0128] S2': Raster verification is completed by cropping, calculating and verifying the raster grayscale of the image.
[0129] like Figure 14 As shown, in this embodiment, step S2' further includes the following specific steps:
[0130] S21' In the grid verification stage, in order to prevent edge interference, the ROI is further truncated to obtain the image to be detected;
[0131] S22' Calculate the average grayscale value of the image to be detected. By setting a reasonable threshold, it is possible to determine whether the raster meets the standard.
[0132] like Figure 15 As shown, during the raster verification stage, due to perspective issues, the ROI includes parts outside the raster area. To prevent edge interference, it is further truncated. The truncation method is as follows: truncate by multiplying the width and height of the ROI by 0.8 based on its center coordinates to obtain the image to be detected.
[0133] like Figure 16 As shown, the average grayscale value of the image to be detected is calculated. Based on the actual situation of the production line, a reasonable threshold is set to distinguish whether the grid meets the standard.
[0134] In this embodiment, the spot adjustment method includes steps such as image preprocessing, spot recognition, and spot verification. In the image preprocessing stage, the original image is filtered using a Gaussian Blur Filter, and the image edge contour is obtained using an edge detection method. A standard circular contour is detected using contour discovery and ellipse fitting methods. Based on the standard circular contour, a minimum bounding rectangle is fitted, and the original image is cropped according to the rectangle parameters to obtain the Region of Interest (ROI). In the spot recognition stage, the ROI is filtered using an Edge Preserving Filter. An adaptive threshold is found using Gaussian Curve Fitting, and the spot boundary can be accurately located based on the adaptive threshold. The image edge contour is obtained using an edge detection method, and the ellipse fitting parameters for the spot are obtained using contour discovery and ellipse fitting methods. In the spot verification stage, the ratio of the area of the fitted ellipse of the identified spot to the area of the fitted ellipse of the standard circle is calculated. By setting a reasonable threshold, it can be determined whether the spot size meets the standard. The pixel value corresponding to the minimum value between two Gaussian distributions is calculated. By setting a reasonable threshold, it can be determined whether the spot edge is clear. The gray value of the spot edge is calculated. By setting a reasonable threshold, it can be determined whether the spot gray value meets the standard.
[0135] The focusing method includes steps such as image preprocessing and raster verification. In the image preprocessing stage, the original image is binarized using the Otsu binarization (OSTU) method; dilation is performed on the binarized image to find the raster outline; the minimum bounding rectangle of the raster outline is fitted, and the binarized image is cropped according to the rectangle parameters to obtain the Region of Interest (ROI). In the raster verification stage, the average grayscale value of the image is calculated, and by setting an appropriate threshold, it can be determined whether the raster conforms to the standard.
[0136] In summary, this invention addresses the problem of accurately identifying the true boundary of the light spot during actual light spot adjustment, which affects the product yield. This invention employs channel separation and Gaussian curve fitting methods, first obtaining the green channel, then counting the number of values for each pixel, and discovering that the pixel values at the edge of the light spot conform to a Gaussian distribution.
[0137] This invention obtains the mean and standard deviation parameters of the Gaussian distribution of the pixel values at the edge of the light spot by performing moving mean filtering on the data and then fitting the data with a Gaussian curve. The binarization threshold is found by this method, thereby finding the boundary of the light spot.
[0138] To address the difficulty in quantifying grid width during focus adjustment, this invention transforms the problem into determining the grayscale value of the grid region. The image is binarized using the Otsu binarization method, resulting in a binarized image where the grid is white and the background is black. The wider the grid lines, the higher the overall grayscale value of the image. By setting a reasonable threshold based on actual production line conditions, the accuracy of focus qualification differentiation is improved.
[0139] This invention solves the technical problems in the prior art, such as the difficulty in accurately identifying the light spot boundary and the difficulty in quantifying the grid line width, thereby improving the efficiency and yield of the dimming and focusing process, saving labor costs, and bringing economic benefits to customers.
[0140] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting dimming and focusing in a laser projector production line, characterized in that, The method includes: Methods for adjusting the light spot include: S1. The original image is filtered using Gaussian blur filtering and the image edge contour is obtained using Canny edge detection. Contour discovery and ellipse fitting are performed to detect and obtain a standard circular contour. A first minimum bounding rectangle is fitted according to the standard circular contour. The original image is then cropped according to the first rectangle parameter of the first minimum bounding rectangle to obtain a first region of interest, thereby completing image preprocessing. S2. The first region of interest is filtered using an edge protection filter method, and an adaptive threshold is found using a Gaussian curve fitting method to find the light spot boundary. The image edge contour is then obtained using the Canny edge detection method, and contour discovery and ellipse fitting operations are performed to obtain the light spot ellipse fitting parameters. The light spot is then identified to obtain the light spot recognition result. S3. Calculate the ratio of the area of the fitted ellipse of the identified light spot to the area of the fitted ellipse of the standard circle based on the light spot recognition result. Verify whether the size of the light spot in the light spot recognition result meets the preset standard based on the preset light spot size threshold. The area of the fitted ellipse for the identified light spot is calculated using the following formulas. Area of the fitted ellipse of the standard circle and scores score ;right score Set a reasonable threshold to distinguish whether the size of the light spot meets the standard; S4. Based on the first region of interest, at least two Gaussian distributions are obtained. The pixel value corresponding to the minimum value among the Gaussian distributions is calculated. The edge of the spot is distinguished as clear according to a preset spot clarity threshold. The gray value of the spot edge is calculated. The gray value of the spot is distinguished as conforming to the preset standard according to a preset spot gray value threshold. The following logic is used to verify whether the grayscale of the light spot meets the preset standard: in, The similarity score between the light spot and the standard circle is calculated. The area of the ellipse fitted to the standard circle. The area of the fitted ellipse for the light spot. , These are the major and minor axes of the ellipse, respectively; Focusing methods include: S1', In the image preprocessing stage, the original image is binarized by Otsu to obtain a binarized image, the binarized image is dilated to find the grid outline, the second minimum bounding rectangle of the grid outline is fitted, and the binarized image is processed according to the second rectangle parameters of the second minimum bounding rectangle to obtain the second region of interest, so as to obtain the focused preprocessed image. S2', In the grid verification stage, the average gray value of the focused preprocessed image is calculated, and the grid is determined to meet the preset standard according to the preset grid resolution threshold. The preset grid resolution threshold is set according to the actual situation of the production line.
2. The method for detecting dimming and focusing on a laser projector production line according to claim 1, characterized in that, Step S1 includes: S11. Fit the first minimum bounding rectangle of the standard circular profile; S12. Obtain the center point coordinates and width and height parameters of the first minimum bounding rectangle, and enlarge the width and height of the rectangle accordingly; S13. Extract the first region of interest containing a standard circle from the original image.
3. The method for detecting dimming and focusing in a laser projector production line according to claim 1, characterized in that, Step S2 includes: S21. Detect the image edge contour using the Canny edge detection method, and perform a morphological closing operation on the image edge contour; S22. Find all outer contours according to the image edge contour discovery method, and process the outer contours in descending order of contour area. S23 traverses the outer contour, performs ellipse fitting on the outer contour to obtain a fitted ellipse, and filters according to the major and minor axes of the fitted ellipse to find the fitting parameters of the light spot ellipse.
4. The method for detecting dimming and focusing on a laser projector production line according to claim 1, characterized in that, Step S2 further includes: S201. Perform channel separation on the ROI of edge protection filtering to obtain the green channel; S202. Count the number of pixels for each pixel value, and apply moving mean filtering to the number of pixels to obtain a Gaussian distribution of pixels; S203. Based on the pixel Gaussian distribution, extract the low pixel value Gaussian distribution data, and perform Gaussian curve fitting to obtain the mean and standard deviation of the Gaussian curve, and process it to obtain an adaptive threshold. S204. Traverse the green channel and process each pixel value of the green channel to obtain the light spot boundary.
5. The method for detecting dimming and focusing in a laser projector production line according to claim 4, characterized in that, In step S202, the pixel Gaussian distribution is represented using the following logic: in, Indicates a Gaussian distribution. The mean of the Gaussian curve is given. The standard deviation is denoted as .
6. The method for detecting dimming and focusing on a laser projector production line according to claim 4, characterized in that, In step S203, the adaptive threshold is obtained using the following logical processing. : 。 7. The method for detecting dimming and focusing on a laser projector production line according to claim 5, characterized in that, In step S204, each pixel value of the green channel is processed using the following logic to obtain the light spot boundary: in, These are the row and column indices of the pixels.
8. The method for detecting dimming and focusing on a laser projector production line according to claim 1, characterized in that, Step S4 includes: S41. Based on the ellipse parameters fitted by the standard circle, calculate the four intersection points of the ellipse with the straight line passing through the center of the ellipse and having a slope of positive 1 and negative 1. S42. Select a region within the ellipse and calculate the average gray value of the four regions to verify whether the gray value of the light spot meets the preset standard.
9. A laser projector production line dimming and focusing detection system, used to execute the laser projector production line dimming and focusing detection method according to any one of claims 1 to 8, characterized in that, The system includes: The dimming module includes: The image preprocessing module uses Gaussian blur filtering to filter the original image and Canny edge detection to obtain the image edge contour. Based on this, contour discovery and ellipse fitting operations are performed to detect and obtain a standard circular contour. A first minimum bounding rectangle is fitted based on the standard circular contour. The original image is then cropped based on the first rectangle parameter of the first minimum bounding rectangle to obtain a first region of interest, thereby completing the image preprocessing. The spot recognition module is used to filter the first region of interest using an edge protection filtering method, find an adaptive threshold using a Gaussian curve fitting method, find the spot boundary, obtain the image edge contour using the Canny edge detection method, perform contour discovery and ellipse fitting operations to obtain the spot ellipse fitting parameters, and perform spot recognition to obtain the spot recognition result. The spot recognition module is connected to the spot image preprocessing module. A spot resolution module is used to calculate the ratio of the area of the fitted ellipse of the identified spot to the area of the fitted ellipse of the standard circle based on the spot recognition result, and to verify whether the spot size in the spot recognition result meets the preset standard based on the preset spot size threshold. The spot resolution module is connected to the spot recognition module. The spot grayscale resolution module is used to process at least two Gaussian distributions based on the first region of interest, calculate the pixel value corresponding to the minimum value between the Gaussian distributions, distinguish whether the edge of the spot is clear according to a preset spot clarity threshold, calculate the grayscale value of the spot edge, and distinguish whether the grayscale of the spot meets the preset standard according to the preset spot grayscale threshold. The spot grayscale resolution module is connected to the spot image preprocessing module and the spot recognition module. The focus adjustment module includes: The focus adjustment preprocessing module is used to binarize the original image to obtain a binarized image, dilate the binarized image to find the grid outline, fit the second minimum bounding rectangle of the grid outline, and crop the binarized image according to the second rectangle parameters of the second minimum bounding rectangle to obtain a second region of interest, thereby obtaining the focus adjustment preprocessed image. The grid resolution module is used to calculate the average gray value of the focused preprocessed image and to verify whether the grid conforms to the preset standard according to the preset grid resolution threshold. The grid resolution module is connected to the focused preprocessing module.