Image processing method and system, device and storage medium

CN117392158BActive Publication Date: 2026-08-11SKYVERSE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-01
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0004]但是,上述边缘提取方法的精度仍有待提高,从而导致产品的定位精度下降

Benefits of technology

[0011]本发明实施例提供的图像处理方法中,根据待测图像获取梯度角度图,并基于各个第一点的梯度角度值获得目标特征图,且在目标特征图中,待测物边缘处的第二点的目标特征值大于或者小于与边缘处的第二点相邻的第二点的目标特征值,随后根据目标特征图获取待测物的边缘轮廓;其中,由于待测物的边缘轮廓所对应的梯度角度值较为统一,通常位于特定的角度范围内,因此,基于各个第一点的梯度角度值获得目标特征图,有利于起到降噪的作用,也即有利于降低将待测物内部的图案、背景图案或其他噪声图案误判为待测物的边缘的概率,能够有利于更好地区分待测物边缘处的第二点以及与边缘处第二点相邻的第二点,从而在对目标特征图进行边缘提取时,能够考虑边缘的方向特征,这有利于准确提取出待测物的边缘轮廓,且具有较高的通用性和鲁棒性,同时,基于对待测物进行成像后获得的待测图像来进行图像处理,以实现提取轮廓对目的,也有利于提高提取待测物的边缘轮廓的效率,相应有利于满足机台大规模自动化处理的需求,有效提升机台的产出。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117392158B_ABST
    Figure CN117392158B_ABST
Patent Text Reader

Abstract

An image processing method, system, device, and storage medium are disclosed. The method includes: acquiring a test image of an object at its edge location; acquiring a gradient angle map based on the test image, including the correspondence between the position of each first point and the gradient angle value; obtaining target feature values ​​based on the gradient angle values ​​to obtain a target feature map representing the correspondence between the position of a second point and the target feature value, wherein the target feature value of the second point at the edge of the object is greater than or less than the target feature value of the second point adjacent to the second point at the edge; and acquiring the second point at the edge of the object based on the target feature map to obtain the edge contour of the object. Obtaining the target feature map based on the gradient angle value is beneficial for noise reduction, thereby accurately extracting the edge contour of the object during edge extraction. It also has high versatility and robustness. Furthermore, extracting the contour through image processing improves the efficiency of edge contour extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of optical detection technology, and in particular to an image processing method, system, device and storage medium. Background Technology

[0002] In the field of optical inspection technology, extracting the edge contour of a regularly shaped object to determine its center position is an important step, which is often used in applications such as target recognition and precise product positioning.

[0003] Taking precise product positioning as an example, most production equipment is currently automated. It typically controls the position of the product inside the equipment through mechanical control. For example, the production equipment uses a robotic arm to transport the product and uses sensors to detect the product's edges. A linear CCD sensor collects edge data when the product is rotating, and the center of the product is fitted using the collected edge data. The feedback data is then used to control the movement of the robotic arm, so that the product is placed on the chuck and positioned at the preset location.

[0004] However, the accuracy of the aforementioned edge extraction method still needs to be improved, which leads to a decrease in the positioning accuracy of the product. Summary of the Invention

[0005] The problem solved by the embodiments of the present invention is to provide an image processing method, system, device and storage medium that is beneficial for accurately extracting the edge contour of the object to be measured, and has high versatility and robustness.

[0006] To address the aforementioned problems, this invention provides an image processing method, comprising: acquiring a test image of an object at an edge location, the test image containing the edge contour of the object; acquiring a gradient angle map based on the test image, the gradient angle map including the correspondence between the position of each first point and the gradient angle value, wherein the position of each first point in the gradient angle map corresponds one-to-one with the position of a pixel in the test image, and the gradient angle value is the angle between the gradient direction of the pixel and a preset reference direction; obtaining target feature values ​​based on the gradient angle values ​​of each first point to obtain a target feature map representing the correspondence between the position of a second point and the target feature value, the target feature value representing the angle between the gradient direction of the pixel and the preset reference direction, and wherein the target feature value of the second point at the edge of the object is greater than or less than the target feature value of the second point adjacent to the second point at the edge; and acquiring the second point at the edge of the object based on the target feature map to obtain the edge contour of the object.

[0007] Accordingly, this embodiment of the invention also provides an image processing system for executing the image processing method of this embodiment of the invention. The image processing system includes: an image acquisition module for acquiring a test image of an object at an edge position, the test image containing the edge contour of the object; a gradient information acquisition module for acquiring a gradient angle map based on the test image, the gradient angle map including the correspondence between the position of each first point and the gradient angle value, and the position of the first point of the gradient angle map corresponds one-to-one with the position of the pixel in the test image, the gradient angle value being the angle between the gradient direction of the pixel and a preset reference direction; a processing module for obtaining target feature values ​​based on the gradient angle values ​​of each first point to obtain a target feature map representing the correspondence between the position of the second point and the target feature value, the target feature value representing the angle between the gradient direction of the pixel and the preset reference direction, and the target feature value of the second point at the edge of the object being greater than or less than the target feature value of the second point adjacent to the second point at the edge; and an edge extraction module for acquiring the second point at the edge of the object being based on the target feature map to obtain the edge contour of the object being tested.

[0008] Accordingly, embodiments of the present invention also provide an apparatus, including at least one memory and at least one processor, wherein the memory stores one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the image processing method described in the embodiments of the present invention.

[0009] Accordingly, embodiments of the present invention also provide a storage medium storing one or more computer instructions, which are used to implement the image processing method described in the embodiments of the present invention.

[0010] Compared with the prior art, the technical solution of the embodiments of the present invention has the following advantages:

[0011] In the image processing method provided by this invention, a gradient angle map is obtained from the image to be tested, and a target feature map is obtained based on the gradient angle values ​​of each first point. In the target feature map, the target feature value of a second point at the edge of the object to be tested is greater than or less than the target feature value of a second point adjacent to the second point at the edge. Then, the edge contour of the object to be tested is obtained based on the target feature map. Since the gradient angle values ​​corresponding to the edge contour of the object to be tested are relatively uniform and usually fall within a specific angle range, obtaining the target feature map based on the gradient angle values ​​of each first point is beneficial for noise reduction, that is, it helps to reduce the noise within the object to be tested. The probability of misidentifying patterns, background patterns, or other noise patterns as edges of the test object can help to better distinguish the second point at the edge of the test object and the second point adjacent to the second point at the edge. Therefore, when extracting edges from the target feature map, the directional features of the edges can be considered. This is beneficial for accurately extracting the edge contour of the test object and has high versatility and robustness. At the same time, image processing based on the test image obtained after imaging the test object to achieve the purpose of contour extraction also helps to improve the efficiency of extracting the edge contour of the test object. Correspondingly, it is beneficial to meet the needs of large-scale automated processing of the machine and effectively improve the output of the machine.

[0012] In the optional scheme, before obtaining the target feature map representing the correspondence between the position of the second point and the target feature value based on the gradient angle value of each first point, a gradient amplitude map is also obtained based on the image to be tested. The gradient amplitude map includes the correspondence between the position of each third point and the amplitude of the gray-level gradient, and the gradient amplitude map serves as the first feature map. Feature value transformation processing is performed on each first point of the gradient angle map to obtain the corresponding angle feature value, thereby obtaining the second feature map of the correspondence between the fourth point and the angle feature value. The first feature map and the second feature map are then weighted to obtain the target feature map. The weighting is used to make the gradient amplitude of the weighted value at the edge of the object to be tested in the weighted map greater than the gradient amplitude of the angle feature value of the pixel at the edge of the object to be tested in the second feature map. The combination of using the gradient amplitude map for weighting is beneficial to further reduce noise. Moreover, when obtaining the edge contour, the amplitude feature and direction feature of the edge can be considered simultaneously, which is beneficial to further improve the accuracy, versatility and robustness of extracting the edge contour of the object to be tested. Attached Figure Description

[0013] Figure 1 This is a flowchart of an embodiment of the image processing method of the present invention;

[0014] Figure 2 yes Figure 1 In step S1, a schematic diagram of an embodiment of the test object is shown;

[0015] Figure 3 yes Figure 1 In step S1, a schematic diagram of an embodiment of the image to be tested is shown;

[0016] Figure 4 yes Figure 1 In step S15, a schematic diagram of the rotated image 200 is shown.

[0017] Figure 5 This is a diagram illustrating how to obtain a continuous path from the start row to the end row;

[0018] Figure 6 This is a functional block diagram of an embodiment of the image processing system of the present invention;

[0019] Figure 7 This is a hardware structure diagram of a device provided in an embodiment of the present invention. Detailed Implementation

[0020] As can be seen from the background technology, the accuracy of current edge extraction methods still needs to be improved.

[0021] Research has revealed that in current edge extraction processes, uneven lighting may occur for different lighting systems, product materials, and patterns. Furthermore, factors such as complex patterns inside the product, surface dirt, or low reflectivity can easily lead to poor edge contrast, resulting in incorrect edge contour extraction.

[0022] To address the aforementioned technical problems, embodiments of the present invention provide an image processing method. (See reference...) Figure 1 The flowchart illustrates an embodiment of the image processing method of the present invention. The image processing method described in this embodiment includes the following basic steps:

[0023] Step S1: Obtain the image of the object to be tested at the edge position, wherein the image of the object to be tested contains the image of the edge contour of the object to be tested;

[0024] Step S2: Obtain a gradient angle map based on the image to be tested. The gradient angle map includes the correspondence between the position of each first point and the gradient angle value. The position of the first point in the gradient angle map corresponds one-to-one with the position of the pixel in the image to be tested. The gradient angle value is the angle between the gradient direction of the pixel and the preset reference direction.

[0025] Step S3: Obtain target feature values ​​based on the gradient angle values ​​of each of the first points to obtain a target feature map that represents the correspondence between the position of the second point and the target feature values. The target feature values ​​are used to represent the angle between the gradient direction of the pixel and the preset reference direction. The target feature value of the second point at the edge of the object to be tested is greater than or less than the target feature value of the second point adjacent to the second point at the edge.

[0026] Step S4: Based on the target feature map, obtain the second point at the edge of the object to be tested, and obtain the edge contour of the object to be tested.

[0027] Since the gradient angles corresponding to the edge contours of the test object are relatively uniform and usually fall within a specific angle range, obtaining the target feature map based on the gradient angle values ​​of each first point is beneficial for noise reduction. This reduces the probability of misjudging patterns, background patterns, or other noise patterns inside the test object as its edges. It also helps to better distinguish the second point at the edge of the test object and the second point adjacent to the second point at the edge. Therefore, when extracting edges from the target feature map, the directional features of the edges can be considered, which is beneficial for accurately extracting the edge contours of the test object and has high versatility and robustness. At the same time, image processing based on the test image obtained after imaging the test object to achieve the goal of contour extraction also helps to improve the efficiency of extracting the edge contours of the test object. Consequently, it is beneficial to meet the needs of large-scale automated processing of the machine and effectively improve the output of the machine.

[0028] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0029] Reference Figures 1 to 3 Execute step S1 to obtain the test image 200 of the test object 100 at the edge position 100L, the test image 200 containing the edge contour of the test object 100.

[0030] The image to be tested 200 contains an image of the edge contour of the object to be tested 100, so that the edge contour of the object to be tested 100 can be extracted by image processing of the image to be tested 200.

[0031] In this embodiment, the test object 100 is circular. In other embodiments, depending on the specific type of the test object, it may be other shapes, such as square. As an example, the test object 100 is a wafer. In other embodiments, the test object may also be other products whose edge contours need to be extracted.

[0032] In this embodiment, acquiring the test image 200 of the test object 100 at the edge position 100L includes: selecting the edge position 100L according to the preset initial center S1 and preset radius R of the test object 100, wherein the distance between the edge position 100L and the preset initial center S1 is the preset radius R; and acquiring the test image 200 of the test object 100 at the edge position 100L.

