Method, device and electronic equipment for detecting surface defects of optical components
By acquiring the grayscale image of the optical component and converting it into a polar coordinate image, removing the pattern, and using expansion processing and texture information parameters to determine the defect area, the problem of pattern interference in the surface inspection of optical components is solved and the detection accuracy is improved.
Patent Information
- Application Number
- CN202111615387.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2041-12-27
AI Technical Summary
When performing defect detection on the surface of an optical element etched with patterns for realizing optical functions, the existing technology has low detection accuracy and is unable to effectively distinguish between patterns and defects.
By acquiring the grayscale image of the optical element, converting it into a polar coordinate image, removing the pattern, using expansion processing and texture information parameters to determine the polar coordinate defect area, and marking the defect area in the grayscale image to eliminate pattern interference.
The accuracy of surface defect detection of optical components is improved, patterns are avoided from being misjudged as defects, and the reliability of detection results is improved.
Smart Images

Figure CN114565552B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of optical detection technology, and more specifically, to a method, device, electronic device, and computer-readable storage medium for detecting surface defects of optical elements. Background Art
[0002] During the production process of optical components such as lenses, defects (such as scratches and pitting) or contaminants inevitably appear on the surface of the optical components. These defects and contaminants seriously affect the quality of the optical components, and in turn, the production and manufacturing of optical products. Based on this, optical component surfaces are currently inspected manually or through automated computer-generated inspection to identify surface defects and effectively assess their quality.
[0003] Compared with manual inspection, automatic inspection has the advantages of low cost, high detection efficiency and accuracy. The present application provides an automatic inspection method with the above advantages. The optical element surfaces applicable to automatic inspection are all smooth optical element surfaces. Summary of the Invention
[0004] One purpose of the present application is to provide a new technical solution for detecting surface defects of optical elements.
[0005] According to the first aspect of the present application, a method for detecting surface defects of an optical element is provided, wherein the surface to be detected of the optical element is etched with a pattern for realizing an optical function, and the method comprises: obtaining a grayscale image of the surface to be detected; obtaining a polar coordinate image of a pattern area where the pattern is distributed in the grayscale image; removing the pattern pattern corresponding to the pattern in the polar coordinate image; determining the polar coordinate defect area based on the pattern area of each remaining pattern in the polar coordinate image; and marking the defect area corresponding to the polar coordinate defect area in the grayscale image.
[0006] Optionally, determining the polar coordinate defect area based on the pattern areas of the remaining patterns in the polar coordinate image includes: performing dilation processing on the pattern area; determining the polar coordinate defect area based on the result of the dilation processing; wherein the polar coordinate defect area includes: a closed pattern area connected by multiple first pattern areas after the dilation processing, and an original pattern area of the original pattern corresponding to the second pattern area that is not connected to other pattern areas after the dilation processing.
[0007] Optionally, the polar coordinate defect area is determined based on the pattern areas of the remaining patterns in the polar coordinate image, including: calculating the parameter values of the texture information parameters in the pattern area through the gray level co-occurrence matrix; wherein the texture information parameters include at least one of the following: energy, correlation and inverse variance; and determining the polar coordinate defect area based on the parameter values.
[0008] Optionally, after determining the polar coordinate defect area based on the pattern areas of the remaining patterns in the polar coordinate image, the method for detecting surface defects of an optical element also includes: obtaining a first total number of pixel points in the pattern area; when the first total number is less than a preset number threshold, modifying the polar coordinate defect area to a polar coordinate suspected defect area; marking the defect area corresponding to the polar coordinate defect area in the grayscale image, including: marking the defect area corresponding to the polar coordinate defect area in the grayscale image in a first manner, and marking the suspected defect area corresponding to the polar coordinate suspected defect area in the grayscale image in a second manner.
[0009] Optionally, after determining the polar coordinate defect area based on the pattern areas of the remaining patterns in the polar coordinate image, the method for detecting surface defects of optical elements also includes: performing regional growth on the polar coordinate defect area to obtain a corresponding growth area; wherein the difference in grayscale values of two adjacent pixel points in the growth area is less than a preset difference threshold; obtaining a second total number of pixel points in the growth area; and when the second total number is less than the preset number threshold, determining that the polar coordinate defect area is a lamp shadow area.
[0010] Optionally, the above pattern is a Fresnel pattern.
[0011] According to the second aspect of the present application, a device for detecting surface defects of an optical element is also provided. The surface to be detected of the optical element is etched with a pattern for realizing an optical function. The device includes: a first acquisition module for acquiring a grayscale image of the surface to be detected; a second acquisition module for acquiring a polar coordinate image of a pattern area of a distributed pattern in the grayscale image; a removal module for removing a pattern pattern corresponding to the pattern in the polar coordinate image; a determination module for determining a polar coordinate defect area based on the pattern area of each remaining pattern in the polar coordinate image; and a processing module for marking a defect area corresponding to the polar coordinate defect area in the grayscale image.
[0012] Optionally, the determination module is used to: perform expansion processing on the pattern area; determine the polar coordinate defect area based on the result of the expansion processing; wherein the polar coordinate defect area includes: a closed pattern area connected by multiple first pattern areas after the expansion processing, and an original pattern area of the original pattern corresponding to the second pattern area that is not connected to other pattern areas after the expansion processing.
[0013] Optionally, the determination module is used to: calculate parameter values of texture information parameters in the pattern area through a gray level co-occurrence matrix; wherein the texture information parameters include at least one of the following: energy, correlation, and inverse variance; and determine the polar coordinate defect area according to the parameter values.
[0014] Optionally, the detection device for surface defects of optical elements also includes: a suspected defect analysis module, which is used to obtain a first total number of pixel points in the pattern area after the determination module determines the polar coordinate defect area based on the pattern areas of the remaining patterns in the polar coordinate image; when the first total number is less than a preset number threshold, the polar coordinate defect area is modified to a polar coordinate suspected defect area; a processing module, which is used to mark the defect area corresponding to the polar coordinate defect area in the grayscale image in a first manner, and to mark the suspected defect area corresponding to the polar coordinate suspected defect area in the grayscale image in a second manner.
[0015] Optionally, for the detection of surface defects of optical elements, the detection device for surface defects of optical elements also includes: a lamp shadow analysis module, which is used to perform regional growth on the polar coordinate defect area after the determination module determines the polar coordinate defect area based on the pattern area of each remaining pattern in the polar coordinate image, so as to obtain a corresponding growth area; wherein the difference in grayscale values of two adjacent pixel points in the growth area is less than a preset difference threshold; obtain a second total number of pixel points in the growth area; and when it is determined that the second total number is less than the preset number threshold, determine that the polar coordinate defect area is a lamp shadow area.
[0016] Optionally, the above pattern is a Fresnel pattern.
[0017] According to a third aspect of the present application, an electronic device is also provided, including a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the computer program to implement the method according to the first aspect of the present application.
[0018] According to a fourth aspect of the present application, a computer-readable storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, the method according to the first aspect of the present application is implemented.
[0019] One beneficial effect of the present application is that, for an optical element whose surface to be inspected is etched with patterns for realizing optical functions, it is possible to obtain a grayscale image of the surface to be inspected, then obtain a polar coordinate image of the pattern area of the distributed patterns in the grayscale image, then remove the pattern pattern corresponding to the pattern in the polar coordinate image, then determine the polar coordinate defect area based on the pattern area of each remaining pattern in the polar coordinate image, and finally mark the defect area corresponding to the polar coordinate defect area in the grayscale image. It can be seen from this that the present application can eliminate the interference of the patterns for realizing optical functions on the surface to be inspected on the detection results, so that the patterns for realizing optical functions will not be misjudged as defects in the output detection results, thereby effectively solving the problem in the prior art of low accuracy of the detection results due to the inability to eliminate the interference of the patterns when performing defect detection on the surface of an optical element etched with patterns for realizing optical functions, and effectively improving the accuracy of the detection results of surface defects of optical elements.
[0020] Other features and advantages of the embodiments of the present application will become apparent from the following detailed description of exemplary embodiments of the present application with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the description, serve to explain the principles of the embodiments of the present application.
[0022] Figure 1 is a flow chart of a method for detecting surface defects of an optical element according to some embodiments of the present application;
[0023] Figure 2 A grayscale image obtained in a method for detecting surface defects of an optical element according to some embodiments of the present application;
[0024] Figure 3 Based on Figure 2 The polar coordinate image obtained from the grayscale image;
[0025] Figure 4 Schematic diagram of coordinate points of bilinear interpolation in a method for detecting surface defects of an optical element according to some embodiments of the present application;
[0026] Figure 5 Schematic diagram of an image obtained after removing a pattern corresponding to a pattern in a polar coordinate image in a method for detecting surface defects of an optical element according to some embodiments of the present application;
[0027] Figure 6 A flowchart of a method for determining a polar coordinate defect area in a method for detecting surface defects of an optical element according to some embodiments of the present application;
[0028] Figure 7 A flowchart of a method for determining a polar coordinate defect area in another method for detecting surface defects of an optical element according to some embodiments of the present application;
[0029] Figure 8 A flowchart of a method for determining a suspected defect area in polar coordinates in a method for detecting surface defects of an optical element according to some embodiments of the present application;
[0030] Figure 9 is a diagrammatic representation of a detection result in a method for detecting surface defects of an optical element according to some embodiments of the present application;
[0031] Figure 10 is a functional structural block diagram of an optical element surface defect detection device according to some embodiments of the present application;
[0032] Figure 11This is a schematic diagram of the hardware structure of an electronic device according to some embodiments of the present application. DETAILED DESCRIPTION
[0033] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be noted that unless otherwise specifically stated, the relative arrangements of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present application.
[0034] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.
[0035] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered part of the specification.
[0036] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0037] It should be noted that like reference numerals and letters refer to like items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0038] Currently, automated inspection of optical component surfaces is limited to smooth surfaces. However, in practice, some optical components have patterns etched on their surfaces to achieve optical functions (e.g., Fresnel patterns). For such optical components, automated inspection results may identify some or all of these patterns as defects, resulting in low inspection accuracy.
[0039] Based on the above-mentioned problems, the embodiments of the present application provide a method, device, electronic device and computer-readable storage medium for detecting surface defects of optical elements to solve the problem in the prior art of low accuracy of detection results when performing surface defect detection on optical elements with patterns etched on the surface for realizing optical functions.
[0040] Hereinafter, various embodiments and examples according to the present application will be described with reference to the accompanying drawings.
[0041] Figure 1 The following is a flow chart of a method for detecting surface defects of an optical element according to some embodiments of the present application. Figure 1 As shown, the method includes the following steps S110 to S150.
[0042] Step S110: Acquire a grayscale image of the surface to be inspected.
[0043] The surface to be inspected can be photographed to obtain an image of the surface to be inspected. A grayscale image corresponding to the image can then be obtained to obtain the aforementioned grayscale image. The aforementioned image is obtained by photographing the surface to be inspected directly, for example, directly above the surface to be inspected, to reduce image distortion caused by the photograph.
[0044] In the embodiment of the present application, a pattern for realizing an optical function is etched on the surface to be detected of the optical element, and the pattern may be, for example, a Fresnel pattern.
[0045] For example, Figure 2 As shown, Figure 2 The grayscale image of a surface to be inspected obtained in the embodiment of the present application, in which the surface to be inspected in the grayscale image is etched with Fresnel fringes (such as Figure 2 multiple rings in the bright streak shown).
[0046] Step S120: obtaining a polar coordinate image of a pattern area of a distribution pattern in the grayscale image.
[0047] A Blob algorithm may be used to determine at least one connected region in the grayscale image, and then the pattern region may be obtained based on parameters such as the position and shape of each connected region in the at least one connected region.
[0048] For example, a connected region near the boundary of the grayscale image can be determined from at least one connected region as a boundary connected region, and a pattern region of the distribution pattern can be obtained based on the boundary connected region. The number of boundary connected regions can be one or more. If there are multiple boundary connected regions, the multiple boundary connected regions can be expanded, and the closed region formed by connecting the multiple boundary connected regions can be used as the pattern region. If there is only one boundary connected region, the entire region within the boundary of the boundary connected region can be used as the pattern region. For example, if the boundary connected region is a closed irregular shape, the entire region within the irregular shape can be used as the pattern region. Polar coordinate transformation is then performed on the image within the pattern region to obtain a polar coordinate image of the pattern region.
[0049] Take the Fresnel pattern as an example, see Figure 2As shown, at least one connected area in the grayscale image includes the circular area where each of the multiple circular rings of the Fresnel pattern is located, as well as other areas other than the circular area, such as defect areas, suspected defect areas, and lamp shadow areas (for the introduction of defect areas, suspected defect areas, and lamp shadow areas, please refer to the corresponding descriptions below, which will not be repeated here). In this case, the circularity of each connected area is calculated, and the connected areas with a circularity of 0 or a circularity close to 0 (the specific parameter value is set by those skilled in the art according to actual conditions and is not limited in this embodiment of the present application) are determined as the circular areas of the Fresnel pattern, thereby determining the circular areas corresponding to each circular ring in the Fresnel pattern. After that, the radius of each ring is obtained, and the first ring and the second ring are determined according to the obtained results of the radius of each ring, wherein the radius of the first ring is smaller than the radii of the other rings except the first ring, and the radius of the second ring is larger than the radii of the other rings except the second ring. That is to say, the first ring is the smallest ring with the smallest radius among all the rings of the Fresnel pattern, and the second ring is the ring with the largest radius among all the rings of the Fresnel pattern, and the closed area enclosed by the first ring and the second ring is used as the pattern area.
[0050] When obtaining the polar coordinate image of the pattern area, the circumscribed circle radius of the second ring (i.e., the largest ring) is obtained, and then the pattern area is polar transformed according to the circumscribed circle radius to obtain the polar coordinate image (e.g., Figure 3 shown).
[0051] For example, polar coordinate transformation can be performed through the following steps S1 to S3:
[0052] Step S1: Establish a plane rectangular coordinate system and a polar coordinate system in the grayscale image, obtain the coordinates (x, y) of the grayscale image in the plane rectangular coordinate system, and convert (x, y) into (θ, r) in the polar coordinate system using the following formula.
[0053] θ=2πx / w;
[0054]
[0055] Wherein, R is the circumscribed circle radius of the largest ring, w is the width of the grayscale image (i.e., the length in the x direction of the plane rectangular coordinate system), and h is the height of the grayscale image (i.e., the length in the y direction of the plane rectangular coordinate system).
[0056] Step S2: Convert each coordinate point in the polar coordinates into a corresponding rectangular coordinate point (x', y') in the plane rectangular coordinate system.
[0057] x'=r*cosθ;
[0058] y'=r*sinθ.
[0059] Step S3: Assign the grayscale value at (x, y) to (x', y').
[0060] For the image of the pattern area in the grayscale image, after the above steps S1 to S3, the points in the image of the pattern area cannot completely correspond one-to-one to the points in the polar coordinate image, resulting in some points in the polar coordinate image cannot be assigned grayscale values. In this case, after executing step S3, step S4 is further executed.
[0061] Step S4: performing an interpolation operation on the target point in the polar coordinate image; wherein, there is no coordinate point corresponding to the target point in the image of the pattern area.
[0062] Bilinear interpolation can be used to perform interpolation operations on the target points in the polar coordinate image. Figure 4 As shown, function f(Q) is the grayscale value function in the polar coordinate image. The value of f(Q) is the grayscale value of Q(x, y) in the polar coordinate image. For Q0(x0, y0) in the polar coordinate image, there is no coordinate point corresponding to Q0(x0, y0) in the pattern area image, so the grayscale value of Q0(x0, y0) cannot be obtained after executing steps S1 to S3. The four points Q in the function f(Q) are 11 (x1, y1), Q 12 (x1, y2), Q 21 (x2, y1) and Q 22 The gray value of (x2, y2) exists, according to Q 11 (x1, y1), Q 12 The grayscale value of Q0(x0, y0) is calculated by using the grayscale values of Q(x1, y2), Q21(x2, y1) and Q22(x2, y2).
[0063] For example, according to Q 11 (x1, y1), Q 12 (x1, y2), Q 21 (x2, y1) and Q 22 The grayscale value of (x2, y2) is used to calculate the grayscale value of Q0(x0, y0) as follows:
[0064] First, linear interpolation is performed in the x direction using the following formula:
[0065]
[0066]
[0067] Then, linear interpolation is performed in the y direction using the following formula:
[0068]
[0069] Finally, according to the linear interpolation calculation results in the x direction and the y direction, we get:
[0070]
[0071] In some examples, in Q 11 (x1, y1), Q 12 (x1, y2), Q 21 (x2, y1) and Q 22 In the case of four adjacent coordinates (x2, y2), the denominator in the above calculation formula is 1, so the above calculation can be further simplified to obtain:
[0072]
[0073] Step S130: removing the pattern corresponding to the pattern in the polar coordinate image.
[0074] A preset n*n (n is the number of pixels, n is a natural number and satisfies: n>1) mask can be used to traverse the polar coordinate image to extract multiple target pixels. The grayscale value of the target pixel is greater than or equal to the average grayscale value of all pixels covered by the mask when the mask covers the first pixel.
[0075] For example, take n=30, use a 30*30 mask to traverse the polar coordinate image, obtain the grayscale value mean of all pixels covered by the mask, then extract the pixels under the mask whose grayscale value is greater than the grayscale value mean, determine the pattern in the polar coordinate image corresponding to the pattern (Fresnel patterns in polar coordinates are stripes extending in the horizontal direction), perform dilation processing on the pattern pattern (see the introduction to dilation processing later, which will not be repeated here), and then subtract the pixel points in the polar coordinate image from the pixel points in the image after dilation processing of the extracted pattern pattern to obtain an image without the pattern pattern in the polar coordinate image.
[0076] like Figure 5 As shown in (1) to (2), Figure 5 (1) is the polar coordinate image of the pattern area, Figure 5 (2) is the image obtained after removing the pattern corresponding to the pattern in the polar coordinate image.
[0077] In a specific implementation, n can be set by those skilled in the art according to actual conditions, and the present application embodiment does not limit this. For example, n can also be 45, 15, etc.
[0078] Step S140 : determining the polar coordinate defect area according to the pattern areas of the remaining patterns in the polar coordinate image.
[0079] In some embodiments, as Figure 6 As shown, the execution process of step S140 may include the following steps S610 to S620.
[0080] Step S610: performing dilation processing on the pattern area.
[0081] The expansion processing is performed on the pattern area, that is, the edge of the image in the pattern area is enlarged so that the breakpoints on the edge of the image can be filled or the pits on the edge of the image can be filled.
[0082] The method of expanding the edge of the image in the pattern area can be, for example: use a 3*3 structural element (9 pixels, the grayscale value of each pixel is set by a person skilled in the art according to actual conditions) to traverse the pattern area. If the grayscale values of the first pixel in the structural element and the second pixel in the pattern area masked by it are both 0, then the grayscale value of the second pixel in the pattern area is determined to be 0, otherwise the grayscale value of the second pixel in the pattern area is determined to be the grayscale value of the first pixel.
[0083] Of course, it can be understood that the above-listed methods for expanding the edge of the image in the pattern area are merely exemplary, and the embodiments of the present application include but are not limited to the above-listed methods for expanding the edge of the image in the pattern area.
[0084] Step S620: Determine the polar coordinate defect area based on the result of the dilation process; wherein the polar coordinate defect area includes: a closed pattern area formed by connecting multiple first pattern areas after the dilation process, and an original pattern area of the original pattern corresponding to the second pattern area that is not connected to other pattern areas after the dilation process.
[0085] After a segmentation operation (e.g., the pattern removal operation described above) of a target region in an image is performed, certain edges may be disconnected to form multiple sub-regions (i.e., first pattern regions). To restore the target region, the dilation process in step S610 is performed so that the multiple first pattern regions are connected to form a closed pattern region that is identical to or similar to the target region. This closed pattern region is then used as the polar coordinate defect region. For multiple second pattern regions that are not connected to form a closed pattern region, the original pattern region corresponding to the second pattern region is used as the polar coordinate defect region.
[0086] In other embodiments, Figure 7 As shown, the execution process of step S140 may include the following steps S710 to S720.
[0087] Step S710: Calculating parameter values of texture information parameters in the pattern area using a gray level co-occurrence matrix; wherein the texture information parameters include at least one of the following: energy, correlation, and inverse variance.
[0088] The gray level co-occurrence matrix is calculated as:
[0089] P(i,jd,θ)={(x,y)f(x,y)=i,f(x+dx,y+dy)=j;x,y=0,1,2...,N-1};
[0090] Wherein, d is the number of pixels between two pixels, θ includes any of the following: 0, 45°, 90° and 135°; i, j = 0, 1, 2..., L-1, L is the number of gray levels; (x, y) is the pixel coordinate, N is a natural number and N>0.
[0091] According to the gray level co-occurrence matrix, the characteristic quantities of the gray level co-occurrence matrix such as energy, correlation and inverse variance are obtained.
[0092] Energy transformation reflects the uniformity of the image's grayscale distribution and the coarseness and fineness of its texture. If the elements of the grayscale co-occurrence matrix are similar, the energy is low and the texture is more detailed. Conversely, if the elements of the grayscale co-occurrence matrix differ greatly, the energy is high, indicating a more uniform and regularly changing texture.
[0093] Correlation is used to measure the similarity of the grayscale levels of an image in the row or column direction. The greater the correlation, the higher the similarity of the grayscale levels of the image in the row or column direction, and vice versa.
[0094] The inverse variance reflects the magnitude of local changes in image texture. If the image texture is relatively uniform in different regions and changes slowly, the inverse variance is larger, and vice versa.
[0095] The calculation method of energy, correlation and inverse variance can refer to the calculation method of correlation and inverse variance of gray-level co-occurrence matrix disclosed in the prior art, which will not be described in detail in the embodiments of this application.
[0096] Step S720: Determine the polar coordinate defect area according to the parameter value.
[0097] The filtering conditions corresponding to each texture information parameter can be pre-set. When the parameter value of the texture information parameter meets the filtering conditions, the pattern area is determined to be a polar coordinate defect area; when the parameter value of the texture information parameter does not meet the filtering conditions, the pattern area is determined not to be a polar coordinate defect area.
[0098] The screening conditions can be set by those skilled in the art based on actual circumstances and are not limited in the embodiments of the present application. For example, a parameter value range corresponding to each texture information parameter is set. If the parameter value of the texture information parameter falls within the corresponding parameter value range, the texture information parameter is determined to meet the screening conditions. If all texture information parameters of the pattern area meet the screening conditions, the pattern area is determined to be a polar coordinate defect area; otherwise, the pattern area is determined not to be a polar coordinate defect area.
[0099] Step S150: marking the defect area corresponding to the polar coordinate defect area in the grayscale image.
[0100] A defect area corresponding to the polar coordinate defect area is determined in the grayscale image, and then the defect area corresponding to the polar coordinate defect area is marked in the grayscale image in a preset marking manner.
[0101] The preset marking method can be set by those skilled in the art according to actual conditions, and the embodiments of the present application are not limited to this.
[0102] In some embodiments, in order to more accurately identify the defective area where each defect is located in the grayscale image, after executing step S140, as shown in FIG. Figure 8 As shown, the embodiment of the present application can also execute steps S810 to S820.
[0103] Step S810: Obtain a first total number of pixels in the pattern area.
[0104] The method for obtaining the first total number of pixel points in the pattern area can be set by those skilled in the art according to actual conditions, and the embodiments of the present application are not limited to this.
[0105] Step S820: When the first total number is less than a preset number threshold, the polar coordinate defect area is modified into a polar coordinate suspected defect area.
[0106] In some embodiments, since the grayscale image is obtained by taking an imaging image of the surface to be detected, the imaging image may also be affected by the surrounding environment. For example, since the process of photographing the surface to be detected requires a light source to provide illumination (it is impossible to obtain an imaging image in a completely dark environment without a light source), in this case, the light source may appear in the imaging image of the surface to be detected, forming a light shadow area. The light shadow area is not a defect area, but the light shadow area is similar to the defect area in appearance, so it is easy to be misjudged as a defect area. For example, some dust or very small floating objects in the air and other interferences are also easily captured in the imaging image, causing interference with the determination of the defect area. The area corresponding to the image formed by the above interference in the image is usually smaller than the defect area corresponding to the defect of the surface to be detected. Therefore, in order to eliminate the above interference, the embodiment of the present application uses the polar coordinate defect area whose first total number is less than the preset number threshold as the polar coordinate suspected defect area, so that it is convenient for relevant personnel to conduct further analysis after marking it later.
[0107] In some examples, the preset quantity threshold is 25. Of course, it is understandable that the preset quantity threshold can be set by those skilled in the art according to actual conditions, and the preset quantity threshold in the embodiment of the present application includes but is not limited to the values listed above.
[0108] After executing step S820, step S150 can be executed in the following manner: when the defect area corresponding to the polar coordinate defect area is marked in the grayscale image in the first manner, the suspected defect area corresponding to the polar coordinate suspected defect area is marked in the grayscale image in the second manner. In this way, the defect area and the suspected defect area are marked in different ways, which is convenient for relevant personnel to conduct further analysis. Figure 9 As shown, multiple defect areas are marked in the grayscale image using a first method. The corresponding defects in the defect areas are, for example, scratches (e.g., ordinary scratches, light scratches, wear scratches, and Fresnel scratches (i.e., scratches that penetrate the Fresnel fringes)) or attached contaminants. Multiple suspected defect areas are marked in the grayscale image using a second method. The first and second methods are different.
[0109] In actual situations, the light shadow area and the defect area are highly similar. Therefore, in order to more accurately eliminate the interference of the light shadow area on the accuracy of the detection results in the embodiments of the present application, in some embodiments, after executing step S140, the embodiments of the present application can also perform region generation on the polar coordinate defect area to obtain a corresponding growth area, wherein the difference in the grayscale values of two adjacent pixels in the growth area is less than a preset difference threshold.
[0110] For example, the first grayscale value of a target coordinate point (x3, y3) in the polar coordinate defect area is selected, and then the second grayscale value of the growth coordinate point (x4, y4) adjacent to the target coordinate point (x3, y3) and not located within the polar coordinate defect area is obtained, and the difference between the first grayscale value and the second grayscale value is calculated. If the difference is less than the preset difference threshold, the growth coordinate point (x4, y4) is used as the target pixel point in the polar coordinate defect area. The above process is repeated until the obtained grayscale value difference is greater than or equal to the preset difference threshold, then the calculation is stopped, and the final polar coordinate defect area is used as the growth area.
[0111] After obtaining the corresponding growth area, a second total number of pixels in the growth area is obtained. If it is determined that the second total number is less than a preset number threshold, the polar coordinate defect area is determined to be a lamp shadow area. In this case, the polar coordinate defect area may no longer be marked in step S150, thereby eliminating the interference of the lamp shadow; alternatively, the lamp shadow area may be marked in step S150 in the same manner as the suspected defect area to facilitate further analysis by relevant personnel; alternatively, in step S150, the defect area may be marked in the first manner, the suspected defect area may be marked in the second manner, and the lamp shadow area may be marked in the third manner, so as to provide relevant personnel with more accurate marking results and facilitate further analysis by relevant personnel.
[0112] The first, second, and third modes are all different. For example, the marking colors used in the first, second, and third modes are different. The specific forms of the first, second, and third modes can be set by those skilled in the art according to actual conditions, and the embodiments of this application are not limited thereto.
[0113] One beneficial effect of the embodiments of the present application is that, for an optical element whose surface to be inspected is etched with patterns for realizing optical functions, it is possible to obtain a grayscale image of the surface to be inspected, then obtain a polar coordinate image of the pattern area of the distributed patterns in the grayscale image, then remove the pattern pattern corresponding to the pattern in the polar coordinate image, then determine the polar coordinate defect area based on the pattern area of each remaining pattern in the polar coordinate image, and finally mark the defect area corresponding to the polar coordinate defect area in the grayscale image. It can be seen that the embodiments of the present application can eliminate the interference of the patterns for realizing optical functions on the surface to be inspected on the detection results, so that the patterns for realizing optical functions will not be mistakenly judged as defects in the output detection results, thereby effectively solving the problem in the prior art of low accuracy of the detection results due to the inability to eliminate the interference of the patterns when performing defect detection on the surface of an optical element etched with patterns for realizing optical functions, and effectively improving the accuracy of the detection results of defects on the surface of the optical element.
[0114] <Equipment Example>
[0115] Figure 10 FIG. 1 is a functional block diagram of a device for detecting surface defects of an optical element according to some embodiments of the present application. Figure 10 As shown, the optical element surface defect detection device 1000 may include a first acquisition module 1010 , a second acquisition module 1020 , a removal module 1030 , a determination module 1040 and a processing module 1050 .
[0116] The first acquisition module 1010 is used to acquire a grayscale image of the surface to be detected.
[0117] The second acquisition module 1020 is configured to acquire a polar coordinate image of a pattern region of a distribution pattern in a grayscale image.
[0118] The removal module 1030 is configured to remove the pattern corresponding to the pattern in the polar coordinate image.
[0119] The determination module 1040 is configured to determine the polar coordinate defect area according to the pattern areas of the remaining patterns in the polar coordinate image.
[0120] The processing module 1050 is configured to mark the defect area corresponding to the polar coordinate defect area in the grayscale image.
[0121] Optionally, the determination module is used to: perform expansion processing on the pattern area; determine the polar coordinate defect area based on the result of the expansion processing; wherein the polar coordinate defect area includes: a closed pattern area connected by multiple first pattern areas after the expansion processing, and an original pattern area of the original pattern corresponding to the second pattern area that is not connected to other pattern areas after the expansion processing.
[0122] Optionally, the determination module is used to: calculate parameter values of texture information parameters in the pattern area through a gray level co-occurrence matrix; wherein the texture information parameters include at least one of the following: energy, correlation, and inverse variance; and determine the polar coordinate defect area according to the parameter values.
[0123] Optionally, the detection device for surface defects of optical elements also includes: a suspected defect analysis module, which is used to obtain a first total number of pixel points in the pattern area after the determination module determines the polar coordinate defect area based on the pattern areas of the remaining patterns in the polar coordinate image; when the first total number is less than a preset number threshold, the polar coordinate defect area is modified to a polar coordinate suspected defect area; a processing module, which is used to mark the defect area corresponding to the polar coordinate defect area in the grayscale image in a first manner, and to mark the suspected defect area corresponding to the polar coordinate suspected defect area in the grayscale image in a second manner.
[0124] Optionally, the detection device for surface defects of optical elements also includes: a lamp shadow analysis module, which is used to perform regional growth on the polar coordinate defect area after the determination module determines the polar coordinate defect area based on the pattern area of each remaining pattern in the polar coordinate image, so as to obtain a corresponding growth area; wherein the difference in grayscale values of two adjacent pixel points in the growth area is less than a preset difference threshold; obtain a second total number of pixel points in the growth area; and when it is determined that the second total number is less than the preset number threshold, determine that the polar coordinate defect area is a lamp shadow area.
[0125] Optionally, the above pattern is a Fresnel pattern.
[0126] Figure 11 is a schematic diagram of the hardware structure of an electronic device according to another embodiment.
[0127] like Figure 11 As shown, the electronic device 1100 includes a processor 1110 and a memory 1120, wherein the memory 1120 is used to store an executable computer program, and the processor 1110 is used to execute a method as any of the above method embodiments under the control of the computer program.
[0128] The electronic device 1100 may be a computer.
[0129] Each module in the above optical element surface defect detection device 1000 can be implemented by the processor 1110 in this embodiment executing a computer program stored in the memory 1120, or can be implemented by other circuit structures, which is not limited here.
[0130] The beneficial effects in the device embodiment can be found in the corresponding description of the beneficial effects in the above method embodiment, which will not be repeated here.
[0131] The present application may be a system, method and / or computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present application.
[0132] A computer-readable storage medium can be a tangible device that can hold and store instructions for use by an instruction execution device. A computer-readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination thereof. As used herein, a computer-readable storage medium is not to be construed as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through an electrical wire.
[0133] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.
[0134] The computer program instructions for performing the operation of the present application can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data or source code or object code written in any combination of one or more programming languages, wherein the programming language includes object-oriented programming languages such as Smalltalk, C++, and conventional procedural programming languages such as "C" language or similar programming languages. Computer-readable program instructions can be executed completely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or executed completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer by any type of network including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (such as by using an Internet service provider to connect to the Internet). In certain embodiments, by utilizing the state information of computer-readable program instructions to personalize electronic circuits, such as programmable logic circuits, field programmable gate arrays (FPGAs) or programmable logic arrays (PLAs), the electronic circuits can execute computer-readable program instructions, thereby realizing various aspects of the present application.
[0135] Various aspects of the present application are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.
[0136] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0137] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0138] The flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that implementation by hardware, implementation by software, and implementation by a combination of software and hardware are all equivalent.
[0139] The embodiments of the present application have been described above. The above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terms used herein are selected to best explain the principles of the embodiments, their practical applications, or technical improvements in the marketplace, or to enable other persons skilled in the art to understand the embodiments disclosed herein. The scope of this application is defined by the appended claims.
Claims
1. A method for detecting surface defects of an optical element, characterized in that: The surface of the optical element to be inspected is etched with a pattern for realizing an optical function, and the pattern is a Fresnel pattern. The method includes: Acquire a grayscale image of the surface to be detected; Acquire a polar coordinate image of a pattern area in which the pattern is distributed in the grayscale image; removing the pattern corresponding to the pattern in the polar coordinate image; determining a polar coordinate defect area according to pattern areas of the remaining patterns in the polar coordinate image; marking a defect area corresponding to the polar coordinate defect area in the grayscale image; The obtaining of a polar coordinate image of a pattern region in which a pattern is distributed in a grayscale image comprises: determining at least one connected region in the grayscale image using a preset algorithm, obtaining a pattern region in the grayscale image in which the pattern is distributed based on position and shape parameters of each connected region in the at least one connected region, and performing polar coordinate transformation on the image in the pattern region to obtain a polar coordinate image of the pattern region; The removing of the pattern corresponding to the pattern in the polar coordinate image includes: using a preset n*n mask to traverse the polar coordinate image and extract a plurality of target pixels, wherein the grayscale values of the plurality of target pixels are greater than or equal to the average grayscale values of all pixels covered by the mask when the mask covers the first pixel; Determine a pattern in the polar coordinate image that corresponds to the pattern, dilate the pattern pattern, and then subtract the pixel points in the polar coordinate image from the pixel points in the image after the dilation process of the extracted pattern pattern to obtain an image in which the pattern in the polar coordinate image that corresponds to the pattern is removed.
2. The method according to claim 1, characterized in that The determining of the polar coordinate defect area according to the pattern area of each remaining pattern in the polar coordinate image includes: performing expansion processing on the pattern area; The polar coordinate defect area is determined based on the result of the dilation process; wherein the polar coordinate defect area includes: a closed pattern area formed by connecting multiple first pattern areas after the dilation process, and an original pattern area of the original pattern corresponding to a second pattern area that is not connected to other pattern areas after the dilation process.
3. The method according to claim 1, characterized in that The determining of the polar coordinate defect area according to the pattern area of each remaining pattern in the polar coordinate image includes: Calculating parameter values of texture information parameters in the pattern area using a gray level co-occurrence matrix; wherein the texture information parameters include at least one of the following: energy, correlation, and inverse variance; The polar coordinate defect area is determined according to the parameter value.
4. The method according to claim 1, wherein After determining the polar coordinate defect area according to the pattern area of each remaining pattern in the polar coordinate image, the method further includes: Obtaining a first total number of pixels in the pattern area; When the first total number is less than a preset number threshold, modifying the polar coordinate defect area into a polar coordinate suspected defect area; The marking of the defect area corresponding to the polar coordinate defect area in the grayscale image includes: The defect area corresponding to the polar coordinate defect area is marked in the grayscale image in a first manner, and the suspected defect area corresponding to the polar coordinate suspected defect area is marked in the grayscale image in a second manner.
5. The method according to claim 1, wherein After determining the polar coordinate defect area according to the pattern area of each remaining pattern in the polar coordinate image, the method further includes: Performing region growing on the polar coordinate defect region to obtain a corresponding growth region; wherein a difference in grayscale values between two adjacent pixels in the growth region is less than a preset difference threshold; Obtaining a second total number of pixels in the growth area; When the second total number is less than a preset number threshold, the polar coordinate defect area is determined to be a lamp shadow area.
6. A device for detecting surface defects of an optical element, characterized in that: The surface of the optical element to be detected is etched with a pattern for realizing an optical function, and the pattern is a Fresnel pattern. The device comprises: A first acquisition module is used to acquire a grayscale image of the surface to be detected; A second acquisition module is used to acquire a polar coordinate image of a pattern area where the pattern is distributed in the grayscale image; a removal module, configured to remove the pattern corresponding to the pattern in the polar coordinate image; a determination module, configured to determine a polar coordinate defect area according to pattern areas of the remaining patterns in the polar coordinate image; a processing module, configured to mark a defect area corresponding to the polar coordinate defect area in the grayscale image; The second acquisition module is further configured to determine at least one connected region in the grayscale image using a preset algorithm, obtain a pattern region in the grayscale image where the pattern is distributed based on the position and shape parameters of each connected region in the at least one connected region, and perform polar coordinate transformation on the image within the pattern region to obtain a polar coordinate image of the pattern region; The removing of the pattern corresponding to the pattern in the polar coordinate image includes: using a preset n*n mask to traverse the polar coordinate image and extract a plurality of target pixels, wherein the grayscale values of the plurality of target pixels are greater than or equal to the average grayscale values of all pixels covered by the mask when the mask covers the first pixel; Determine a pattern in the polar coordinate image that corresponds to the pattern, dilate the pattern pattern, and then subtract the pixel points in the polar coordinate image from the pixel points in the image after the dilation process of the extracted pattern pattern to obtain an image in which the pattern in the polar coordinate image that corresponds to the pattern is removed.
7. The device according to claim 6, characterized in that The determining module is used for: performing expansion processing on the pattern area; The polar coordinate defect area is determined based on the result of the dilation process; wherein the polar coordinate defect area includes: a closed pattern area formed by connecting multiple first pattern areas after the dilation process, and an original pattern area of the original pattern corresponding to a second pattern area that is not connected to other pattern areas after the dilation process.
8. The device according to claim 6, characterized in that The determining module is used for: Calculating parameter values of texture information parameters in the pattern area using a gray level co-occurrence matrix; wherein the texture information parameters include at least one of the following: energy, correlation, and inverse variance; The polar coordinate defect area is determined according to the parameter value.
9. The device according to claim 6, characterized in that The device further comprises: a suspected defect analysis module, configured to, after the determination module determines the polar coordinate defect area based on the pattern areas of the remaining patterns in the polar coordinate image, obtain a first total number of pixels in the pattern area; and modify the polar coordinate defect area into a polar coordinate suspected defect area if the first total number is less than a preset number threshold; The processing module is configured to mark the defect area corresponding to the polar coordinate defect area in the grayscale image in a first manner, and mark the suspected defect area corresponding to the polar coordinate suspected defect area in the grayscale image in a second manner.
10. The device according to claim 6, characterized in that The device further comprises: a light shadow analysis module, configured to, after the determination module determines the polar coordinate defect region based on the pattern regions of the remaining patterns in the polar coordinate image, perform region growing on the polar coordinate defect region to obtain a corresponding growth region; wherein a difference in grayscale values between two adjacent pixels in the growth region is less than a preset difference threshold; Obtaining a second total number of pixels in the growth area; When it is determined that the second total number is less than a preset number threshold, the polar coordinate defect area is determined to be a lamp shadow area.
11. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the computer program to implement the method according to any one of claims 1 to 5.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which implements the method according to any one of claims 1 to 5 when executed by a processor.
Citation Information
Patent Citations
Lens detection method and related device
CN113706446A