Defect detection control method and system and medium
By judging the center of mass and energy threshold of the laser image in the autofocus device and generating a column maximum value collection curve, the problem that the device cannot identify the discontinuous area of the object to be tested is solved, and accurate focus control and a widely applicable autofocus system are realized.
Patent Information
- Application Number
- CN202411905950.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-29
AI Technical Summary
Existing automatic focus devices cannot stop focusing normally when the object to be tested is moved out of the field of view, resulting in the inability to identify the discontinuous area of the object to be tested, and it is necessary to understand the position of the object to be tested in advance, which limits the universality of the device.
By determining whether the center of mass of the laser image belongs to the threshold range of the centroid, analyzing whether the laser energy is within the energy threshold range, and generating a column maximum value collection curve to identify the brightness change trend, controlling the focus state of the focusing device.
It realizes that the height difference between the surface and the table surface of the object to be tested is small, accurately identifying and stop focusing, and quickly identifying the normal and discontinuous areas of the object to be tested, avoiding the need to understand the position of the object to be tested in advance, and expanding the scope of application of the equipment.
Smart Images

Figure CN119902362A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of automatic focusing, and in particular relates to a defect detection control method, system and medium. Background Art
[0002] Defect detection often uses a microscopic autofocus device for detection. The object to be tested is placed flat on the motion control platform, the focus device is fixed, and the object to be tested is moved to find defects. When the object to be tested moves out of the field of view of the focus device, the autofocus needs to be stopped, otherwise it will not be able to focus normally when it moves back into the field of view of the focus device. If the position of the object to be tested relative to the focus device is known in advance, the focus can be enabled by external triggering. When the motion control platform detects that the object to be tested moves out of the field of view of the focus device, the z-axis is disabled; when it moves in, the z-axis is enabled.
[0003] In a microscope autofocus device, the focus range of the focus lens is fixed. During the focusing process, the field of view of the focus lens will move from above the object to the table or from above the continuous area of the object to the non-continuous area of the object. In some cases, the difference in distance from the lens before and after the movement exceeds the linear focus range. If the autofocus is always enabled, it is easy to fail to focus normally during the movement in and out.
[0004] The existing focusing device must know the position of the object to be tested relative to the focusing device in advance. In some scenarios, the characteristic value is not easy to obtain, so it is not universal. At the same time, there are discontinuous areas inside some objects to be tested, and these discontinuous areas do not need to be focused. Therefore, in order to ensure that the focus lens of the automatic focusing device stops focusing when it is on the table or the discontinuous area of the object to be tested, the present invention provides a defect detection control method, system and medium. Summary of the invention
[0005] The purpose of the present invention is to overcome the above problems existing in the prior art and to provide a defect detection control method, system and medium.
[0006] In order to achieve the above technical objectives and the above technical effects, the present invention is implemented through the following technical solutions: A defect detection control method controls a focusing device to emit laser, and adjusts the focusing state of the focusing device according to the laser image to detect an object to be detected that moves relatively within the field of view of the focusing device. The control method includes: Determine whether the centroid of the laser image belongs to the centroid threshold range, if yes, output a first normal signal to control the focusing device to continue focusing, if no, output a first abnormal signal to control the focusing device to end focusing; Analyze whether the laser energy corresponding to the first normal signal belongs to the energy threshold range, if yes, output the second normal signal to control the focusing device to continue focusing, if no, output the second abnormal signal to control the focusing device to end focusing; Collect the laser image corresponding to the second normal signal, extract the maximum pixel value in each column direction and form a column maximum value collection curve to reflect the brightness change trend of the laser image in the row direction; It is analyzed whether there are continuous peaks with widths exceeding a width threshold in the column maximum value collection curve. If so, the focus device is controlled to continue focusing; if not, the focus device is controlled to end focusing.
[0007] Furthermore, determining whether the centroid of the laser image belongs to the centroid threshold range includes: calculating the offset between the centroid coordinates of the laser image and the reference centroid to obtain the defocus amount; wherein the centroid threshold range is a preset defocus amount threshold range to analyze whether the defocus amount belongs to the defocus amount threshold range.
[0008] Furthermore, after the first abnormal signal is output, it is determined whether the number of laser images corresponding to the continuous output of the first abnormal signal is greater than the frame number threshold. If so, the focusing device is controlled to end focusing, otherwise, it continues to analyze whether the laser energy corresponding to the first normal signal belongs to the energy threshold range.
[0009] Furthermore, the laser image is a ROI region corresponding to the original image.
[0010] Furthermore, the laser energy is automatically adjusted according to the pixel average value of the laser image, and the laser energy is adjusted based on the step size so that the pixel average value of the laser image is within a preset pixel range.
[0011] Furthermore, after controlling the focusing device to continue focusing, the laser energy and exposure time at the current moment are synchronously recorded.
[0012] Furthermore, after collecting the laser image corresponding to the second normal signal, it is determined whether the length of the connected domain of the laser image is greater than the connectivity threshold. If so, the maximum pixel value in each column direction is continuously extracted and a column maximum value collection curve is formed. If not, the focusing device is controlled to end focusing.
[0013] Furthermore, if the length of the connected domain of the laser image is greater than the connectivity threshold, the laser image is divided into several sub-areas and the pixel average value of each sub-area is counted to analyze whether the difference between the maximum pixel average value and the minimum pixel average value is less than the image difference threshold. If so, the focusing device is controlled to continue focusing; if not, the focusing device is controlled to end focusing, instead of extracting the maximum pixel value in each column direction and forming a column maximum value collection curve.
[0014] The present invention also provides a defect detection control system, comprising: An image analysis module, used to determine whether the centroid of the laser image belongs to the centroid threshold range, and if so, output a first normal signal to control the focusing device to continue focusing, and if not, output a first abnormal signal to control the focusing device to end focusing; An energy analysis module, used to analyze whether the laser energy corresponding to the first normal signal belongs to the energy threshold range, and if so, output a second normal signal to control the focusing device to continue focusing, and if not, output a second abnormal signal to control the focusing device to end focusing; A curve analysis module is used to collect the laser image corresponding to the second normal signal, extract the maximum pixel value in each column direction and form a column maximum value collection curve to reflect the brightness change trend of the laser image in the row direction; The peak-finding analysis module is used to analyze whether there are continuous peaks with widths exceeding a width threshold in the column maximum value collection curve. If so, the focusing device is controlled to continue focusing; if not, the focusing device is controlled to end focusing.
[0015] The present invention also provides a computer-readable storage medium, comprising a computer program, wherein the computer program implements the above control method when executed by a processor.
[0016] The beneficial effects of the present invention are: (1) The present invention can effectively ensure that the focus lens can quickly identify and stop focusing when the object to be tested moves to the table in most scenarios by judging whether the centroid of the laser image falls within the centroid threshold range. Then, by combining the analysis of whether the laser energy corresponding to the first normal signal falls within the energy threshold range, when the height difference between the surface of the object to be tested and the table is small, the problem of the small difference in the laser image itself can be compensated, and the focus lens can further ensure that the focus lens can accurately identify and stop focusing when the object to be tested moves to the table. Finally, by generating a column maximum value collection curve and analyzing whether there are peaks with continuous widths exceeding the width threshold in the column maximum value collection curve, the normal area and the discontinuous area of the object to be tested can be quickly and effectively identified, so as to quickly and accurately stop focusing on the discontinuous area of the object to be tested, without having to know the position of the object to be tested relative to the focusing device in advance, and the scope of application is wider.
[0017] (2) After acquiring the laser image corresponding to the second normal signal, the present invention directly determines whether the length of the connected domain of the laser image is greater than the connectivity threshold, and can effectively combine the "connected domain length" feature to quickly identify the "discontinuous area". At the same time, when the possibility of the "discontinuous area" in special circumstances cannot be ruled out, the peak-finding strategy can be combined for in-depth analysis and distinction.
[0018] (3) The present invention analyzes whether the difference between the maximum pixel average and the minimum pixel average is less than the image difference threshold, effectively combining the significant features of the "non-continuous area" in special cases with the "continuous area" to distinguish them, thereby replacing the peak-finding strategy for confirmation and providing a richer solution for actual operation.
[0019] (4) The present invention calculates the offset between the centroid coordinates of the laser image and the reference centroid for analysis, and can accurately analyze the current focus state based on the laser image, thereby improving the accuracy of the entire focus analysis.
[0020] (5) The present invention limits the laser image through the ROI area, which can ensure the accuracy and efficiency of the defocus result calculation on the basis of improving the laser image frame rate.
[0021] (6) The present invention adjusts the laser energy based on the step size so that the pixel average value of the laser image is within a preset pixel range, which can ensure clear imaging of the laser image, and combines the analysis of whether the laser energy corresponding to the first normal signal belongs to the energy threshold range, thereby further ensuring the reliability of the enabling control method. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings: Figure 1 is a flow chart of the control method in the present invention; Figure 2 It is a schematic diagram of actual detection of the object to be detected in the present invention; Figure 3 It is a schematic diagram of the surface structure of the object to be tested in the present invention; Figure 4 It is a schematic diagram of a column maximum value collection curve in the present invention; Figure 5 is a schematic diagram of laser images of continuous areas and discontinuous areas in the present invention; Figure 6 It is a structural block diagram of the control system in the present invention. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] like Figure 1As shown, this embodiment first provides a defect detection control method, which controls a focusing device to emit laser and adjusts the focusing state of the focusing device according to the laser image to detect an object to be detected that moves relatively within the field of view of the focusing device.
[0025] like Figure 2 and Figure 3 As shown, Figure 2 The actual detection diagram of the object to be tested is shown in Figure 2. Figure 3 The schematic diagram of the surface structure of the object to be tested is shown in FIG. The white area on the surface of the object is a continuous area, and the gray area is a discontinuous area. During the focusing process, the field of view of the focusing lens will move from above the object to the table surface or from above the continuous area of the object to be tested to the discontinuous area of the object to be tested. It is necessary to end the focusing in time when the focusing lens is aimed at the table surface or the discontinuous area of the object to be tested. The specific control method includes the following steps: Step 1: Determine whether the centroid of the laser image belongs to the centroid threshold range. If so, output a first normal signal to control the focus device to continue focusing. If not, output a first abnormal signal to control the focus device to end focusing.
[0026] This step controls the focus enablement based on the rationality of the laser image itself. Under normal focus tracking, the laser image will change within a reasonable range, so the centroid threshold range is introduced for limitation. If the laser image is within the centroid threshold range, it means that the focus is normal and the focus continues. Otherwise, it means that the focus is abnormal and the focus can be terminated to avoid subsequent failure to follow the focus normally.
[0027] However, in order to prevent abnormal points on the surface of the object to be tested from causing abnormal laser images of certain frames, after the first abnormal signal is output, it is also possible to determine whether the number of laser images corresponding to the continuous output of the first abnormal signal is greater than the frame number threshold. If so, the focusing device is controlled to end the focusing, otherwise, the next step is continued. That is, only when the number of unreasonable continuous laser image frames is greater than the frame number threshold, the focus state at this moment will be identified as "moving out of the surface of the object to be tested."
[0028] Although judging whether the laser image centroid is within the centroid threshold range to control the focus enable can solve the scene where the field of view of most focus devices moves from the object to the table, when the height difference between the surface of the object to be measured and the table is small, the difference of the laser image itself is small, that is, from the result, it "belongs to the centroid threshold range". Therefore, in order to solve the above problem, the laser energy in the next step will be combined for analysis and judgment: Step 2: Analyze whether the laser energy corresponding to the first normal signal belongs to the energy threshold range. If so, output the second normal signal to control the focusing device to continue focusing. If not, output the second abnormal signal to control the focusing device to end focusing.
[0029] Since the autofocus device will modify the exposure time and laser energy in real time to ensure that the brightness of the laser image is within the set range, when the field of view of the focus device moves from the "object to be measured" to the "table", in order to ensure that the brightness of the laser image is within the set range, the laser energy will be greatly increased. This step controls the focus enable based on the rationality of the laser energy. Under normal focus tracking, the laser energy will also change within a reasonable range. Therefore, the energy threshold range is introduced for limitation. If the laser image is within the centroid threshold range, it means that the focus is normal and the focus will continue. Otherwise, it means that the focus is abnormal and the focus can be ended to avoid subsequent failure to follow the focus normally.
[0030] Although the above two steps can well control the focus enable when the field of view of the focus device reciprocates between the "object to be tested" and the "table" to ensure that the focus device continues to focus, the above methods are not always effective when there are non-continuous areas that are not in focus inside the object to be tested. Therefore, in order to solve the above problems, the peak-finding strategy in the subsequent steps will be combined for analysis and judgment: Step 3: Collect the laser image corresponding to the second normal signal, extract the maximum pixel value in each column direction and form a column maximum value collection curve to reflect the brightness change trend of the laser image in the row direction.
[0031] The laser image corresponding to the second normal signal indicates that it satisfies the requirements of both the centroid threshold range and the energy threshold range. At this time, it is necessary to identify the discontinuous area inside the object to be tested, and the characteristic difference between the normal surface of the object to be tested and the discontinuous area can be reflected in the brightness change trend in the row direction of the laser image. To this end, the column maximum values at different positions in the row direction of the laser image are aggregated to form a column maximum value collection curve.
[0032] Step 4: Analyze whether there are continuous peaks with widths exceeding the width threshold in the column maximum value collection curve. If so, control the focus device to continue focusing; if not, control the focus device to end focusing.
[0033] like Figure 4 As shown in FIG. 1 , a schematic diagram of a column maximum value collection curve in the present invention is shown, wherein the peak condition is that the pixel value of the curve exceeds the pixel threshold, and the horizontal dotted line in the figure represents the corresponding position of the pixel threshold. Assuming that the width threshold is 100, then Figure 4 In the three pictures, only the left picture "has a continuous peak with a width greater than 100", which is represented as a "continuous area", thereby controlling the focus device to continue focusing, while the middle and right pictures are represented as "discontinuous areas", thereby controlling the focus device to end focusing. In addition, the peak condition can also be set to exceed the pixel threshold and the continuous width exceeds the width threshold. By setting a reasonable pixel threshold and width threshold, when the number of detected peaks is greater than or equal to 1, it is considered to be a continuous area, otherwise it is considered to be a discontinuous area.
[0034] When the focus is controlled based on the rationality of the laser image itself, the rationality of the laser image is mainly judged by two features: image height and center of mass coordinates. Under normal focus tracking, even if the image height fluctuates, it will always remain at a small value due to the existence of the automatic ROI algorithm. Similarly, the center of mass coordinates also fluctuate around the reference center of mass. Changes in image height correspond to changes in the center of mass.
[0035] As a specific implementation of the present invention, the following steps are specifically adopted to determine whether the center of mass of the laser image belongs to the center of mass threshold range: calculate the offset between the center of mass coordinates of the laser image and the reference center of mass, so as to obtain the defocus amount; wherein the center of mass threshold range is a preset defocus amount threshold range, so as to analyze whether the defocus amount belongs to the defocus amount threshold range.
[0036] The calculation formula of the centroid coordinates is as follows:
[0037] Among them, Q represents the centroid, m represents the total number of pixel rows in the laser image, n represents the total number of pixel columns in the laser image, i represents the number of pixel rows in the laser image, j represents the number of pixel columns in the laser image, and f(i,j) represents the grayscale value of the pixel in the i-th row and j-th column.
[0038] In actual work, for each frame of laser image, the centroid Q of the laser image is extracted now (in pixels), the current centroid coordinate Q now and the reference center of mass Q ref The difference is converted into the defocus amount △d.
[0039] Among them, the reference center of mass Q ref Both the image stabilization speed and lens sensitivity s (in pixels / micron) are calibrated before autofocus.
[0040] The original image captured by the image sensor is relatively large, for example, 2048x2048 pixels. In order to improve the sampling rate of the laser image, the resolution of the laser image needs to be reduced. Therefore, as a specific embodiment of the present invention, the laser image is the ROI area corresponding to the original image. In actual work, the starting column, starting row, width and height of the ROI area between the edge of the ROI area and the edge of the image area are set in advance.
[0041] During the operation of the autofocus device, as the height between the image sensor and the surface of the object being measured changes, the height of the laser image, i.e., the spot, also increases or decreases. In order to prevent the laser image from exceeding the ROI area and affecting the normal calculation of the defocus amount, the ROI area (region of interest) can be automatically adjusted, specifically including the following steps: using a contour detection algorithm to detect the contour of the laser image; based on the relationship between the contour and the ROI area, adjusting the height of the ROI area so that the contour is completely within the boundary of the ROI area, and the minimum distance between the contour and the boundary is lower than a preset distance threshold.
[0042] Based on the above processing, the ROI area is adjusted so that it completely includes the laser image. On the basis of improving the laser image frame rate, the accuracy of the defocus result calculation is guaranteed.
[0043] The coordinates of the four vertices in the ROI area are obtained in advance as (x1, y1), (x2, y1), (x1, y2), (x2, y2), corresponding to the lower left, lower right, upper left and upper right vertices. Then, for the acquired laser image, the contour detection algorithm is used to detect the contour of the laser image. Among them, x represents the column coordinate of the pixel point, and y represents the row coordinate of the pixel point.
[0044] In order to make the entire contour within the boundary of the ROI area, it is necessary to determine whether the coordinates of all points in the contour are within the ROI boundary. If so, the minimum value z of the distance between all points of the contour and the upper and lower boundaries of the ROI is calculated.
[0045]
[0046] Among them, I represents the set of coordinate points within the contour, i y Represents the row coordinates of the coordinate points in the contour, abs(i y -y1) means i y The distance value from y1.
[0047] When z is less than a preset pixel row threshold, the existing ROI area is kept unchanged; when z is greater than, the ROI height becomes narrower. The pixel row threshold can be 5.
[0048] When the coordinates of some points in the contour are just above the ROI boundary, the ROI area is expanded upward and downward with a step size of 5 pixel rows.
[0049] In actual operation, the laser energy is automatically adjusted according to the pixel average value of the laser image, and the laser energy is adjusted based on the step size so that the pixel average value of the laser image is within the preset pixel range. The specific adjustment method of the laser energy is as follows: For each frame of laser image, read the average pixel value of the laser image. When the average pixel value is within the set pixel range, it indicates that the laser image brightness is appropriate and no operation is required. When the average pixel value is outside the set pixel range, calculate the new exposure time E according to the proportional relationship between the pixel value and the exposure time. new .
[0050]
[0051] Among them, E now Indicates the current exposure time, T v Indicates the target value of the pixel average, M v Indicates the current pixel average value of the laser image.
[0052] Determine whether the new exposure time exceeds the preset exposure time threshold; if not, set the exposure time of the autofocus device to the new exposure time, and end the exposure time adjustment process. If the calculated exposure time exceeds the exposure time range of the sensor, it means that even if the exposure time of the image sensor is adjusted to the limit, the brightness of the laser image cannot reach the target value. Therefore, set the exposure time of the autofocus device to the exposure time threshold, and re-determine whether the pixel average value under the exposure time threshold exceeds the preset pixel range; if not, end the exposure time adjustment process. If so, then adjust the laser energy value of the laser based on the preset step size, and return to determine whether the pixel average value is within the threshold range based on the adjusted laser energy value to ensure that the laser image is recognizable.
[0053] Among them, the step size of adjusting the laser energy is determined by the working current value of the laser. The appropriate adjustment step size ensures that the brightness of the laser image can be adjusted to the right position within a few frames, which is not only conducive to rapid focusing, but also can effectively avoid overexposure of the laser image.
[0054] Specifically, the process of determining the step length is as follows: determine whether the operating current of the laser is greater than the preset first current value. If so, it indicates that the current image sensor has a large defocus distance and the laser image brightness is low. The laser energy needs to be adjusted quickly to enhance the laser image brightness. Therefore, the adjustment step length of the laser is larger at this time and is set to the first step length value.
[0055] If the working current is less than the preset first current value, then determine whether the working current is greater than the preset second current value and less than the first current value. If so, then it is necessary to consider that the lens with different magnifications has different rates of change of the spot grayscale value caused by the change in laser brightness, because the sensitivity of the high-magnification lens is lower. Therefore, when the working current is in this range, the higher the lens magnification, the larger the step value, but it will not exceed the first step value.
[0056] If the working current is less than the preset second current value, it means that the defocus distance of the existing image sensor is small, the laser image is basically in a linear shape, and the laser's ability is concentrated. If the laser's adjustment step is set to a large value, it is very easy to cause the laser image to be overexposed, affecting normal autofocus. Therefore, at this time, the laser's adjustment step is set to the second step value, which is lower than the aforementioned step value.
[0057] In actual working process, the working current value of the laser is usually converted into DAC value (for example, the maximum working current is 160mA, and the corresponding DAC value is 4095), and then the specific adjustment step is determined based on the DAC value and the lens magnification. When the laser dac value is less than 200, the adjustment step of the laser is 2; when the laser dac value is greater than 200 and less than 2000, the lens magnification is less than 20 times, the laser adjustment step is 10, when the lens magnification is 50 times, the adjustment step is 20, when the lens magnification is 50 times, the adjustment step is 40; when the laser dac value is greater than 2000, the adjustment step is 100.
[0058] As a preferred embodiment of the present invention, after controlling the focusing device to continue focusing, the laser energy and exposure time at the current moment are synchronously recorded, so as to ensure that when the subsequent field of view moves from the "table" to the "object to be measured", it can be adjusted in time to obtain a suitable laser image.
[0059] like Figure 5 The figure shows the laser images of continuous and discontinuous areas, which can be seen from top to bottom. Figure 4 From left to right, one by one, Figure 5 The "continuous area" and "discontinuous area 1" represent the laser image distribution of the two under normal circumstances. It can be clearly seen that the length of the laser image connected domain of the "continuous area" is significantly greater than that of the "discontinuous area"; while the "discontinuous area 2" represents some special laser image distribution situations. At this time, the laser images of the "discontinuous area" and the "continuous area" are both continuous lines. The only difference is that there is at least one highlight area in the "discontinuous domain", and the grayscale value is much larger than that of the other areas.
[0060] Therefore, although the continuous area and the discontinuous area can be effectively distinguished by analyzing whether there are continuous peaks with widths exceeding the width threshold in the column maximum value collection curve, in order to further improve efficiency, after acquiring the laser image corresponding to the second normal signal, it is also possible to directly determine whether the length of the connected domain of the laser image is greater than the connectivity threshold. If so, it means that the possibility of a "discontinuous area" under normal circumstances can be ruled out, but the possibility of a "discontinuous area" under special circumstances cannot be ruled out. In this case, the maximum pixel value in each column direction can be further extracted and a column maximum value collection curve can be formed to further distinguish the "continuous area" and the "discontinuous area" through a peak-finding strategy. If not, it means that it can be determined as a "discontinuous area", and the focusing device is controlled to end focusing.
[0061] When the possibility of "discontinuous areas" in normal situations is excluded, but the possibility of "discontinuous areas" in special situations cannot be excluded, in addition to selecting the peak-finding strategy, that is, continuing to extract the maximum pixel value in each column direction and forming a column maximum value collection curve, the significant features of the "discontinuous areas" in special situations can also be combined to distinguish them from the "continuous areas". The specific steps are as follows: If the length of the connected domain of the laser image is greater than the connectivity threshold, the laser image is divided into several sub-areas and the pixel average value of each sub-area is counted to analyze whether the difference between the maximum pixel average value and the minimum pixel average value is less than the image difference threshold. If so, the focusing device is controlled to continue focusing; if not, the focusing device is controlled to end focusing, instead of extracting the maximum pixel value in each column direction and forming a column maximum value collection curve.
[0062] From the above, we can see Figure 5 The difference between the "continuous area" and the "discontinuous area 2" is that there is at least one highlight area in the "discontinuous area 2", and the grayscale value is much larger than that of the rest of the area. For example, the laser image can be divided into ten segments, and then the pixel average value of each segment is calculated. In the process of calculating the pixel average value, the low-grayscale noise can be removed by setting a threshold at the same time, which can reduce the influence of the non-laser image area. Finally, the difference between the maximum pixel average value and the minimum pixel average value can be analyzed. Since the difference value is small in the "continuous area" and large in the "discontinuous area", the "continuous area" and the "discontinuous area" can be effectively distinguished by comparing the image difference threshold set in advance.
[0063] like Figure 6 As shown, the second aspect of the present invention also provides a defect detection control system, comprising: An image analysis module, used to determine whether the centroid of the laser image belongs to the centroid threshold range, and if so, output a first normal signal to control the focusing device to continue focusing, and if not, output a first abnormal signal to control the focusing device to end focusing; An energy analysis module, used to analyze whether the laser energy corresponding to the first normal signal belongs to the energy threshold range, and if so, output a second normal signal to control the focusing device to continue focusing, and if not, output a second abnormal signal to control the focusing device to end focusing; A curve analysis module is used to collect the laser image corresponding to the second normal signal, extract the maximum pixel value in each column direction and form a column maximum value collection curve to reflect the brightness change trend of the laser image in the row direction; The peak-finding analysis module is used to analyze whether there are continuous peaks with widths exceeding a width threshold in the column maximum value collection curve. If so, the focusing device is controlled to continue focusing; if not, the focusing device is controlled to end focusing.
[0064] A third aspect of the present invention further provides a computer-readable storage medium, comprising a computer program, wherein the computer program implements the above control method when executed by a processor.
[0065] In practical applications, the computer-readable storage medium may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device.
[0066] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0067] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0068] Computer program code for performing the operation of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0069] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0070] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, and these changes and improvements all fall within the scope of the present invention to be protected.
Claims
1. A defect detection control method, which controls a focusing device to emit laser, and adjusts the focusing state of the focusing device according to the laser image, so as to detect an object to be tested that moves relatively within the field of view of the focusing device, characterized in that: Control methods include: Determine whether the centroid of the laser image belongs to the centroid threshold range, if yes, output a first normal signal to control the focusing device to continue focusing, if no, output a first abnormal signal to control the focusing device to end focusing; Analyze whether the laser energy corresponding to the first normal signal belongs to the energy threshold range, if yes, output the second normal signal to control the focusing device to continue focusing, if no, output the second abnormal signal to control the focusing device to end focusing; Collect the laser image corresponding to the second normal signal, extract the maximum pixel value in each column direction and form a column maximum value collection curve to reflect the brightness change trend of the laser image in the row direction; It is analyzed whether there are continuous peaks with widths exceeding a width threshold in the column maximum value collection curve. If so, the focus device is controlled to continue focusing; if not, the focus device is controlled to end focusing.
2. A defect detection control method according to claim 1, characterized in that: Determining whether the centroid of the laser image belongs to the centroid threshold range includes: calculating the offset between the centroid coordinates of the laser image and the reference centroid to obtain the defocus amount; wherein the centroid threshold range is a preset defocus amount threshold range to analyze whether the defocus amount belongs to the defocus amount threshold range.
3. A defect detection control method according to claim 2, characterized in that: After the first abnormal signal is output, it is determined whether the number of laser images corresponding to the continuous output of the first abnormal signal is greater than the frame number threshold. If so, the focusing device is controlled to end focusing, otherwise, it continues to analyze whether the laser energy corresponding to the first normal signal belongs to the energy threshold range.
4. A defect detection control method according to claim 2, characterized in that: The laser image is the ROI area corresponding to the original image.
5. A defect detection control method according to claim 1, characterized in that: The laser energy is automatically adjusted according to the pixel average value of the laser image, and the laser energy is adjusted based on the step size so that the pixel average value of the laser image is within a preset pixel range.
6. A defect detection control method according to claim 1, characterized in that: After controlling the focusing device to continue focusing, the laser energy and exposure time at the current moment are synchronously recorded.
7. A defect detection control method according to any one of claims 1 to 6, characterized in that: After collecting the laser image corresponding to the second normal signal, determine whether the connected domain length of the laser image is greater than the connectivity threshold. If so, continue to extract the maximum pixel value in each column direction and form a column maximum value collection curve. If not, control the focusing device to end focusing.
8. A defect detection control method according to claim 7, characterized in that: If the length of the connected domain of the laser image is greater than the connectivity threshold, the laser image is divided into several sub-areas and the pixel average value of each sub-area is counted to analyze whether the difference between the maximum pixel average value and the minimum pixel average value is less than the image difference threshold. If so, the focusing device is controlled to continue focusing; if not, the focusing device is controlled to end focusing, instead of extracting the maximum pixel value in each column direction and forming a column maximum value collection curve.
9. A defect detection control system, characterized in that: include: An image analysis module, used to determine whether the centroid of the laser image belongs to the centroid threshold range, and if so, output a first normal signal to control the focusing device to continue focusing, and if not, output a first abnormal signal to control the focusing device to end focusing; An energy analysis module, used to analyze whether the laser energy corresponding to the first normal signal belongs to the energy threshold range, and if so, output a second normal signal to control the focusing device to continue focusing, and if not, output a second abnormal signal to control the focusing device to end focusing; A curve analysis module is used to collect the laser image corresponding to the second normal signal, extract the maximum pixel value in each column direction and form a column maximum value collection curve to reflect the brightness change trend of the laser image in the row direction; The peak-finding analysis module is used to analyze whether there are continuous peaks with widths exceeding a width threshold in the column maximum value collection curve. If so, the focusing device is controlled to continue focusing; if not, the focusing device is controlled to end focusing.
10. A computer-readable storage medium comprising a computer program, characterized in that: When the computer program is executed by a processor, the control method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
ROI positioning method and system based on laser automatic focusing, medium and electronic equipment
CN120825631A