[0033] It is understandable that the preset initial center here is the same as the preset initial circle center. It should be noted that the position of the preset initial center S1 of the object to be measured 100 is the preset position of the mechanical positioning.

[0034] In one specific embodiment, the image processing method is used to determine the center of the object under test 100 using the extracted edge contours of the object under test 100, thereby ensuring the positioning accuracy of the object under test 100 in the device. For example, in semiconductor manufacturing and metrology, determining the wafer center is an important step for accurately aligning various parts of the wafer, thereby ensuring that when the position of the pattern under test is further determined based on the known relative position vector relationship between the wafer center and the pattern under test, its positioning accuracy is controlled within a certain range.

[0035] Therefore, acquiring the test image 200 of the test object 100 at the edge position 100L includes: acquiring the test image 200 of the test object 100 at multiple different edge positions 100L.

[0036] In this embodiment, since the object to be tested 100 is circular, in order to improve the accuracy of determining the actual center of the object to be tested 100, at least 3 points are usually needed to determine the center. Therefore, the number of edge positions 100L is greater than or equal to 3.

[0037] Specifically, multiple edge positions 100L are evenly distributed along the edge of the object to be measured 100. This helps to further improve the accuracy of center determination. For example, in this embodiment, taking three edge positions 100L as an example, the angle β between the lines connecting adjacent edge positions 100L and the preset initial center S1 of the object to be measured is 120°. In other embodiments, when there are four edge positions, the lines connecting each edge position and the preset initial center of the object to be measured form a 90° angle with each other.

[0038] As an example, the image to be tested 200 is rectangular in shape and is a dark-field image. In other embodiments, the image to be tested may also be a bright-field image.

[0039] In this embodiment, a detection system is used to acquire a test image 200 of the object under test 100 at its edge position. The detection system includes an image acquisition module and a motion platform. The motion platform supports the object under test 100 and enables relative movement between the image acquisition module and the object under test 100. Accordingly, after acquiring the test image 200 of the object under test 100 at its edge position 100L, the coordinates of each pixel of the test image 200 at the edge position 100L in the coordinate system of the motion platform can be obtained.

[0040] Reference Figure 1Step S2 is executed to obtain a gradient angle map based on the image to be tested 200. The gradient angle map includes the correspondence between the position of each first point and the gradient angle value. The position of the first point of the gradient angle map corresponds one-to-one with the position of the pixel in the image to be tested. The gradient angle value is the angle between the gradient direction of the pixel and the preset reference direction.

[0041] By obtaining the gradient angle map, the target feature value related to the gradient angle value can be obtained based on the gradient angle value of each first point, so as to obtain the target feature map that represents the correspondence between the position of the second point and the target feature value.

[0042] In one specific embodiment, by acquiring a gradient angle map, and then using the threshold condition of the gradient angle value as a standard to filter candidate edge points, the gradient angle map is converted into a binary map, thereby distinguishing the second point at the edge of the test object 100 and the second point adjacent to the second point at the edge in the target feature map.

[0043] In this embodiment, step S2 further includes: obtaining a gradient magnitude map based on the image to be tested 200. The gradient magnitude map includes the correspondence between the position of each third point and the magnitude of the gray-level gradient, and the gradient magnitude map serves as the first feature map.

[0044] By obtaining the gradient magnitude map, we prepare for the subsequent weighting of the second feature map and the gradient magnitude map to obtain the target feature map. It is understood that both the gradient magnitude map and the gradient angle map are related to the pixel positions of 200 pixels in the image under test.

[0045] In this embodiment, obtaining the gradient magnitude map and gradient angle map of the image to be tested 200 includes: obtaining the gradient magnitude map and gradient angle map of each image to be tested 200.

[0046] In one specific embodiment, in the target feature map, the target feature value of the second point at the edge of the object to be tested 100 has the minimum value. Therefore, the gradient magnitude map is an inverse magnitude map, and the magnitude of each third point in the inverse magnitude map is negatively correlated with the gradient magnitude of the corresponding pixel point of the image to be tested 200.

[0047] Specifically, obtaining the gradient magnitude map based on the image to be tested 200 includes: obtaining the gradient magnitude of each pixel in the image to be tested 200 to obtain a positive magnitude map, wherein the magnitude of each fifth point in the positive magnitude map is positively correlated with the gradient magnitude of the corresponding pixel in the image to be tested; inverting the positive magnitude map to obtain the inverted magnitude map, wherein the inversion process includes: subtracting the gradient magnitude of each fifth point in the positive magnitude map from a preset value to obtain the corresponding inverted magnitude value, thereby obtaining the inverted magnitude map; wherein the preset value is greater than or equal to the maximum value among the gradient magnitudes of each fifth point.

[0048] In this embodiment, taking the image to be tested, 200, as an 8-bit wide image (grayscale range from 0 to 255), the preset value is greater than or equal to 200. This preset value is close to the maximum grayscale value of the 8-bit wide image (i.e., grayscale value 255). By subtracting the gradient magnitude of each fifth point from the preset value, a smaller inverse magnitude value can be obtained for the first point with a larger gradient magnitude.

[0049] In one specific embodiment, the preset value is equal to the maximum grayscale value of an 8-bit wide image, that is, the preset value is equal to 255.

[0050] It should be noted that in some other embodiments, depending on the actual situation, the preset value may be less than the maximum value, or the preset value may be zero.

[0051] In other embodiments, the gradient magnitude map can also be a positive magnitude map, in which the magnitude of each third point is positively correlated with the gradient magnitude of the corresponding pixel in the image under test.

[0052] In this embodiment, the gradient angle and gradient magnitude of each pixel are obtained based on the corresponding grayscale gradient value. Specifically, for any pixel, the grayscale gradient value in the X direction is G. x The gray-level gradient value in the Y direction is G. y The gradient magnitude of the pixel is The gradient angle value of a pixel is arctan(G). x / G y ), where the X direction is orthogonal to the Y direction.

[0053] As an example, the gradient angle is defined as ranging from -180° to 180°, meaning the gradient angle value is greater than or equal to -180° and less than or equal to 180°. In other embodiments, other definitions may be used, such as defining it as 0° to 360°.

[0054] In this embodiment, the Sobel operator is used to calculate the pixel gradient of each pixel in the image under test 200 to obtain the positive magnitude map and gradient angle map of the image under test 200.

[0055] By using the Sobel operator in both the X and Y directions, gradient magnitude and gradient angle information can be calculated simultaneously. This can be achieved by only determining the size of the convolution kernel, without the need for additional parameters, which facilitates the quick and convenient acquisition of positive magnitude maps and gradient angle maps.

[0056] Accordingly, the Sobel operator has n*n convolution kernels in both the X and Y directions. Increasing the kernel size improves noise reduction; a larger kernel results in smoother texture, which helps filter out noise from individual pixels, reducing sensitivity to noise and making it easier to find wider edges. However, if n is too large, the edges of the object 100 in the image 200 may be mistaken for noise and filtered out, especially when the edges are thin. Therefore, in this embodiment, n is an integer from 7 to 9.

[0057] In this embodiment, the image to be tested 200 includes multiple image edges (not shown), and among the multiple image edges, there is only one background image edge (not shown), and the background image edge is completely covered by the background image; accordingly, obtaining the target feature value based on the gradient angle value of each first point includes: obtaining the background image edge; obtaining a preset reference direction according to the background image edge, so that the preset reference direction and the background image edge have a second preset angle.

[0058] The grayscale values ​​of the pixels in the background image are usually the same, so it is easy to identify the position of the background image. Accordingly, using the background image as a reference object makes it easier to determine the preset reference direction and improve the uniformity of the preset reference direction.

[0059] In this embodiment, a preset reference direction (such as...) Figure 4 (As shown in the X direction) is the extension direction perpendicular to the edge of the background image (e.g.) Figure 4 shown in the Y direction).

[0060] As an example, the image to be tested 200 includes one or more regions to be tested (not shown). Before obtaining the gradient angle map from the image to be tested 200, the image processing method further includes: performing step S14 to set a preset reference direction for each region to be tested. Setting a preset reference direction for each region to be tested includes: providing a reference image, the edge of the object to be tested in the reference image including the reference region; matching the reference image with the image to be tested 200 to ensure a one-to-one correspondence between the reference region and the region to be tested in the image to be tested; obtaining the preset reference direction of the region to be tested corresponding to the reference region based on the gradient direction of one or more pixels on the edge of the object to be tested 100 in the reference region, wherein the preset reference direction is the gradient direction of any pixel on the edge of the object to be tested in the reference region or a weighted sum of the gradient directions of multiple pixels on the edge of the object to be tested in the reference region.

[0061] By employing image matching, it is possible to quickly and accurately determine the preset reference orientation of the image 200 to be tested.

[0062] Accordingly, obtaining the gradient angle map based on the image to be tested 200 includes: performing angle value acquisition processing on each area to be tested to obtain the gradient angle value of each pixel in the image to be tested. The angle value acquisition processing includes: obtaining the angle between the gradient direction of each pixel in the area to be tested and the corresponding preset reference direction to obtain the gradient angle value of each pixel in the area to be tested.

[0063] Reference Figure 1 and in conjunction with references Figure 4 Before acquiring the gradient magnitude map and gradient angle map of the image to be tested 200, the method further includes: performing step S15 to rotate the image to be tested 200 so that the edge contour image of the object to be tested 100 extends along a preset direction range.

[0064] The edge contour image of the test object 100 extends along a preset direction range, making the grayscale of the pattern on both sides of the edge of the test object 100 more uniform and reducing the probability of noise in too many directions.

[0065] Furthermore, when performing edge extraction on the target feature map, the starting and ending rows are usually determined first. The direction from the starting row to the ending row is taken as the reference direction. Then, the image to be tested 200 is rotated so that the same reference direction can be used for edge extraction in the future.

[0066] Furthermore, a gradient angle map is subsequently obtained based on the angle between the gradient direction of each pixel in the rotated image 200 and the preset reference direction. Therefore, by extending the edge contour image of the object 100 along the preset direction range, it is convenient to obtain the gradient angle value using the same calculation standard.

[0067] like Figure 4 As shown, Figure 4 (a) is Figure 3 (a) Schematic diagram after rotation Figure 4 (b) is Figure 3 (b) Schematic diagram after rotation Figure 4 (c) is Figure 3 (c) A schematic diagram after rotation. The image 200 to be tested is rotated so that the edge contour image of the object to be tested 100 is extended in the vertical direction.

[0068] In this embodiment, the image to be tested 200 is rotated so that the edge contour image of the object to be tested 100 extends along a preset direction range, including: obtaining the background image edge; rotating the background image edge so that the background image edge faces the preset direction, and the preset direction has a first preset angle with the preset reference direction.

[0069] Using the background image as a reference object makes it easy to determine the rotation method. Moreover, by aligning the edges of the background image with a preset direction, which has a first preset angle with the preset reference direction, the area of ​​the object to be tested 100 in the image to be tested 200 is located on a fixed side. This makes the image of the object to be tested 100 more uniform in the area of ​​the image to be tested 200, thereby reducing the impact of inconsistent area positions on the detection parameters in the target feature map.

[0070] It should be noted that the first preset included angle can be 0°, 90° or other angle values.

[0071] For example, in this embodiment, after rotation processing, the edge contour image of the object to be tested 100 is extended in the vertical direction, and the pattern area of ​​the object to be tested 100 in the image to be tested 200 is located on the right side of the image to be tested 200 along the X direction.

[0072] In other embodiments, after rotating the image to be tested, the edge contour image of the object to be tested extends in the vertical direction, and the pattern area of ​​the object to be tested in the image to be tested is located on the left side of the image to be tested along the X direction. In other embodiments, after rotating the image to be tested, the edge contour image of the object to be tested extends in the horizontal direction, and the pattern area of ​​the object to be tested in the image to be tested is located on the upper or lower side of the image to be tested along the Y direction.

[0073] Specifically, obtaining the background image edge includes: obtaining the grayscale statistical values ​​of each image edge of the test image 200, wherein the grayscale statistical values ​​of the image edge include: the average grayscale value of each pixel on the image edge, or the sum of the average grayscale value of each pixel on the image edge and the first maximum value; obtaining the image edge with the second maximum value of the grayscale statistical value to obtain the background image edge; wherein, when the test image 200 is a dark field image, the first maximum value is the maximum value and the second maximum value is the minimum value; when the test image 200 is a bright field image, the first maximum value is the minimum value and the second maximum value is the maximum value.

[0074] The background image is usually located in the edge region of the image under test. Therefore, it is necessary to calculate the grayscale statistics of the pixels in the preset width region of the outermost edge.

[0075] When the image under test is a dark field image, the background image is very dark. Therefore, the position corresponding to the minimum value in the grayscale statistics is selected as the position of the background image.

[0076] Among them, the grayscale statistics include the average grayscale value of each pixel, thereby improving the robustness of the statistical method. For example, it reduces the impact of noise in a single pixel on the accuracy of the grayscale statistics, thus improving the accuracy of the grayscale statistics.

[0077] Furthermore, when the image under test 200 is a dark field image, when the gray-scale statistics include the sum of the average gray-scale value of each pixel on the image edge and the first maximum value, the first maximum value is the maximum value, that is, the maximum gray-scale value is included. In other words, for each image edge, the gray-scale value of the brightest pixel is included. If the gray-scale statistics of a certain image edge is still the minimum, it means that the image edge is darker than the other image edges, which helps to improve the accuracy of determining the location of the background image.

[0078] Similarly, in other embodiments, when the image to be tested is a bright field image, the background image is very bright. Therefore, the position corresponding to the maximum value in the grayscale statistics is selected as the background image position. Specifically, when the grayscale statistics include the sum of the average grayscale value of each pixel on the image edge and the first maximum value, the first maximum value is the minimum value. Including the minimum grayscale value in the statistics, if the grayscale statistics of a certain image edge are still the maximum, it indicates that the image edge is brighter than other image edges, which helps improve the accuracy of determining the background image position.

[0079] It should be noted that the preset width of the image edge should not be too small or too large. If the preset width of the image edge is too small, the grayscale statistical values ​​are more susceptible to noise, which is detrimental to improving the accuracy of the grayscale statistical values. If the preset width of the image edge is too large, it is easy to include the pixels of the pattern of the object under test 100 in the statistics, which can easily reduce the accuracy of the grayscale statistical values. Therefore, in this embodiment, the preset width of the image edge is the sum of the widths of 5 to 10 pixels.

[0080] Accordingly, in this embodiment, after rotating the image to be tested 200, a gradient angle map is obtained based on the angle between the gradient direction of each pixel in the image to be tested 200 and the preset reference direction.

[0081] refer to Figure 1 Step S3 is executed to obtain target feature values ​​based on the gradient angle values ​​of each first point, so as to obtain a target feature map that represents the correspondence between the position of the second point and the target feature value. The target feature value is used to represent the angle between the gradient direction of the pixel and the preset reference direction. The target feature value of the second point at the edge of the object to be tested 100 is greater than or less than the target feature value of the second point adjacent to the second point at the edge.

[0082] Since the gradient angles corresponding to the edge contours of the test object 100 are relatively uniform and usually fall within a specific angle range, obtaining the target feature map based on the gradient angle values ​​of each first point is beneficial for noise reduction. This means that it helps to reduce the probability of misjudging patterns, background patterns, or other noise patterns inside the test object 100 as edges of the test object 100. It also helps to better distinguish the second point at the edge of the test object and the second point adjacent to the second point at the edge in the target feature map. Thus, when extracting edges from the target feature map, the directional features of the edges can be considered. This is beneficial for accurately extracting the edge contours of the test object and has high versatility and robustness.

[0083] Meanwhile, by performing image processing on the image to be tested 200 to achieve the purpose of extracting the contour, it is also beneficial to improve the efficiency of extracting the edge contour of the object to be tested 100, which in turn helps to meet the needs of large-scale automated processing of the machine and effectively improves the output of the machine.

[0084] In this embodiment, in the target feature map, the target feature value of the second point at the edge of the object to be tested 100 has a minimum or maximum value. Therefore, when the weighted map is subsequently used for edge extraction, the edge contour of the object to be tested 100 can be obtained by extracting the target feature value and the path with the value of the third maximum value.

[0085] Specifically, obtaining target feature values ​​based on the gradient angle values ​​of each first point to obtain a target feature map representing the correspondence between the position of the second point in the image under test and the target feature values ​​includes: setting multiple angle interval ranges and setting an angle feature value for each angle interval range, wherein the multiple angle interval ranges do not overlap, and each angle feature value monotonically increases or decreases as the corresponding angle region range increases; performing feature value transformation processing on each first point of the gradient angle map to obtain the corresponding angle feature value, thereby obtaining a second feature map representing the correspondence between the fourth point and the angle feature value.

[0086] The feature value transformation process includes: obtaining the angle interval range where the gradient angle value of each first point is located, as a candidate angle interval range; and using the angle feature value corresponding to the candidate angle interval range as the angle feature value corresponding to the first point.

[0087] By transforming the eigenvalues, the gradient angle values ​​are first converted into angle eigenvalues, which facilitates the subsequent weighting of the first and second feature maps.

[0088] Moreover, in the step of setting multiple angle ranges, the multiple angle ranges do not overlap, and the feature values ​​of each angle increase or decrease monotonically as the corresponding angle range increases, so that the second feature map can be used to represent the angle between the gradient direction of the pixel and the preset reference direction, that is, it is correlated with the gradient angle value.

[0089] In this embodiment, there are two angle ranges; the two angle ranges are: the absolute value of the gradient angle is greater than the threshold angle, and the absolute value of the gradient angle is less than or equal to the threshold angle; the angle feature values ​​of the two angle ranges are 1 and 0, respectively; the gradient angle is greater than or equal to -180° and less than or equal to 180°.

[0090] In other words, the first point of each gradient angle map is processed by eigenvalue transformation to obtain the corresponding angle eigenvalue, thus obtaining a binary map.

[0091] In this embodiment, the threshold angle is arctan(H / d), where d is the width of the image 200 to be tested, and H is the length of the image 200 to be tested, with the width being less than the length.

[0092] In the extreme case, the two endpoints of the edge contour line of the object under test 100 are located at the vertices of the image under test 200 along the diagonal direction. Therefore, if the edge contour line of the object under test 100 is regarded as a straight line, the minimum absolute value of the gradient angle value at the first point on the edge of the object under test 100 is arctan(H / d).

[0093] In this embodiment, the binary image includes a first type of point and a second type of point. The edge of the object to be measured 100 has a second type of point, and the angle feature value of one type of point is 0 and the angle feature value of the other type is 1. This makes it easy for the first point with an angle feature value of 0 to contribute 0 to the weighted value, and the first point with an angle feature value of 1 to have a larger weighted value. As a result, the weighted value of the second point at the edge of the object to be measured 100 in the target feature image has a minimum or maximum value.

[0094] It should be noted that after obtaining the binary image, before subsequent weighting, the following steps are also included: performing dilation processing on the binary image. The dilation processing includes: traversing all second-class points, and when there is a first-class point among the points adjacent to the second-class point along the dilation direction, setting the angle feature value of the second-class point to the angle feature value corresponding to the first-class point. The angle between the dilation direction and the extension direction of the edge contour of the object to be measured 100 is less than 20°.

[0095] By performing dilation processing, the accuracy of dividing the fourth point and the remaining fourth point at the edge of the object under test 100 can be improved, and the interference of the internal pattern of the object under test 100 can be reduced. This reduces the probability of selecting the second point inside the object under test 100 based on the target feature value when the edge contour is subsequently based on the shortest path algorithm.

[0096] Furthermore, since the image processing method is used to extract the edge contour of the object to be tested 100, and the edge contour of the object to be tested 100 usually has an extension direction, the dilation process within the range of the edge contour extension direction is more effective in reducing interference. Therefore, the angle between the dilation direction and the extension direction of the edge contour of the object to be tested 100 is less than 20°.

[0097] Specifically, the expansion direction of each second type of point is the same; the expansion direction of the second type of point can be parallel to the tangent direction at any position of the edge contour of the object to be measured 100, or the expansion direction of the second type of point can be parallel to the tangent direction of the edge contour at the position of the second type of point.

[0098] It should be noted that for Type II points at the true edge, the probability of Type I points existing around them is low. Therefore, even with dilation, the impact on Type II points at the edge is small.

[0099] In this embodiment, the target feature value is obtained based on the gradient angle value of each first point to obtain a target feature map representing the correspondence between the position of the second point and the target feature value. The method further includes: weighting the first feature map and the second feature map to obtain a weighted value for each second point. The weighted value is used as the target feature value to obtain a target feature map representing the correspondence between the position of the second point and the target feature value. The weighting is used to make the gradient magnitude of the weighted value at the edge of the object to be measured in the weighted map greater than the gradient magnitude of the angle feature value at the edge of the object to be measured in the second feature map.

[0100] Combining gradient magnitude maps for weighting helps to further reduce noise (for example, it helps to reduce the probability of misidentifying patterns, background patterns or other noise patterns inside the test object 100 as edges of the test object 100). Moreover, when extracting edge contours in the subsequent process, the magnitude and direction features of the edges can be considered simultaneously, which helps to improve the accuracy, versatility and robustness of extracting the edge contours of the test object 100.

[0101] Meanwhile, the weighting is used to make the gradient magnitude of the weighted value at the edge of the test object 100 in the target feature map greater than the gradient magnitude of the angular feature value of the pixel at the edge of the test object 100 in the second feature map, thereby enhancing the prominence of the edge of the test object 100 in the target feature map, which facilitates subsequent edge extraction of the weighted map.

[0102] In this embodiment, after weighting the first feature map and the second feature map to obtain the target feature map, the target feature value of the second point at the edge 100 of the object to be measured has a minimum or maximum value.

[0103] In one specific embodiment, in the target feature map, the target feature value of the second point at the edge of the object to be tested 100 has the minimum value. Therefore, the gradient magnitude map is an inverse magnitude map. The magnitude of each third point in the inverse magnitude map is negatively correlated with the gradient magnitude of the corresponding pixel in the image to be tested. The angular feature value of the first type of point is 1, and the angular feature value of the second type of point is 0.

[0104] Since the gradient magnitude of pixels at the edge of the object 100 in the image 200 is usually large, an inverse magnitude map is obtained. This makes the magnitude of the third point at the edge of the object 100 smaller, which in turn makes the target feature value corresponding to the second point at the edge smaller in the target feature map. Since the angle feature value of the first type of point is 1 and the angle feature value of the second type of point is 0, it helps to minimize the magnitude of the third point at the edge of the object 100 in the first target feature map and the angle feature value of the first point at the edge of the object 100 in the second target feature map. This makes it easier to obtain the edge points of the edge contour of the object 100 using the shortest path method.

[0105] Specifically, the amplitude of the third point at the edge of the object 100 in the gradient amplitude diagram is a minimum value.

[0106] In this embodiment, during the weighting process of the binary image and the gradient magnitude image, the weight of the gradient magnitude image is less than the weight of the binary image.

[0107] Since the gradient magnitude map is an inverse magnitude map, the angular feature value of the first type of point is 1, and the angular feature value of the second type of point is 0. Since there are second type of points at the edge of the test object 100, the binary map is given a larger weight, so that the angular feature value of the first type of point contributes more to the weighted value, and the angular feature value of the second type of point contributes less to the weighted value. This makes the edge points of the test object 100 more prominent in the target feature map.

[0108] Specifically, when weighting the first feature map and the second feature map, the weighting is performed on the first target feature map and the second target feature map (i.e., the binary map) after dilation.

[0109] As an example, the weights of the first target feature map (i.e., the gradient magnitude map) are 0.1 to 0.3, and the weights of the second target feature map (i.e., the binary map) are 180 to 245.

[0110] The weight of the second target feature map is much greater than the weight of the first target feature map, thus increasing the impact of the binary image filtering and thereby filtering out most of the points that do not meet the angle requirements.

[0111] Specifically, when a pixel has a small amplitude in the first target feature map and an angular feature value of 0 in the binary map, the pixel has a small weighted value in the weighted map, and it is more likely to be an edge point of the object being measured. When a pixel has a large amplitude in the first target feature map and an angular feature value of 1 in the binary map, the pixel has a large weighted value in the weighted map. When a pixel has a small amplitude in the first target feature map and an angular feature value of 1 in the binary map, the pixel has a large weighted value in the weighted map. When a pixel has a large amplitude in the first target feature map and an angular feature value of 1 in the binary map, the pixel has a large weighted value in the weighted map.

[0112] It should be noted that in other embodiments, the weight of the first target feature map can be changed, and the weight of the second target feature map can be changed proportionally.

[0113] As an example, weighting the first target feature map and the second target feature map includes: calculating the weighted value corresponding to each pixel using the formula w(x,y)=w1*(255-mag(x,y))+w2*binary_orient(x,y), where w(x,y) is the weighted value corresponding to any pixel, 255-mag(x,y) is the magnitude of the pixel in the inverse magnitude map, mag(x,y) is the gradient magnitude of the pixel in the gradient magnitude map, binary_orient(x,y) is the angular feature value of the pixel in the binary map, w1 is the weight of the first target feature map, and w2 is the weight of the second target feature map, where w1 is from 0.1 to 0.3 and w2 is from 180 to 245.

[0114] Therefore, in this embodiment, the weighted value of the second point at the edge of the object to be tested 100 has a minimum value.

[0115] Based on the above mechanism, in some other embodiments, the target feature value of the second point at the edge of the object to be measured has the maximum value in the target feature map. Correspondingly, the gradient magnitude map is a positive magnitude map, and the magnitude of each third point in the positive magnitude map is positively correlated with the gradient magnitude of the corresponding pixel in the image to be measured; the angular feature value of the first type of point is 0, and the angular feature value of the second type of point is 1.

[0116] In other embodiments, the target feature map can be obtained without weighting, based on the actual features of the image to be tested, using only the gradient angle value.

[0117] Specifically, obtaining target feature values ​​based on the gradient angle values ​​of each first point to obtain a target feature map representing the correspondence between the position of the second point in the image under test and the target feature values ​​includes: setting multiple angle interval ranges and setting an angle feature value for each angle interval range, wherein the multiple angle interval ranges do not overlap, and each angle feature value monotonically increases or decreases as the corresponding angle region range increases; performing feature value transformation processing on each first point of the gradient angle map to obtain a corresponding angle feature value, wherein the angle feature value is used as the target feature value to obtain the target feature map representing the correspondence between the position of the second point and the angle feature value.

[0118] Since the target feature values ​​monotonically increase or decrease with the increase of the corresponding angular region range, the edge points of the object under test can also be highlighted. It can be understood that, in this embodiment, according to the contour characteristics of the image under test, two angular range ranges can also be set, and correspondingly, the correspondence between each second point and the target feature value is a binary image.

[0119] refer to Figure 1 Execute step S4 to obtain the second point at the edge of the object to be measured based on the target feature map, and obtain the edge contour of the object to be measured 100.

[0120] The target feature value is obtained based on the gradient angle value, and the target feature value of the second point at the edge of the test object 100 is greater than or less than the target feature value of the second point adjacent to the second point at the edge. Therefore, the second point at the edge of the test object can be easily extracted from the target feature map.

[0121] In this embodiment, the target feature value of the second point at the edge of the object to be tested 100 has the minimum value in the target feature map. Therefore, edge extraction is performed on the target feature map to minimize the target feature value and value of the second point through which the edge contour passes.

[0122] Furthermore, in this embodiment, the edge contours of the object to be tested 100 are acquired so that the center of the object to be tested 100 can be determined subsequently using multiple edge contours obtained by edge extraction. Therefore, edge extraction is performed on the target feature map corresponding to each image to be tested 200 to obtain multiple edge contours.

[0123] Specifically, based on the target feature map, a second point is obtained at the edge of the object to be tested 100 to obtain the edge contour of the object to be tested 100, including: determining a start row and an end row in the target feature map, with the direction from the start row to the end row as the reference direction; along the reference direction, obtaining a second point as a target point in each row from the start row to the end row, the sum of the target feature values ​​of the target points having a third maximum value, and the target points constituting the edge points at the edge of the object to be tested; wherein, in the target feature map, if the target feature value of the second point at the edge of the object to be tested 100 has a minimum value, the third maximum value is the minimum value; in the target feature map, if the target feature value of the second point at the edge of the object to be tested 100 has a maximum value, the third maximum value is the maximum value.

[0124] Since the target feature value of the second point at the edge of the object to be measured 100 has a minimum or maximum value in the target feature map, the edge point of the edge contour of the object to be measured 100 can be extracted by obtaining a continuous path from the start row to the end row along the reference direction, and the sum of the target feature values ​​of the second point passed through the continuous path has a third maximum value.

[0125] It should be noted that, before determining the start and end rows in the target feature map, edge extraction can also include: obtaining the region to be extracted in the target feature map, which includes multiple rows of second points, and each row of second points includes multiple second points. By obtaining the region to be extracted, the area where edge extraction needs to be performed can be determined, thereby improving the speed of edge extraction.

[0126] In this embodiment, the region to be extracted is the entire target feature map. In other embodiments, depending on the actual situation, the region to be extracted may also be a local region of the target feature map.

[0127] It should also be noted that, in this embodiment, based on the extension direction of the edge contour of the object to be tested 100, the area to be extracted includes multiple rows of pixels, where the row direction is the X direction (e.g., ...). Figure 4 As shown), the arrangement direction of the multiple rows of pixels is the Y direction (e.g., Figure 4 (As shown). In other embodiments, the row direction can also be the Y direction.

[0128] In this embodiment, obtaining a second point as a target point in each row from the starting row to the ending row includes: using the target feature value of each second point in the starting row as the accumulated value of the corresponding second point; sequentially traversing each row from the second row to the ending row, and performing pathfinding processing on the current row to obtain a position pointer table and the accumulated value of each second point in the ending row. The pathfinding processing includes: repeatedly performing the accumulation relationship acquisition process on each second point in the current row; wherein, the accumulation relationship acquisition process includes: obtaining each second point located within the search range of the previous row of the current second point as candidate points, the search range covering multiple candidate points in the previous row that are closest to the current second point; obtaining the target feature value of each candidate point relative to the current second point. The third maximum value among the eigenvalues ​​and the sum of the maximum and minimum values ​​is used to obtain the cumulative maximum and minimum value; the cumulative maximum and minimum value is used as the cumulative value of the current second point, and the positional relationship between the candidate second point corresponding to the cumulative maximum and minimum value and the current second point is recorded as the position pointer of the current second point; the cumulative relationship acquisition process is repeated for all second points in the current row to obtain the cumulative value of each second point and the positional relationship, and the correspondence between each second point and the positional relationship forms the position pointer table; the second point in the ending row with the third maximum value of the cumulative value is obtained as the ending position; the target point is obtained according to the position pointer table and the ending position, the target point passes through the ending position and the sum of the target eigenvalues ​​of the target point is equal to the cumulative value of the ending position.

[0129] In this embodiment, in the target feature map, the target feature value of the second point at the edge of the object to be tested 100 has the minimum value, therefore, the third maximum value is the minimum value.

[0130] In other embodiments, in the target feature map, the target feature value of the second point at the edge of the object to be measured has the maximum value, therefore, the third maximum value is the maximum value.

[0131] The starting and ending rows are determined in the target feature map, thereby determining the direction of pathfinding.

[0132] By determining the starting row, the target feature value of each second point in the starting row is used as the cumulative value of the corresponding second point, thus preparing for subsequent updates of the cumulative value.

[0133] As an example, the shortest path algorithm is used for edge extraction, including Dijkstra's algorithm. Based on Dijkstra's algorithm, a unique edge represented by a single pixel can be obtained, and it can obtain a globally optimal solution, which is not easily affected by local noise, thereby improving the accuracy of edge contour extraction.

[0134] In this embodiment, during the process of repeatedly accumulating the relationship of each second point in the current row, the search range of the i-th current second point covers the candidate points including the i-2 to i+2 second points in the previous row, where i represents the position of the current second point in the arrangement direction, which is perpendicular to the reference direction.

[0135] For any given second point, the search range not only includes one second point belonging to the four-neighborhood and two second points belonging to the diagonal neighborhood, but also one second point adjacent to each of the second points in the diagonal neighborhood, thus covering a total of five second points. This increases the search range and facilitates finding the path where the sum of the target feature values ​​equals the third maximum value. Furthermore, for any given second point, the candidate points covered by its search range are located in adjacent pixel rows along a preset reference direction, and the number of candidate second points is five. Therefore, the search range of any given second point will not cover an excessive number of second points, thereby improving computational efficiency.

[0136] The following combination Figure 5 The steps for obtaining a continuous path are explained in detail. Figure 5 (a) Represents target features Figure 1 A schematic diagram of the embodiment, Figure 5 (b) is a schematic diagram illustrating an embodiment of the process for obtaining and processing the cumulative relationship. Figure 5 (c) shows a schematic diagram of an embodiment of a position pointer table. Figure 5 (d) is a schematic diagram of an embodiment of obtaining the edge based on the position pointer table and the end position.

[0137] It should be noted that in this embodiment, the target feature map is a weighted map.

[0138] like Figure 5 As shown in (a), the target feature values ​​of each second point in the starting row are 24, 35, 255, 255 and 230, respectively. Then, the target feature values ​​of each second point in the starting row are used as the cumulative values ​​of the corresponding second points.

[0139] In the process of obtaining the continuous path from the starting line to the ending line, each line from the second line to the ending line is traversed in turn, and the path finding process is performed on the current line. The path finding process includes: obtaining the repeated accumulation relationship of each second point in the current line. Therefore, the second line is used as the current line for the first path finding process.

[0140] like Figure 5 (b) and Figure 5As shown in (c), the search range of the i-th current second point covers the candidate points from the (i-2)th to the (i+2)th second point in the previous row. Taking the second second point in the current row as the current second point, the target feature value of the current second point is 12. The target feature values ​​of the candidate points of the current second point are 24, 35, 255, and 255, respectively. Therefore, the sum of the target feature values ​​of each candidate point and the current second point are 36, 47, 267, and 267, respectively. The cumulative maximum and minimum value is 36, and this cumulative maximum and minimum value of 36 is used as the cumulative value of the current second point. Similarly, when the third second point in the current row is taken as the current second point, the target feature value of the current second point is 26. The target feature values ​​of the candidate points for the second point are 24, 35, 255, 255 and 230 respectively. Therefore, the sum of the target feature values ​​of each candidate second point and the current second point are 50, 61, 281, 281 and 256 respectively, resulting in a cumulative maximum value of 50. This cumulative maximum value of 50 is then used as the cumulative value of the current second point. When the fourth second point in the current row is taken as the current second point, the target feature value of the current second point is 255. The target feature values ​​of the candidate points for the current second point are 35, 255, 255 and 230 respectively. Therefore, the sum of the target feature values ​​of each candidate point and the current second point are 290, 510, 510 and 485 respectively, resulting in a cumulative maximum value of 290.

[0141] Similarly, each row from the second row to the end row is traversed sequentially. Path finding is performed on the current row. During the path finding process, the cumulative relationship of each second point in the current row is repeatedly obtained and processed. The positional relationship between the candidate point corresponding to the maximum and minimum cumulative value and the current second point is recorded as the position pointer of the current second point. This continues until the second point in the end row with the third maximum or minimum cumulative value is obtained as the end position. Then, the target point is obtained according to the position pointer table and the end position. The target point passes through the end position and the sum of the target feature values ​​of the target point is equal to the cumulative value of the end position.

[0142] Here, the search range of the i-th current second point includes the candidate points from the (i-2)-th to the (i+2)-th second points in the previous row, where i represents the position of the current second point in the arrangement direction. Therefore... Figure 6 The numbers in (c) represent the relative positional relationship between the candidate point corresponding to the cumulative maximum and minimum values ​​and the current second point. The numbers 0, 1 and 2 all represent the relative positional deviation.

[0143] Continue to refer to Figure 1 The image processing method also includes: performing step S5 to determine the center of the object to be measured 100 using multiple edge contours obtained by edge extraction.

[0144] Determine the center of the test object 100 in order to accurately control its position in the device.

[0145] Specifically, determining the center of the object to be tested 100 includes: obtaining the coordinates of multiple pixels of the edge contour based on the coordinate information of the pixels of the image to be tested 200; and fitting the coordinates of the multiple pixels of the edge contour to obtain the center coordinates of the object to be tested 100.

[0146] Specifically, obtaining the coordinates of the pixels of the edge contour includes: obtaining the first coordinates of each pixel corresponding to the edge contour in the image coordinate system; converting the first coordinates into second coordinates in the motion platform coordinate system, and using the second coordinates as the coordinates of the pixels of the edge contour. Accordingly, based on the second coordinates, the center coordinates of the object under test 100 are fitted.

[0147] The position of the second point in the target feature map corresponds one-to-one with the position of the pixel in the image to be tested 200. Therefore, after obtaining the second point at the edge of the object to be tested, the pixel of the edge contour of the object to be tested 100 can be obtained.

[0148] After acquiring the test image 200 of the test object 100 at edge position 100L, the coordinates of each pixel of the test image 200 at edge position 100L in the motion platform coordinate system are known. The coordinates in the image coordinate system and the coordinates in the motion platform coordinate system have a corresponding relationship. Therefore, the first coordinates of each pixel corresponding to the edge contour in the image coordinate system can be transformed into second coordinates in the motion platform coordinate system. Here, the test object 100 is located on a motion platform, and the motion platform coordinate system is the world coordinate system of the test object 100, which can represent the true position of the test object 100. Therefore, it is necessary to transform the first coordinates into the second coordinates.

[0149] In this embodiment, the shape of the object to be tested 100 is circular. Then, the second coordinates of all pixels are substituted into the general equation of a circle: x^2+y^2+a1*x+a2*y+a3=0. The values ​​of a1, a2 and a3 are solved by solving the least squares matrix, thereby fitting the center coordinates of the object to be tested.

[0150] It should be noted that the general equation of a circle can be used to obtain not only the coordinates of the center but also the radius. Therefore, the radius obtained by the general equation of a circle can be compared with the preset radius R of the object to be measured 100, thereby evaluating the accuracy of edge extraction.

[0151] Specifically, the general equation of a circle can be transformed into the standard equation of a circle, namely (X+a1 / 2)^2+(Y+a2 / 2)^2=(a1^2+a2^2-4*a3) / 4. Thus, after the values ​​of a1, a2, and a3, the corresponding coordinates of the center of the circle and the radius of the circle can be obtained.

[0152] Accordingly, embodiments of the present invention also provide an image processing system. (See reference) Figure 5 The diagram shows a functional block diagram of an embodiment of the image processing system of the present invention.

[0153] The following is for reference only. Figures 2 to 4 The image processing system of this embodiment will be described below.

[0154] The image processing system described in this embodiment is used in the image processing method of the aforementioned embodiment. The image processing system includes: an image acquisition module 10, used to acquire a test image 200 of the test object 100 at an edge position 100, the test image 200 containing an image of the edge contour of the test object 100; a gradient information acquisition module 20, used to acquire a gradient angle map based on the test image 200, the gradient angle map including the correspondence between the position of each first point and the gradient angle value, and the position of the first point of the gradient angle map corresponds one-to-one with the position of the pixel point in the test image, the gradient angle value being the angle between the gradient direction of the pixel point and a preset reference direction; a processing module 30, used to obtain target feature values ​​based on the gradient angle values ​​of each first point, to obtain a target feature map representing the correspondence between the position of a second point and the target feature value, the target feature value representing the angle between the gradient direction of the pixel point and the preset reference direction, and the target feature value of the second point at the edge of the test object 100 being greater than or less than the target feature value of the second point adjacent to the second point at the edge; and an edge extraction module 40, used to acquire the second point at the edge of the test object 100 based on the target feature map, to obtain the edge contour of the test object.

[0155] Since the gradient angle values ​​corresponding to the edge contours of the test object 100 are relatively uniform and usually fall within a specific angle range, obtaining the target feature map based on the gradient angle values ​​of each first point is beneficial for noise reduction. This reduces the probability of misjudging patterns, background patterns, or other noise patterns inside the test object 100 as edges of the test object 100. It also helps to better distinguish the second point at the edge of the test object and the second point adjacent to the second point at the edge in the target feature map. Thus, when extracting edges from the target feature map, the directional features of the edges can be considered, which is beneficial for accurately extracting the edge contours of the test object 100 and has high versatility and robustness. At the same time, image processing based on the test image 200 obtained after imaging the test object 100 to achieve the goal of contour extraction also helps to improve the efficiency of extracting the edge contours of the test object 100. This is beneficial for meeting the needs of large-scale automated processing of the machine and effectively improving the output of the machine.

[0156] The image to be tested 200 contains an image of the edge contour of the object to be tested 100, so as to extract the edge contour of the object to be tested 100 by image processing the image to be tested 200. In this embodiment, the object to be tested 100 is circular. In other embodiments, depending on the specific type of the object to be tested, the object to be tested may also be other shapes, such as square. As an example, the object to be tested 100 is a wafer. In other embodiments, the object to be tested may also be other products whose edge contours need to be extracted.

[0157] In one specific embodiment, the image processing system is used to determine the center of the object under test 100 using the extracted edge contours of the object under test 100, thereby ensuring the positioning accuracy of the object under test 100 in the device. For example, in semiconductor manufacturing and metrology, determining the wafer center is an important step for accurately aligning various parts of the wafer, thereby ensuring that when the position of the pattern under test is further determined based on the known relative position vector relationship between the wafer center and the pattern under test, its positioning accuracy is controlled within a certain range.

[0158] Therefore, the image acquisition module 10 acquires the test image 200 of the test object 100 at multiple different edge positions 100L, and the number of edge positions 100L is greater than or equal to 3.

[0159] As an example, the image to be tested 200 is rectangular in shape and is a dark-field image. In other embodiments, the image to be tested may also be a bright-field image.

[0160] In this embodiment, the image acquisition module 10 uses a detection system to acquire a test image 200 of the object under test 100 at its edge position. The detection system includes an image acquisition module and a motion platform. The motion platform supports the object under test 100 and enables relative movement between the image acquisition module and the object under test 100. Accordingly, after acquiring the test image 200 of the object under test 100 at its edge position 100L, the coordinates of each pixel of the test image 200 at the edge position 100L in the coordinate system of the motion platform can be obtained.

[0161] The gradient information acquisition module 20 acquires the gradient angle map so that the target feature value related to the gradient angle value can be obtained based on the gradient angle value of each first point, so as to obtain the target feature map that represents the correspondence between the position of the second point and the target feature value.

[0162] In this embodiment, the gradient information acquisition module 20 is also used to acquire a gradient magnitude map based on the image to be tested 200. The gradient magnitude map includes the correspondence between the position of each third point and the magnitude of the grayscale gradient, and the gradient magnitude map serves as the first feature map.

[0163] In this embodiment, the gradient magnitude map is an inverse magnitude map, and the magnitude of each third point in the inverse magnitude map is negatively correlated with the gradient magnitude of the corresponding pixel point in the image under test 200.

[0164] Specifically, the gradient information acquisition module 20 includes: a positive amplitude map acquisition unit, used to acquire the gradient amplitude of each pixel in the image to be tested 200 to obtain a positive amplitude map, wherein the amplitude of each fifth point in the positive amplitude map is positively correlated with the gradient amplitude of the corresponding pixel in the image to be tested; and an inversion unit, used to invert the positive amplitude map to obtain the inverted amplitude map, wherein the inversion process includes: subtracting the gradient amplitude of each fifth point in the positive amplitude map from a preset value to obtain the corresponding inverted amplitude value, thereby obtaining the inverted amplitude map; wherein the preset value is greater than or equal to the maximum value among the gradient amplitudes of each fifth point.

[0165] In this embodiment, taking the image to be tested, 200, as an 8-bit wide image (grayscale range from 0 to 255), the preset value is greater than or equal to 200. This preset value is close to the maximum grayscale value of the 8-bit wide image (i.e., grayscale value 255). By subtracting the gradient magnitude of each fifth point from the preset value, a smaller inverse magnitude value can be obtained for the first point with a larger gradient magnitude.

[0166] In one specific embodiment, the preset value is equal to the maximum grayscale value of an 8-bit wide image, that is, the preset value is equal to 255.

[0167] It should be noted that in other embodiments, depending on the actual situation, the preset value may be less than the maximum value, or the preset value may be zero.

[0168] In other embodiments, the gradient magnitude map can also be a positive magnitude map, in which the magnitude of each third point is positively correlated with the gradient magnitude of the corresponding pixel in the image under test.

[0169] Specifically, the gradient information acquisition module 20 uses the Sobel operator to obtain the positive magnitude map and gradient angle map of the image to be tested 200. The size of the Sobel operator's convolution kernel in the X direction and the convolution kernel in the Y direction are both n*n. In this embodiment, n is an integer from 7 to 9.

[0170] In this embodiment, the gradient information acquisition module 20 acquires the positive amplitude map and gradient angle map of each image to be tested 200.

[0171] In this embodiment, the gradient angle and gradient magnitude of each pixel are obtained based on the corresponding grayscale gradient value. Specifically, for any pixel, the grayscale gradient value in the X direction is G. x The gray-level gradient value in the Y direction is G. y The gradient magnitude of the pixel is The gradient angle value of a pixel is arctan(G). x / G y ), where the X direction is orthogonal to the Y direction.

[0172] As an example, the gradient angle is defined as ranging from -180° to 180°, meaning that the gradient angle value is greater than or equal to -180° and less than or equal to 180°.

[0173] In this embodiment, the image to be tested 200 includes multiple image edges (not shown), and among the multiple image edges, there is only one background image edge (not shown), and the background image edge is completely covered by the background image; accordingly, the processing module 30 also includes: a preset reference direction acquisition unit, used to acquire the background image edge and acquire the preset reference direction according to the background image edge, so that the preset reference direction and the background image edge have a second preset angle.

[0174] The pixel values ​​of the background image are usually the same, making it easy to identify the position of the background image. Accordingly, using the background image as a reference object facilitates the determination of a preset reference direction and improves the uniformity of the preset reference direction. In this embodiment, the preset reference direction is perpendicular to the extension direction of the edge of the background image.

[0175] As an example, the image to be tested 200 includes one or more regions to be tested; the image processing system also includes: an orientation setting module 14, used to set a preset reference orientation for each region to be tested before obtaining a gradient angle map from the image to be tested 200.

[0176] The orientation setting module 14 includes: a reference image providing unit for providing a reference image, wherein the edge of the object to be tested in the reference image includes a reference area; a matching unit for matching the reference image and the image to be tested 200 so that the reference area in the image to be tested corresponds one-to-one with the area to be tested; and a setting unit for obtaining a preset reference direction of the area to be tested corresponding to the reference area based on the gradient direction of one or more pixels on the edge of the object to be tested 100 in the reference area, wherein the preset reference direction is the gradient direction of any pixel on the edge of the object to be tested in the reference area or a weighted sum of the gradient directions of multiple pixels on the edge of the object to be tested in the reference area.

[0177] By employing image matching, it is possible to quickly and accurately determine the preset reference orientation of the image 200 to be tested.

[0178] Correspondingly, the gradient information acquisition module 20 is used to perform angle value acquisition processing on each test area to obtain the gradient angle value of each pixel in the test image. Specifically, the gradient information acquisition module 20 is used to obtain the angle between the gradient direction of each pixel in the test area and the corresponding preset reference direction to obtain the gradient angle value of each pixel in the test area.

[0179] The image processing system also includes an image rotation module 15, which is used to rotate the image 200 to be tested before acquiring the gradient magnitude map and gradient angle map of the image 200 to be tested, so that the edge contour image of the object to be tested 100 extends along a preset direction range.

[0180] like Figure 4 As shown, Figure 4 (a) is Figure 3 (a) Schematic diagram after rotation Figure 4 (b) is Figure 3 (b) Schematic diagram after rotation Figure 4 (c) is Figure 3 (c) A schematic diagram after rotation. The image 200 to be tested is rotated so that the edge contour image of the object to be tested 100 is extended in the vertical direction.

[0181] In this embodiment, the image rotation module 15 includes: a background image edge acquisition unit for acquiring background image edges; and a rotation unit for rotating the background image edges so that the background image edges face a preset direction, wherein the preset direction and the preset reference direction have a first preset angle.

[0182] Using the background image as a reference object makes it easy to determine the rotation method. Moreover, by aligning the edges of the background image with a preset direction, which has a first preset angle with the preset reference direction, the area of ​​the object under test 100 in the image under test 200 is located on a fixed side. This makes the image of the object under test 100 more uniformly positioned in the area of ​​the image under test 200, thereby reducing the impact of inconsistent regional positions on the target feature values ​​in the target feature map.

[0183] It should be noted that the first preset included angle can be 0°, 90° or other angle values.

[0184] For example, in this embodiment, after rotation processing, the edge contour image of the object to be tested 100 is extended in the vertical direction, and the pattern area of ​​the object to be tested 100 in the image to be tested 200 is located on the right side of the image to be tested 200 along the X direction.

[0185] Specifically, the background image edge acquisition unit includes: a grayscale statistics subunit, used to acquire the grayscale statistics of each image edge of the image to be tested 200, wherein the grayscale statistics of the image edge includes: the mean grayscale of each pixel on the image edge, or the sum of the mean grayscale of each pixel on the image edge and a first maximum value; and a positioning subunit, used to acquire the image edge with a second maximum value in the grayscale statistics, thereby obtaining the background image edge; wherein, when the image to be tested 200 is a dark field image, the first maximum value is the maximum value and the second maximum value is the minimum value; when the image to be tested 200 is a bright field image, the first maximum value is the minimum value and the second maximum value is the maximum value.

[0186] The background image is usually located in the edge region of the image under test 200. Therefore, it is necessary to calculate the grayscale statistics of the pixels in the preset width region of the outermost edge. When the image under test 200 is a dark field image, the background image is very dark. Therefore, the position corresponding to the minimum value of the grayscale statistics is selected as the position of the background image.

[0187] Similarly, in other embodiments, when the image to be tested is a bright field image, the background image is very bright. Therefore, the position corresponding to the maximum value in the grayscale statistics is selected as the position of the background image.

[0188] In this embodiment, the preset width of the image edge is the sum of the widths of 5 to 10 pixels.

[0189] Accordingly, in this embodiment, after rotating the image to be tested 200, a gradient angle map is obtained based on the angle between the gradient direction of each pixel in the image to be tested 200 and the preset reference direction.

[0190] In this embodiment, in the target feature map, the target feature value of the second point at the edge of the object to be tested 100 has a minimum or maximum value. Therefore, when the target feature map is subsequently extracted, the edge contour of the object to be tested 100 can be obtained by extracting the target feature value and the path with the extreme value.

[0191] Specifically, the processing module 30 further includes: an interval setting unit, used to set multiple angle interval ranges and set an angle feature value for each angle interval range, wherein the multiple angle interval ranges do not overlap and each angle feature value monotonically increases or decreases as the corresponding angle region range increases; and a conversion unit, used to perform feature value conversion processing on each first point of the gradient angle map to obtain the corresponding angle feature value, so as to obtain a second feature map of the correspondence between the fourth point and the angle feature value.

[0192] The transformation unit includes: an interval acquisition subunit, used to acquire the angle interval range where the gradient angle value of each first point is located, as a candidate angle interval range; and an angle feature value setting subunit, used to set the angle feature value corresponding to the candidate angle interval range as the angle feature value corresponding to the first point.

[0193] In this embodiment, there are two angle intervals: the absolute value of the gradient angle is greater than the threshold angle, and the absolute value of the gradient angle is less than or equal to the threshold angle. The angle feature values ​​for the two angle intervals are 1 and 0, respectively. The gradient angle is greater than or equal to -180° and less than or equal to 180°. That is, the first point of each gradient angle map is subjected to feature value transformation processing to obtain the corresponding angle feature value, thereby obtaining a binary map.

[0194] In this embodiment, the threshold angle is arctan(H / d), where d is the width of the image 200 to be tested, and H is the length of the image 200 to be tested, with the width being less than the length.

[0195] In this embodiment, the binary image includes a first type of point and a second type of point. The edge of the object to be measured 100 has a second type of point, and the angle feature value of one type of point is 0 and the angle feature value of the other type is 1. This makes it easy for the first point with an angle feature value of 0 to contribute 0 to the weighted value, and the first point with an angle feature value of 1 to have a larger weighted value. As a result, the weighted value of the second point at the edge of the object to be measured 100 in the target feature image has a minimum or maximum value.

[0196] It should be noted that the processing module 30 also includes: a dilation processing unit, used to dilate the binary image before weighting. The dilation processing includes: traversing all second-class points, and when there is a first-class point among the points adjacent to the second-class point along the dilation direction, setting the angle feature value of the second-class point to the angle feature value corresponding to the first-class point. The angle between the dilation direction and the extension direction of the edge contour of the object to be measured 100 is less than 20°.

[0197] Specifically, the expansion direction of each second type of point is the same; the expansion direction of the second type of point can be parallel to the tangent direction at any position of the edge contour of the object to be measured 100, or the expansion direction of the second type of point can be parallel to the tangent direction of the edge contour at the position of the second type of point.

[0198] In this embodiment, the processing module 30 further includes a weighting unit, used to weight the first feature map and the second feature map to obtain the weighted value of each second point, the weighted value being used as the target feature value to obtain a target feature map representing the correspondence between the position of the second point and the target feature value, the weighting being used to make the gradient magnitude of the weighted value at the edge of the object to be measured in the weighted map greater than the gradient magnitude of the angle feature value at the edge of the object to be measured in the second feature map.

[0199] Combining gradient magnitude maps for weighting helps to further reduce noise (for example, it helps to reduce the probability of misjudging patterns, background patterns or other noise patterns inside the test object 100 as the edge of the test object). Moreover, when extracting the edge contour in the subsequent process, the magnitude and direction features of the edge can be considered at the same time, which helps to improve the accuracy, versatility and robustness of the edge contour extraction of the test object 100.

[0200] Meanwhile, the weighting is used to make the gradient magnitude of the weighted value at the edge of the test object 100 in the target feature map greater than the gradient magnitude of the target feature value of the pixel at the edge of the test object 100 in the second feature map, thereby enhancing the prominence of the edge of the test object 100 in the target feature map, which facilitates subsequent edge extraction of the weighted map.

[0201] Specifically, the first target feature map and the second target feature map (i.e., the binary map) after dilation are weighted.

[0202] In this embodiment, after weighting the first feature map and the second feature map to obtain the target feature map, the target feature value of the second point at the edge 100 of the object to be measured has a minimum or maximum value.

[0203] In one specific embodiment, in the target feature map, the target feature value of the second point at the edge of the object to be tested 100 has the minimum value. Therefore, the gradient magnitude map is an inverse magnitude map. The magnitude of each third point in the inverse magnitude map is negatively correlated with the gradient magnitude of the corresponding pixel in the image to be tested. The angular feature value of the first type of point is 1, and the angular feature value of the second type of point is 0.

[0204] Specifically, the amplitude of the third point at the edge of the object 100 in the gradient amplitude diagram is a minimum value.

[0205] In this embodiment, the weight of the gradient magnitude map is less than the weight of the binary map.

[0206] As an example, the weights of the first target feature map (i.e., the gradient magnitude map) are 0.1 to 0.3, and the weights of the second target feature map (i.e., the binary map) are 180 to 245.

[0207] The weight of the second target feature map is much greater than the weight of the first target feature map, thus increasing the impact of the binary image filtering and thereby filtering out most of the points that do not meet the angle requirements.

[0208] It should be noted that in other embodiments, the weight of the first target feature map can be changed, and the weight of the second target feature map can be changed proportionally.

[0209] As an example, weighting the first target feature map and the second target feature map includes: calculating the weighted value corresponding to each pixel using the formula w(x,y)=w1*(255-mag(x,y))+w2*binary_orient(x,y), where w(x,y) is the weighted value corresponding to any pixel, 255-mag(x,y) is the magnitude of the pixel in the inverse magnitude map, mag(x,y) is the gradient magnitude of the pixel in the gradient magnitude map, binary_orient(x,y) is the angular feature value of the pixel in the binary map, w1 is the weight of the first target feature map, and w2 is the weight of the second target feature map, where w1 is from 0.1 to 0.3 and w2 is from 180 to 245.

[0210] Therefore, in this embodiment, the weighted value of the second point at the edge of the object to be tested 100 has a minimum value.

[0211] Based on the above mechanism, in some other embodiments, the target feature value of the second point at the edge of the object to be measured has the maximum value in the target feature map. Correspondingly, the gradient magnitude map is a positive magnitude map, and the magnitude of each third point in the positive magnitude map is positively correlated with the gradient magnitude of the corresponding pixel in the image to be measured; the angular feature value of the first type of point is 0, and the angular feature value of the second type of point is 1.

[0212] In other embodiments, the target feature map can be obtained without weighting, based on the actual features of the image to be tested, using only the gradient angle value.

[0213] Specifically, the processing module includes: an interval setting unit, used to set multiple angle interval ranges and set an angle feature value for each angle interval range, wherein the multiple angle interval ranges do not overlap, and each angle feature value monotonically increases or decreases as the corresponding angle region range increases; and a transformation unit, used to perform feature value transformation processing on each first point of the gradient angle map to obtain the corresponding angle feature value, which is used as the target feature value to obtain the target feature map representing the correspondence between the position of the second point and the angle feature value.

[0214] It is understood that, in this embodiment, two angular ranges can also be set according to the contour characteristics of the image to be tested, and the corresponding relationship between each second point and the target feature value is a binary image.

[0215] The target feature value is obtained based on the gradient angle value, and the target feature value of the second point at the edge of the test object 100 is greater than or less than the target feature value of the second point adjacent to the second point at the edge. Therefore, the second point at the edge of the test object can be easily extracted from the target feature map.

[0216] In this embodiment, the target feature value of the second point at the edge of the object to be tested 100 has the minimum value in the target feature map. Therefore, edge extraction is performed on the target feature map to minimize the target feature value and value of the second point through which the edge contour passes.

[0217] In this embodiment, the edge extraction module 40 performs edge extraction on the target feature map corresponding to each image to be tested 200 to obtain multiple edge contours.

[0218] Specifically, the edge extraction module 40 includes: a direction definition unit, used to determine a start row and an end row in the target feature map, with the direction from the start row to the end row as the reference direction; and a target point acquisition unit, used to acquire a second point as a target point in each row from the start row to the end row along the reference direction, wherein the sum of the target feature values ​​of the target points has a third maximum value, and the target points constitute the edge points at the edge of the object to be tested; wherein, in the target feature map, if the target feature value of the second point at the edge of the object to be tested 100 has a minimum value, the third maximum value is the minimum value; and in the target feature map, if the target feature value of the second point at the edge of the object to be tested 100 has a maximum value, the third maximum value is the maximum value.

[0219] Since the target feature value of the second point at the edge of the object to be measured 100 has a minimum or maximum value in the target feature map, the edge point of the edge contour of the object to be measured 100 can be extracted by obtaining a continuous path from the start row to the end row along the reference direction, and the sum of the target feature values ​​of the second point passed through the continuous path has a third maximum value.

[0220] Edge extraction module 20 may further include: a region definition unit, used to obtain a region to be extracted in the target feature map before determining the start and end rows in the target feature map. The region to be extracted includes multiple rows of second points, and each row of second points includes multiple second points. By obtaining the region to be extracted, the region where edge extraction needs to be performed is determined.

[0221] In this embodiment, the region to be extracted is the entire target feature map. In other embodiments, depending on the actual situation, the region to be extracted may also be a local region of the target feature map.

[0222] It should also be noted that, in this embodiment, based on the extension direction of the edge contour of the object to be tested 100, the area to be extracted includes multiple rows of pixels, where the row direction is the X direction (e.g., ...). Figure 4 As shown), the arrangement direction of the multiple rows of pixels is the Y direction (e.g., Figure 4 (As shown). In other embodiments, the row direction can also be the Y direction.

[0223] In this embodiment, the target point acquisition unit includes: a preset subunit, used to use the target feature values ​​of each second point in the starting row as the accumulated values ​​of the corresponding second points; and a search subunit, used to traverse each row from the second row to the end row sequentially, and perform pathfinding processing on the current row to obtain a position pointer table and the accumulated values ​​of each second point in the end row. The pathfinding processing includes: repeatedly performing accumulation relationship acquisition processing on each second point in the current row; wherein, the accumulation relationship acquisition processing includes: obtaining each second point located within the search range of the previous row of the current second point as candidate points, the search range covering multiple candidate points in the previous row that are closest to the current second point; and obtaining the first value of each candidate point relative to the target feature value and the value of the current second point. The three extreme values ​​are calculated to obtain the cumulative extreme value. This cumulative extreme value is used as the cumulative value of the current second point, and the positional relationship between the candidate point corresponding to the cumulative extreme value and the current second point is recorded as the position pointer of the current second point. The cumulative relationship acquisition process is repeated for all second points in the current row to obtain the cumulative value and positional relationship of each second point. The correspondence between each second point and the positional relationship forms a position pointer table. The end position acquisition subunit is used to acquire the second point in the end row whose cumulative value has the third extreme value as the end position. The extraction subunit is used to acquire the target point according to the position pointer table and the end position. The target point passes through the end position and the sum of the target feature values ​​of the target point is equal to the cumulative value of the end position.

[0224] In this embodiment, the target feature value at the second point on the edge of the object to be tested 100 in the target feature map has a minimum value; therefore, the third maximum value is the minimum value. In other embodiments, the target feature value at the second point on the edge of the object to be tested in the target feature map has a maximum value; therefore, the third maximum value is the maximum value.

[0225] The starting and ending rows are determined in the target feature map, thereby determining the direction of pathfinding.

[0226] By determining the starting row, the target feature value of each second point in the starting row is used as the cumulative value of the corresponding second point, thus preparing for subsequent updates of the cumulative value.

[0227] As an example, the path acquisition unit uses the shortest path algorithm for edge extraction, including Dijkstra's algorithm.

[0228] In this embodiment, during the process of repeatedly accumulating the relationship of each second point in the current row, the search range of the i-th current second point covers the candidate points including the i-2 to i+2 second points in the previous row, where i represents the position of the current second point in the arrangement direction, which is perpendicular to the reference direction.

[0229] In this embodiment, the image processing system includes a center extraction module 50, which is used to determine the center of the object to be measured 100 by using multiple edge contours obtained by edge extraction.

[0230] Determine the center of the test object 100 in order to accurately control its position in the device.

[0231] Specifically, the center extraction module 50 includes: a coordinate acquisition unit, used to acquire the coordinates of multiple pixels of the edge contour based on the coordinate information of the pixels of the image to be tested 200; and a fitting unit, used to fit the coordinates of the multiple pixels of the edge contour to acquire the center coordinates of the object to be tested 100.

[0232] Fitting the center requires multiple points, so the coordinates of multiple pixels on the edge contour need to be obtained in advance.

[0233] The position of the second point in the target feature map corresponds one-to-one with the position of the pixel in the image to be tested 200. Therefore, after obtaining the second point at the edge of the object to be tested, the pixel of the edge contour of the object to be tested 100 can be obtained.

[0234] Specifically, the coordinate acquisition unit includes: a first coordinate acquisition unit, used to acquire the first coordinates of each pixel point corresponding to the edge contour in the image coordinate system; and a second coordinate acquisition unit, used to convert the first coordinates into second coordinates in the motion platform coordinate system, with the second coordinates serving as the coordinates of the pixel points of the edge contour. Correspondingly, the fitting unit is used to fit the center coordinates of the object under test based on the second coordinates.

[0235] In this embodiment, the shape of the object to be tested 100 is circular. Then, the second coordinates of all pixels are substituted into the general equation of a circle: x^2+y^2+a1*x+a2*y+a3=0. The values ​​of a1, a2 and a3 are solved by solving the least squares matrix, thereby fitting the center coordinates of the object to be tested.

[0236] It should be noted that the general equation of a circle can be used to obtain not only the coordinates of the center but also the radius. Therefore, the radius obtained by the general equation of a circle can be compared with the preset radius R of the object to be measured 100, thereby evaluating the accuracy of edge extraction.

[0237] Specifically, the general equation of a circle can be transformed into the standard equation of a circle, namely (X+a1 / 2)^2+(Y+a2 / 2)^2=(a1^2+a2^2-4*a3) / 4. Thus, after the values ​​of a1, a2, and a3, the corresponding coordinates of the center of the circle and the radius of the circle can be obtained.

[0238] This invention also provides a device that can implement the image processing method provided in this invention by loading a program in the form of the above-described image processing method.

[0239] Referring to Figure 12, a hardware structure diagram of a device provided according to an embodiment of the present invention is shown. The device of this embodiment includes: at least one processor 01, at least one communication interface 02, at least one memory 03, and at least one communication bus 04.

[0240] In this embodiment, the number of processor 01, communication interface 02, memory 03 and communication bus 04 is at least one, and processor 01, communication interface 02 and memory 03 communicate with each other through communication bus 04.

[0241] Communication interface 02 can be an interface for a communication module used for network communication, such as the interface for a GSM module.

[0242] Processor 01 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the image processing method of this embodiment.

[0243] Memory 03 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0244] The memory 03 stores one or more computer instructions, which are executed by the processor 01 to implement the image processing method provided in the aforementioned embodiments.

[0245] It should be noted that the aforementioned terminal device may also include other devices (not shown) that may not be essential to understanding the content disclosed in the embodiments of the present invention; given that these other devices may not be essential for understanding the content disclosed in the embodiments of the present invention, the embodiments of the present invention will not describe them one by one.

[0246] This invention also provides a storage medium storing one or more computer instructions for implementing the image processing method provided in the foregoing embodiments.

[0247] In the image processing method provided by this invention, a gradient angle map is obtained from the image to be tested, and a target feature map is obtained based on the gradient angle values ​​of each first point. The target feature value of the first point at the edge of the object to be tested is greater than or less than the target feature value of the first point adjacent to the first point at the edge. Then, the edge contour of the object to be tested is obtained based on the target feature map. Since the gradient angle values ​​corresponding to the edge contour of the object to be tested are relatively uniform and usually fall within a specific angle range, obtaining the target feature map based on the gradient angle values ​​of each first point is beneficial for noise reduction, that is, it helps to reduce the distortion of patterns and background noise within the object to be tested. The probability of misidentifying scene patterns or other noise patterns as the edge of the test object can be reduced, which helps to better distinguish the first point at the edge of the test object and the first point adjacent to the first point at the edge. Therefore, when extracting the edge of the target feature map, the directional features of the edge can be considered. This is beneficial for accurately extracting the edge contour of the test object and has high versatility and robustness. At the same time, image processing based on the test image obtained after imaging the test object to achieve the purpose of contour extraction also helps to improve the efficiency of extracting the edge contour of the test object. Correspondingly, it is beneficial to meet the needs of large-scale automated processing of the machine and effectively improve the output of the machine.

[0248] The embodiments of the present invention described above are combinations of elements and features of the present invention. Unless otherwise stated, elements or features may be considered optional. Individual elements or features may be practiced without combination with other elements or features. Furthermore, embodiments of the present invention may be constructed by combining some elements and / or features. The order of operations described in the embodiments of the present invention may be rearranged. Some constructions of any embodiment may be included in another embodiment and may be replaced by corresponding constructions of another embodiment. It will be apparent to those skilled in the art that claims in the appended claims that are not expressly referenced in each other may be combined to form embodiments of the present invention, or may be included as new claims in amendments made after the filing of this application.

[0249] Embodiments of the present invention can be implemented by various means, such as hardware, firmware, software, or combinations thereof. In a hardware configuration, the method according to an exemplary embodiment of the present invention can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, etc.

[0250] In firmware or software configuration, embodiments of the present invention can be implemented in the form of modules, processes, functions, etc. Software code can be stored in a memory unit and executed by a processor. The memory unit is located inside or outside the processor and can send data to and receive data from the processor via various known means.

[0251] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is accorded the widest scope consistent with the principles and novel features disclosed herein.

[0252] While the present invention has been disclosed above, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the invention; therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.

Claims

1. An image processing method, characterized in that, include: Acquire a test image of the object at its edge position, wherein the test image contains an image of the edge contour of the object; A gradient angle map is obtained based on the image to be tested. The gradient angle map includes the correspondence between the position of each first point and the gradient angle value. The position of the first point of the gradient angle map corresponds one-to-one with the position of the pixel in the image to be tested. The gradient angle value is the angle between the gradient direction of the pixel and the preset reference direction. Target feature values ​​are obtained based on the gradient angle values ​​of each of the first points to obtain a target feature map that represents the correspondence between the position of the second point and the target feature value. The target feature value is used to represent the angle between the gradient direction of the pixel and the preset reference direction. The target feature value of the second point at the edge of the object to be tested is greater than or less than the target feature value of the second point adjacent to the second point at the edge. Based on the target feature map, a second point is obtained at the edge of the object to be measured, thus obtaining the edge contour of the object to be measured.

2. The image processing method as described in claim 1, characterized in that, Acquiring a test image of the object at the edge location includes: acquiring test images of the object at multiple different edge locations, wherein the number of edge locations is greater than or equal to 3; The image processing method further includes: determining the center of the object under test using multiple edge contours obtained by the edge extraction.

3. The image processing method as described in claim 2, characterized in that, Determining the center of the object under test using multiple edge contours obtained by the edge extraction includes: obtaining the coordinates of multiple pixels of the edge contours based on the coordinate information of the pixels of the image under test; and fitting the coordinates of the multiple pixels of the edge contours to obtain the center coordinates of the object under test.

4. The image processing method as described in claim 1, characterized in that, Before obtaining the gradient angle map from the image to be tested, the image processing method further includes: rotating the image to be tested so that the edge contour image of the object to be tested extends along a preset direction range; After rotating the image to be tested, the gradient angle map is obtained based on the angle between the gradient direction of each pixel in the image to be tested and the preset reference direction.

5. The image processing method as described in claim 4, characterized in that, The image to be tested includes multiple image edges, and among the multiple image edges, there is only one background image edge, which is completely covered by the background image. Rotating the image to be tested so that the edge contour image of the object to be tested extends along a preset direction range includes: acquiring the edge of the background image; The edges of the background image are rotated so that they face a preset direction, and the preset direction has a first preset angle with the preset reference direction.

6. The image processing method as described in claim 1, characterized in that, The image to be tested includes multiple image edges, and among the multiple image edges, there is only one background image edge, which is completely covered by the background image. Obtaining target feature values ​​based on the gradient angle values ​​of each of the first points includes: acquiring the background image edges; A preset reference direction is obtained based on the edge of the background image, such that the preset reference direction has a second preset angle with the edge of the background image.

7. The image processing method as described in claim 5 or 6, characterized in that, Obtaining the background image edge includes: obtaining the grayscale statistical value of each image edge of the image to be tested, wherein the grayscale statistical value includes: the average grayscale value of each pixel on the image edge, or the sum of the average grayscale value of each pixel on the image edge and a first maximum value; obtaining the image edge whose grayscale statistical value has a second maximum value, thereby obtaining the background image edge; Specifically, when the image to be tested is a dark field image, the first maximum value is the maximum value and the second maximum value is the minimum value; when the image to be tested is a bright field image, the first maximum value is the minimum value and the second maximum value is the maximum value.

8. The image processing method as described in claim 1, characterized in that, The image to be tested includes one or more regions to be tested; Before obtaining the gradient angle map based on the image to be tested, the image processing method further includes: setting a preset reference direction for each of the regions to be tested; The step of setting a preset reference direction for each of the test areas includes: providing a reference image, wherein the edge of the object to be tested in the reference image includes a reference area; matching the reference image with the test image so that the reference areas in the test image correspond one-to-one with the test areas; and obtaining a preset reference direction for the test area corresponding to the reference area based on the gradient direction of one or more pixels on the edge of the object to be tested in the reference area, wherein the preset reference direction is the gradient direction of any pixel on the edge of the object to be tested in the reference area or a weighted sum of the gradient directions of multiple pixels on the edge of the object to be tested in the reference area. Obtaining the gradient angle map from the image to be tested includes: performing angle value acquisition processing on each of the areas to be tested to obtain the gradient angle value of each pixel in the image to be tested. The angle value acquisition processing includes: obtaining the angle between the gradient direction of each pixel in the area to be tested and the corresponding preset reference direction to obtain the gradient angle value of each pixel in the area to be tested.

9. The image processing method as described in claim 1, 6, or 8, characterized in that, Based on the gradient angle values ​​of each of the first points, target feature values ​​are obtained to obtain a target feature map representing the correspondence between the position of the second point and the target feature values, including: Multiple angle intervals are set, and an angle feature value is set for each angle interval. The multiple angle intervals do not overlap, and each angle feature value increases or decreases monotonically as the corresponding angle region increases. Feature value transformation processing is performed on each first point of the gradient angle map to obtain the corresponding angle feature value. The angle feature value is used as the target feature value to obtain the correspondence between the position of the second point and the angle feature value as the target feature map. or, In addition to obtaining a gradient angle map from the image under test, a gradient magnitude map is also obtained from the image under test. The gradient magnitude map includes the correspondence between the position of each third point and the magnitude of the gray-level gradient. The gradient magnitude map serves as the first feature map. Based on the gradient angle values ​​of each of the first points, target feature values ​​are obtained to obtain a target feature map representing the correspondence between the position of the second point and the target feature values, including: Multiple angle intervals are set, and an angle feature value is set for each angle interval. The multiple angle intervals do not overlap, and each angle feature value monotonically increases or decreases as the corresponding angle region increases. Feature value transformation processing is performed on each first point of the gradient angle map to obtain the corresponding angle feature value, so as to obtain a second feature map of the correspondence between the fourth point and the angle feature value. The first feature map and the second feature map are weighted to obtain the weighted value of each second point. The weighted value is used as the target feature value to obtain a target feature map representing the correspondence between the position of the second point and the target feature value. The weighting is used to make the gradient magnitude of the weighted value at the edge of the object under test in the weighted map greater than the gradient magnitude of the angle feature value at the edge of the object under test in the second feature map. The feature value transformation process includes: obtaining the angle interval range where the gradient angle value of each first point is located, as a candidate angle interval range; and using the angle feature value corresponding to the candidate angle interval range as the angle feature value corresponding to the first point.

10. The image processing method as described in claim 9, characterized in that, The first point of the gradient angle map is subjected to eigenvalue transformation to obtain the corresponding angle eigenvalue, thereby obtaining a binary map; The angle range is two; the two angle ranges are: the absolute value of the gradient angle value is greater than the threshold angle, and the absolute value of the gradient angle value is less than or equal to the threshold angle. The angular feature values ​​for the two angular intervals are 1 and 0, respectively; the gradient angle value is greater than or equal to -180° and less than or equal to 180°.

11. The image processing method as described in claim 10, characterized in that, The image to be tested is rectangular in shape; the image to be tested includes multiple image edges, and among the multiple image edges, there is only one background image edge, which is completely covered by the background image; the preset reference direction is perpendicular to the extension direction of the background image edge; The threshold angle is arctan(H / d), where d is the width of the image to be tested, H is the length of the image to be tested, and the width is less than the length.

12. The image processing method as described in claim 10, characterized in that, The binary image includes a first type of point and a second type of point. The edge of the object to be measured has the second type of point, and the angle feature value of one type of point and the second type of point is 0, while the angle feature value of the other type is 1. After obtaining the binary image, the method further includes: performing dilation processing on the binary image. The dilation processing includes: traversing all second-type points, and when there is a first-type point among the points adjacent to the second-type point along the dilation direction, setting the angle feature value of the second-type point to the angle feature value corresponding to the first-type point. The angle between the dilation direction and the extension direction of the edge contour of the object to be measured is less than 20°.

13. The image processing method as described in claim 12, characterized in that, In the expansion process, the expansion directions of all second-type points are the same; the expansion direction of the second-type points is parallel to the tangent direction at any position of the edge contour of the object under test, or the expansion direction of the second-type points is parallel to the tangent direction of the edge contour at the position of the second-type points.

14. The image processing method as described in claim 12, characterized in that, The gradient magnitude map is a positive magnitude map, and the magnitude of each third point in the positive magnitude map is positively correlated with the gradient magnitude of the corresponding pixel in the image under test; the angular feature value of the first type of point is 0, and the angular feature value of the second type of point is 1; or, The gradient magnitude map is an inverse magnitude map, and the magnitude of each third point in the inverse magnitude map is negatively correlated with the gradient magnitude of the corresponding pixel in the image under test; the angular feature value of the first type of point is 1, and the angular feature value of the second type of point is 0.

15. The image processing method as described in claim 12, characterized in that, The gradient magnitude map is an inverse magnitude map, and the magnitude of each third point in the inverse magnitude map is negatively correlated with the gradient magnitude of the corresponding pixel in the image under test; The angular feature value of the first type of point is 1, and the angular feature value of the second type of point is 0; Obtaining a gradient magnitude map from the image under test includes: obtaining the gradient magnitude of each pixel in the image under test to obtain a positive magnitude map, wherein the magnitude of each fifth point in the positive magnitude map is positively correlated with the gradient magnitude of the corresponding pixel in the image under test; inverting the positive magnitude map to obtain the inverted magnitude map, wherein the inversion process includes: subtracting the gradient magnitude of each fifth point in the positive magnitude map from a preset value to obtain the corresponding inverted magnitude value, thereby obtaining the inverted magnitude map; wherein the preset value is greater than or equal to the maximum value among the gradient magnitudes of each fifth point.

16. The image processing method as described in claim 15, characterized in that, The gradient magnitude map is an inverse magnitude map. The magnitude of each third point in the inverse magnitude map is negatively correlated with the gradient magnitude of the corresponding pixel in the image under test. Furthermore, the magnitude of the third point at the edge of the object under test in the gradient magnitude map is a minimum value. The angular feature value of the first type of point is 1, and the angular feature value of the second type of point is 0; During the weighting process of the binary image and the gradient magnitude image, the weight of the gradient magnitude image is less than the weight of the binary image.

17. The image processing method as described in claim 15, characterized in that, The gradient magnitude map is an inverse magnitude map. The magnitude of each third point in the inverse magnitude map is negatively correlated with the gradient magnitude of the corresponding pixel in the image under test. Furthermore, the magnitude of the third point at the edge of the object under test in the gradient magnitude map is a minimum value. The angular feature value of the first type of point is 1, and the angular feature value of the second type of point is 0; The weight of the binary image is 180 to 245, the weight of the gradient magnitude image is 0.1 to 0.3, and the preset value is greater than or equal to 200.

18. The image processing method as described in claim 1, characterized in that, In the target feature map, the target feature value of the second point at the edge of the object to be measured has a minimum or maximum value; Based on the target feature map, a second point is obtained at the edge of the object to be measured to obtain the edge contour of the object to be measured, including: determining a start row and an end row in the target feature map, with the direction from the start row to the end row as the reference direction; Along the reference direction, a second point is obtained as a target point in each row from the starting row to the ending row. The sum of the target feature values ​​of the target points has a third maximum value, and the target points constitute the edge points at the edge of the object to be measured. Specifically, in the target feature map, if the target feature value at the second point at the edge of the object to be measured has a minimum value, the third maximum value is the minimum value; if the target feature value at the second point at the edge of the object to be measured has a maximum value, the third maximum value is the maximum value.

19. The image processing method as described in claim 18, characterized in that, In each row from the starting row to the ending row, a second point is obtained as the target point, including: The target feature value of each second point in the starting row is used as the cumulative value of the corresponding second point; Iterate through each row from the second row to the end row, and perform path finding processing on the current row to obtain the position pointer table and the accumulated value of each second point in the end row. The path finding processing includes: obtaining the repeated accumulation relationship of each second point in the current row. The cumulative relationship acquisition process includes: acquiring each second point within the search range of the previous row of the current second point as candidate points, wherein the search range covers multiple candidate points among the second points in the previous row that are closest to the current first point; acquiring the third maximum value among the target feature values ​​and values ​​of each candidate point and the current second point, respectively, to obtain the maximum-minimum value; using the maximum-minimum value as the cumulative value of the current second point, and recording the positional relationship between the candidate point corresponding to the maximum-minimum value and the current second point as the position pointer of the current second point; Repeat the accumulation relationship acquisition process for all second points in the current row to obtain the accumulated value of each second point and the positional relationship. The correspondence between each second point and the positional relationship forms the position pointer table. The second point in the ending row whose accumulated value has the third maximum value is taken as the ending position; The target point is obtained according to the position pointer table and the end position. The target point passes through the end position and the sum of the target feature values ​​of the target point is equal to the accumulated value of the end position.

20. The image processing method as described in claim 19, characterized in that, During the process of repeatedly accumulating the relationship of each second point in the current row, the search range of the i-th current second point includes the candidate points from the (i-2)th to the (i+2)th second point in the previous row, where i represents the position of the current second point in the arrangement direction, which is perpendicular to the preset reference direction.

21. An image processing system, characterized in that, The image processing system is used to perform the image processing method according to any one of claims 1 to 20, comprising: An image acquisition module is used to acquire a test image of the object to be tested at the edge position, wherein the test image contains an image of the edge contour of the object to be tested; The gradient information acquisition module is used to acquire a gradient angle map based on the image to be tested. The gradient angle map includes the correspondence between the position of each first point and the gradient angle value, and the position of the first point of the gradient angle map corresponds one-to-one with the position of the pixel in the image to be tested. The gradient angle value is the angle between the gradient direction of the pixel and a preset reference direction. The processing module is used to obtain target feature values ​​based on the gradient angle values ​​of each of the first points, so as to obtain a target feature map that represents the correspondence between the position of the second point and the target feature value. The target feature value is used to represent the angle between the gradient direction of the pixel and the preset reference direction, and the target feature value of the second point at the edge of the object to be tested is greater than or less than the target feature value of the second point adjacent to the second point at the edge. The edge extraction module is used to obtain a second point at the edge of the object under test based on the target feature map, thereby obtaining the edge contour of the object under test.

22. A device, characterized in that, It includes at least one memory and at least one processor, the memory storing one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the image processing method as described in any one of claims 1 to 20.

23. A storage medium, characterized in that, The storage medium stores one or more computer instructions for implementing the image processing method as described in any one of claims 1 to 20.

Citation Information

Patent Citations

  • Dropper strand breakage detection method and device, computer equipment and storage medium

    CN113763379A

  • Detection method, detection system, equipment and storage medium

    CN114022503A