Lens defect detection method, device and equipment and storage medium

By calculating the grayscale variance of the target defect area in the lens image of the head-mounted display device, distinguishing the blurred and non-fuzzing defects, the problem of low accuracy of defect detection in the prior art is solved, and the accuracy of lens defect detection is improved .

CN119251156APending Publication Date: 2025-01-03GOERTEK OPTICAL TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411252073.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

In the detection of lens defects of head-mounted display devices, the clarity of the captured defects cannot be guaranteed, making it difficult to determine the defect type and area size, affecting the detection accuracy.

Method used

By acquiring the lens image, determining the target defect area and performing grayscale variance calculation, it can distinguish fuzzy defects from non-fuzzy defects, and improve detection accuracy.

Benefits of technology

Effectively distinguish between blurred defects and non-fuzzy defects in lens images, avoid misjudgment caused by clarity problems, and improve the accuracy of lens defect detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119251156A_ABST
    Figure CN119251156A_ABST
Patent Text Reader

Abstract

The invention discloses a lens defect detection method, device and equipment and a storage medium, and relates to the technical field of head-mounted display equipment, and the method comprises the steps: obtaining a lens image, and determining a target defect region from the lens image; performing gray variance calculation on the target defect area to obtain a calculation result; and determining a defect detection result of the target defect area according to the calculation result, the defect detection result being a fuzzy defect or a non-fuzzy defect. According to the invention, the true condition of the lens defect can be determined, so that the accuracy of lens defect detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of head-mounted display devices, and in particular to lens defect detection methods, devices, equipment and storage media. Background Art

[0002] With the rapid development of AR (Augmented Reality) technology, VR (Virtual Reality) technology and MR (Mixed Reality) technology, head-mounted display devices such as AR / VR / MR devices have gradually been integrated into people's daily lives and become an important part of modern technological experience.

[0003] In the production process of head-mounted display devices, if the defects of the screen such as bad pixels, dirt, and scratches are not discovered and handled in time, it will directly affect the screen display quality of the device. At present, the defect detection of the device lens can be carried out through image processing software. Specifically, the lens image is captured by an image acquisition device, and then the image processing software is used to identify the defects of the image. However, since the clarity of the captured defects cannot be guaranteed, it is difficult to determine the actual situation of the defects when distinguishing the defect type and defect area of ​​the lens based on the captured lens image, which affects the accuracy of defect detection.

[0004] In summary, how to determine the true situation of lens defects to improve the accuracy of lens defect detection has become a technical problem that urgently needs to be solved in this field. Summary of the invention

[0005] The main purpose of this application is to provide a lens defect detection method, device, equipment and storage medium, aiming to determine the actual situation of lens defects in order to improve the accuracy of lens defect detection.

[0006] To achieve the above objectives, the present application proposes a lens defect detection method, which includes:

[0007] Acquire a lens image, and determine a target defect area from the lens image;

[0008] Performing grayscale variance calculation on the target defect area to obtain a calculation result;

[0009] A defect detection result of the target defect area is determined according to the calculation result, wherein the defect detection result is a fuzzy defect or a non-fuzzy defect.

[0010] In one embodiment, the step of determining a target defect area from the lens image comprises:

[0011] Binarizing the lens image according to a global threshold of the lens image to obtain a binary image;

[0012] Determine a binary initial defect area in the binary image, and determine a first coordinate position of the binary initial defect area in the binary image;

[0013] An initial defect region corresponding to the binary initial defect region is determined in the lens image according to the first coordinate position, and a target defect region is determined from the initial defect region.

[0014] In one embodiment, the step of determining the target defect area from the initial defect area includes:

[0015] intercepting the initial defect area from the lens image to obtain an initial defect image;

[0016] Binarizing the initial defect image according to a local threshold of the initial defect image to obtain a binarized initial defect image;

[0017] Determine a binary target defect area in the binary initial defect image, and determine a second coordinate position of the binary target defect area in the binary initial defect image;

[0018] A target defect area corresponding to the binarized target defect area is determined in the initial defect image according to the second coordinate position.

[0019] In one embodiment, the step of calculating the grayscale variance of the target defect area to obtain the calculation result includes:

[0020] intercepting the target defect area from the lens image to obtain a target defect image;

[0021] A grayscale variance calculation is performed on the target defect image to obtain a calculation result.

[0022] In one embodiment, the step of performing grayscale variance calculation on the target defect image to obtain a calculation result includes:

[0023] Determining an image center point of the target defect image;

[0024] The grayscale variance values ​​of the center point of the image in multiple different preset directions are calculated, and the multiple grayscale variance values ​​obtained by calculation are used as calculation results.

[0025] In one embodiment, the step of determining the defect detection result of the target defect area according to the calculation result includes:

[0026] Determining the defect state of the center point of the image in a plurality of different preset directions according to each of the grayscale variance values, wherein the defect state is a fuzzy state or a non-fuzzy state;

[0027] When the number of defect states in the fuzzy state exceeds a preset number threshold, determining that the defect detection result of the target defect area is a fuzzy defect;

[0028] When the number of defect states in the fuzzy state does not exceed the preset number threshold, it is determined that the defect detection result of the target defect area is a non-fuzzy defect.

[0029] In one embodiment, the step of determining the defect state of the center point of the image in a plurality of different preset directions according to each of the grayscale variance values ​​comprises:

[0030] For a first grayscale variance value among the grayscale variance values, comparing the first grayscale variance value with a preset variance threshold;

[0031] When the first grayscale variance value is less than or equal to the variance threshold, determining that the defect state of the center point of the image in the direction corresponding to the first grayscale variance value is a fuzzy state;

[0032] When the first grayscale variance value is greater than the variance threshold, it is determined that the defect state of the image center point in the direction corresponding to the first grayscale variance value is a non-fuzzy state.

[0033] In addition, to achieve the above-mentioned purpose, the present application also proposes a lens defect detection device, which includes:

[0034] A defect area determination module, used to obtain a lens image and determine a target defect area from the lens image;

[0035] A calculation module, used for performing grayscale variance calculation on the target defect area to obtain a calculation result;

[0036] A defect detection module is used to determine a defect detection result of the target defect area according to the calculation result, wherein the defect detection result is a fuzzy defect or a non-fuzzy defect.

[0037] In addition, to achieve the above-mentioned purpose, the present application also proposes a lens defect detection device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the lens defect detection method as described above.

[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium. A computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the lens defect detection method as described above are implemented.

[0039] The present application proposes a lens defect detection method, which obtains a lens image and identifies and locates a target defect area from the lens image. The target defect area includes but is not limited to areas on the lens where defects such as bad spots, dirt, and scratches exist. Grayscale variance calculation is performed on the determined target defect area. By calculating this value, the blur degree of the target defect area can be quantitatively analyzed. Finally, based on the calculation result of the grayscale variance calculation, it is determined that the defect detection result of the target defect area is a blurred defect or a non-fuzzy defect.

[0040] The present application calculates the grayscale variance of the target defect area in the lens image, thereby being able to evaluate the blurriness of the target defect area, and thereby effectively distinguish between blurred defects (which may be caused by shooting conditions) and non-blurred defects (which directly reflect the real defects of the lens) in the lens image, thereby avoiding the misjudgment of defects caused by clarity problems in traditional lens defect detection methods and improving the accuracy of lens defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0043] Figure 1 A schematic diagram of a process flow provided for Embodiment 1 of the lens defect detection method of the present application;

[0044] Figure 2 A schematic diagram of a lens image provided in Example 2 of the lens defect detection method of the present application;

[0045] Figure 3 A schematic diagram of a binarized image provided in Example 2 of the lens defect detection method of the present application;

[0046] Figure 4 A schematic diagram of a binary initial defect area provided in Example 2 of the lens defect detection method of the present application;

[0047] Figure 5A schematic diagram of an initial defect area provided in Example 2 of the lens defect detection method of the present application;

[0048] Figure 6 A schematic diagram of a binary initial defect image provided in Embodiment 2 of the lens defect detection method of the present application;

[0049] Figure 7 A schematic diagram of a target defect area provided in Example 2 of the lens defect detection method of the present application;

[0050] Figure 8 This is a schematic diagram of the module structure of the lens defect detection device according to an embodiment of the present application;

[0051] Fig. 9 Schematic diagram of the device structure of the hardware operating environment involved in the lens defect detection method in the embodiment of the present application.

[0052] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0053] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0054] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0055] The main solution of the embodiment of the present application is: obtain a lens image, and determine the target defect area from the lens image; perform grayscale variance calculation on the target defect area to obtain a calculation result; determine the defect detection result of the target defect area based on the calculation result, wherein the defect detection result is a blurred defect or a non-fuzzy defect.

[0056] During the production process of head-mounted display devices, if the screen defects such as bad pixels, dirt, and scratches are not discovered and handled in time, it will directly affect the screen display quality of the device. At present, the device lens can be inspected for defects through image processing software. Specifically, the lens image is captured by an image acquisition device, and then the image processing software is used to identify the defects of the image. However, since the clarity of the captured defects cannot be guaranteed, it is difficult to determine the actual situation of the defects when distinguishing the defect type and defect area of ​​the lens based on the captured lens image, which affects the accuracy of defect detection.

[0057] The embodiment of the present application provides a solution. By calculating the grayscale variance of the target defect area in the lens image, the blur degree of the target defect area can be evaluated, and then the blurred defects (which may be caused by shooting conditions) and non-blurred defects (which directly reflect the real defects of the lens) in the lens image can be effectively distinguished, thereby avoiding the misjudgment of defects caused by clarity problems in traditional lens defect detection methods and improving the accuracy of lens defect detection.

[0058] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions. The following takes the lens defect detection terminal as an example to illustrate this embodiment and the following embodiments.

[0059] Based on this, the present application embodiment provides a lens defect detection method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the lens defect detection method of the present application.

[0060] In this embodiment, the lens defect detection method includes steps S10 to S30:

[0061] Step S10, acquiring a lens image, and determining a target defect area from the lens image;

[0062] In the production process of head-mounted display devices, in order to ensure the picture clarity of the head-mounted display devices, lens images are captured by image acquisition equipment (such as high-resolution cameras). The lens is an important component responsible for imaging in the head-mounted display device, and image processing technology (such as edge detection, threshold segmentation, morphological operations, etc.) is used to analyze the acquired lens image to identify and locate the target defect area in the lens image, where the target defect area is the area on the lens where defects exist. The defects may include bad pixels, dirt, scratches, edge glue overflow, transparent defects, etc., which will affect the clarity of the head-mounted display device and the user's viewing experience.

[0063] It should be noted that, since the defect may be at any position of the lens, in order to obtain a clearer imaging effect of the defect on the image, the camera can be focused at different depths of the lens, that is, the focal length of the camera is continuously changed to let the camera focus on the defects at different depths of the lens. The characteristic of defects at different depths on the lens displayed on the lens image is that when the focus position and the defect position are more consistent, the target defect area in the captured lens image is clearer. Therefore, in this embodiment, the focal length can be adjusted from the lens surface to the bottom surface to shoot multiple lens images, that is, the focal length is adjusted from the lens surface to the bottom surface of the lens, and multiple images are shot during the adjustment process, and the captured images are analyzed. In this embodiment, the number of lens images shot is not limited. In one implementation method, 10 images at 10 different focal lengths can be shot, and the target defect area in each image can be determined.

[0064] Step S20, performing grayscale variance calculation on the target defect area to obtain a calculation result;

[0065] The grayscale variance of the target defect area is calculated, where the grayscale variance is a statistic that measures the degree of change in pixel values. It reflects the texture complexity and contrast of the image. For the target defect area, the calculation of the grayscale variance can reveal the change in pixel values ​​in the area, thereby indirectly reflecting the degree of blurring of the defect in the target defect area. The calculated grayscale variance value is recorded as the calculation result.

[0066] Step S30, determining a defect detection result of the target defect area according to the calculation result, wherein the defect detection result is a fuzzy defect or a non-fuzzy defect.

[0067] The defect detection result of the target defect area is determined as a blurred defect or a non-blurred defect according to the grayscale variance calculation result of the target defect area. The "blurring" mentioned here refers to the unclear or difficult to identify features of these defects on the image.

[0068] For example, by setting a grayscale variance threshold, the calculated grayscale variance value can be compared with the grayscale variance threshold. If the grayscale variance value is lower than the threshold, the target defect area is judged to be a blurred defect, which may be due to the shooting conditions (such as the captured defect is not in the best focus plane of the camera). If the grayscale variance value is higher than the threshold, it is judged to be a non-blurred defect, indicating real defects such as scratches, cracks or bubbles on the lens.

[0069] It is also possible to use sample images of known blurred defects and non-fuzzy defects to train a classification model (such as a support vector machine, a neural network, etc.), and use the model to learn the grayscale features of different types of defects, so as to automatically identify the target defect area in the new image, and input the calculated grayscale variance value of the target defect area into the model. The model will output the prediction result of whether the target defect area is a fuzzy defect or a non-fuzzy defect.

[0070] The grayscale variance values ​​of multiple target defect areas may also be clustered and analyzed, and the identified defects may be divided into fuzzy defects and non-fuzzy defects according to the clustering results.

[0071] In a feasible implementation, after obtaining multiple lens images of the lens to be inspected at different focal lengths, the target defect area in each image is determined, the defect detection result of each target defect area is determined, and defect detection is performed on the target defect area whose defect detection result in the lens image is a non-blurred defect, that is, the area and type of the defect of the lens are identified through a clear target defect area to avoid misdetection due to blurred image.

[0072] It should be noted that, in the case where the defect detection result in the lens image is a blurred defect, the embodiment of the present application first identifies the target coordinate area of ​​the blurred defect in the lens image, and then eliminates the blurred defect by changing the current shooting focal length used to shoot the lens image to be detected, that is, by adjusting the current shooting focal length, the image of the target coordinate area is converted into a clear image, and the clear image can be used to identify whether there is a non-blurred defect in the target coordinate area (the non-blurred defect directly reflects the real defect of the lens), thereby avoiding the misjudgment of defects caused by clarity problems in traditional lens defect detection methods (that is, avoiding directly identifying blurred defects as defects existing in the lens to be detected itself).

[0073] Specifically, after the embodiment of the present application identifies a blurred defect at a first shooting focal length, the first shooting focal length is adjusted to a second shooting focal length different from the first shooting focal length to shoot the lens to be detected, so as to facilitate further accurate identification of whether the target coordinate area of ​​the blurred defect actually has a lens defect (i.e., a non-blurred defect). If in the lens image obtained by shooting at at least one second shooting focal length, it is identified that the target coordinate area still has a target defect area, the target defect area is marked as a spare target defect area, and then the defect detection result of the spare target defect area is calculated. When the defect detection result is a non-blurred defect, it is determined that the target coordinate area actually has a lens defect. If the defect detection result is still a blurred defect, the shooting focal length is continued to be changed, and the target coordinate area is continuously identified at the new shooting focal length. Whether there is a target defect area, until the defect detection results of the target coordinate area in the lens images obtained by shooting at each preset shooting focal length are not non-blurred defects, it is determined that there is no lens defect in the target coordinate area.

[0074] In this way, this embodiment can evaluate the blurriness of the target defect area in the lens image by calculating the grayscale variance of the target defect area in the lens image, and then effectively distinguish between blurred defects (which may be caused by shooting conditions) and non-blurred defects (which directly reflect the real defects of the lens) in the lens image, thereby avoiding the misjudgment of defects caused by clarity problems in traditional lens defect detection methods and improving the accuracy of lens defect detection.

[0075] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. On this basis, step S10 can include steps S101 to S103:

[0076] Step S101, binarizing the lens image according to a global threshold of the lens image to obtain a binary image;

[0077] The lens image is binarized according to the global threshold of the lens image. By setting a unified threshold (i.e., global threshold), the pixels in the lens image are divided into two categories: pixels above the threshold are assigned a value (usually white), indicating the foreground or area of ​​interest in the image; pixels below the threshold are assigned another value (usually black), indicating the background or area of ​​no interest. After binarization, the lens image is converted into a binary image, making the edges and features in the image more obvious, which is convenient for subsequent defect analysis.

[0078] In a feasible implementation, before binarizing the lens image, the lens image is preprocessed by Fourier transform, convolution and deconvolution algorithms to improve the image quality, enhance the image features and provide a better image basis.

[0079] Step S102, determining a binary initial defect area in the binary image, and determining a first coordinate position of the binary initial defect area in the binary image;

[0080] In the binarized image, by analyzing the distribution and connectivity of pixel values, possible defect areas are identified as binary initial defect areas, which usually appear as connected areas in sharp contrast with the surrounding background, and the first coordinate position of the binary initial defect area in the binarized image is determined. The first coordinate position is used to subsequently locate the corresponding initial defect area in the original lens image.

[0081] Step S103, determining an initial defect region corresponding to the binary initial defect region in the lens image according to the first coordinate position, and determining a target defect region from the initial defect region.

[0082] Since the binarized image and the lens image are different screen representations of the same lens, the initial defect area corresponding to the binarized initial defect area can be determined in the original lens image according to the first coordinate position of the binarized initial defect area in the binarized image, and the target defect area can be determined from the initial defect area, wherein the initial defect area includes all the target defect areas, and the initial defect area can be a rectangular, elliptical or circular contour shape, which is not specifically limited in this embodiment.

[0083] For example, the lens image obtained is as follows: Figure 2 As shown in the figure, the black edge area is the opaque bracket that fixes the lens, and the gray area is the lens. The binary image obtained after binarization of the lens image is as shown in Figure 3 As shown, then, the binary initial defect area is determined from the binary image. The binary initial defect area is as follows Figure 4As shown, specifically, the center coordinates (x, y) of the suspected defect are determined from the binarized image through boundRect, and the binarized initial defect area (xn, yn, width, height) is determined according to the center coordinates and the area size, wherein the determined binarized initial defect area is a rectangular area, xn represents the horizontal coordinate of the upper left corner vertex of the rectangular area in the image, yn represents the vertical coordinate of the upper left corner vertex of the rectangular area in the image, and the value of n is determined by the area size of the suspected defect, such as setting n to 5 times the longest diameter of the suspected defect, width is the width of the rectangular area, and height is the height of the rectangular area, thereby determining the first coordinate position of the binarized initial defect area in the binarized image, and then determining the initial defect area corresponding to the binarized initial defect area in the lens image.

[0084] In a feasible embodiment, step S103 may include steps S1031 to S1034:

[0085] Step S1031, intercepting the initial defect area from the lens image to obtain an initial defect image;

[0086] According to the first coordinate position of the binarized initial defect area in the binarized image, an image portion of the initial defect area is intercepted in the original lens image to obtain an initial defect image, thereby narrowing the processing range and making subsequent operations more focused on the defect itself.

[0087] Step S1032, binarizing the initial defect image according to the local threshold of the initial defect image to obtain a binarized initial defect image;

[0088] The initial defect image is binarized according to the local threshold of the initial defect image to obtain a binary initial defect image. Different from the global threshold, the local threshold takes into account the brightness changes in different areas of the image. Applying the local threshold binarization processing to the initial defect image can more accurately segment the boundary between the defect area and the surrounding environment. After processing, a binary initial defect image is obtained, and the contrast between the defect area and the background in the image is further enhanced, which can more accurately identify the outline and shape of the defect.

[0089] Specifically, a local threshold method is used, that is, a statistical analysis is performed on the local area (such as a small neighborhood) around each pixel in the initial defect image, and then a threshold is determined for the pixel based on the characteristics of the area. For each pixel in the initial defect image, the threshold of its local area is first determined, and then the gray value of the pixel is compared with the local threshold. The color of the pixel in the binary initial defect image is determined based on the comparison result. If the gray value of the pixel is greater than or equal to the threshold, the pixel is set to white in the binary initial defect image; if it is less than the threshold, it is set to black. In this way, the defect information in the image can be extracted more accurately.

[0090] Step S1033, determining a binary target defect area in the binary initial defect image, and determining a second coordinate position of the binary target defect area in the binary initial defect image;

[0091] In the binary initial defect image, the binary target defect area is determined by analyzing the connectivity and shape characteristics of the pixel values. The determined area usually has clearer boundaries and more consistent pixel values, representing a more accurate defect location. Then, the second coordinate position of the binary target defect area in the binary initial defect image is determined.

[0092] Step S1034 , determining a target defect area corresponding to the binarized target defect area in the initial defect image according to the second coordinate position.

[0093] Since the binarized initial defect image and the initial defect image are different screen representations of the same area, the target defect area corresponding to the binarized target defect area can be determined in the initial defect image according to the second coordinate position of the binarized target defect area in the binarized initial defect image.

[0094] For example, the initial defect area captured from the lens image is as follows: Figure 5 As shown, Figure 5 The middle gray area is the lens, and the black area is the defect on the lens. The initial binary defect image obtained by adaptive binarization is as follows: Figure 6 As shown, then, the second coordinate position (x', y', width', height') of the binary target defect area in the binary initial defect image is calculated, and the target defect area corresponding to the binary target defect area in the initial defect image is determined according to the second coordinate position as shown in FIG. Figure 7 As shown, this area represents the effective part of the defect in the original lens image.

[0095] In a feasible embodiment, step S20 may include steps S201 to S202:

[0096] Step S201, intercepting the target defect area from the lens image to obtain a target defect image;

[0097] The determined target defect area is cut out from the original lens image to generate an image containing only this area, namely the target defect image, to ensure that subsequent analysis focuses on the specific defect location.

[0098] Step S202, performing grayscale variance calculation on the target defect image to obtain a calculation result.

[0099] The grayscale variance of the target defect image is calculated, and the calculated grayscale variance value is recorded as the calculation result.

[0100] In a feasible embodiment, step S202 may include steps S2021 to S2022:

[0101] Step S2021, determining the image center point of the target defect image;

[0102] The target defect image is located and its image center point is determined. The center point is usually the geometric center position of the image, and can also be dynamically determined based on the image content or analysis requirements.

[0103] Step S2022, calculating the grayscale variance values ​​of the center point of the image in multiple different preset directions, and taking the multiple grayscale variance values ​​obtained by calculation as calculation results.

[0104] For the center point of the image, the grayscale variance values ​​are calculated in multiple different preset directions (such as horizontal direction, vertical direction and possible diagonal direction, etc.) that are defined in advance, and the calculated grayscale variance values ​​in multiple directions are used as calculation results to evaluate the defect status of the defects in the target defect image.

[0105] In a feasible embodiment, step S2022 may include steps a10 to a30:

[0106] Step a10, determining the defect state of the center point of the image in a plurality of different preset directions according to each of the grayscale variance values, wherein the defect state is a fuzzy state or a non-fuzzy state;

[0107] For the center point of the image, the grayscale variance is calculated in multiple preset directions respectively, and the defect state in each direction is judged according to the calculated grayscale variance value in that direction. The defect state is divided into two types: fuzzy state and non-fuzzy state.

[0108] Step a20, when the number of defect states in the fuzzy state exceeds a preset number threshold, determining that the defect detection result of the target defect area is a fuzzy defect;

[0109] The number of directions in which the defect state is a fuzzy state is counted and compared with a preset threshold value. If the number of directions in the fuzzy state exceeds the threshold value, the overall defect detection result of the target defect area is judged to be a fuzzy defect, indicating that there is an obvious fuzzy problem in the area.

[0110] Step a30, when the number of defect states in the fuzzy state does not exceed the preset number threshold, determining that the defect detection result of the target defect area is a non-fuzzy defect.

[0111] If the number of directions in the fuzzy state does not exceed a preset number threshold, the defect detection result of the target defect area is determined to be a non-fuzzy defect.

[0112] In a feasible embodiment, step a10 may include steps a101 to a103:

[0113] Step a101, for a first grayscale variance value among the grayscale variance values, comparing the first grayscale variance value with a preset variance threshold;

[0114] Taking the first grayscale variance value among the grayscale variance values ​​as an example, the first grayscale variance value is compared with a preset variance threshold, wherein the preset variance threshold is determined based on prior knowledge or experimental data of the clarity and blurriness of the image, and is used to distinguish the clarity levels of the target defect image in different directions.

[0115] Step a102, when the first grayscale variance value is less than or equal to the variance threshold, determining that the defect state of the center point of the image in the direction corresponding to the first grayscale variance value is a blurred state;

[0116] If the first grayscale variance value is less than or equal to a preset variance threshold, it is determined that the clarity in the direction corresponding to the first grayscale variance value is insufficient, which manifests as a blurred state. This is because a lower grayscale variance value means that the pixel value changes in this direction are smaller, that is, the image is smoother, indicating possible blurring.

[0117] Step a103, when the first grayscale variance value is greater than the variance threshold, determining that the defect state of the image center point in the direction corresponding to the first grayscale variance value is a non-fuzzy state.

[0118] If the first grayscale variance value is greater than a preset variance threshold, it is determined that the direction corresponding to the first grayscale variance value is in a non-blurred state, which indicates that the pixel value in this direction changes significantly, the image clarity is high, and no blurring characteristics are exhibited.

[0119] In a feasible implementation, the grayscale gradient changes in the four directions of up, down, left, and right based on the center point of the image are counted, that is, the grayscale variance values ​​in each direction are calculated. First, based on the image center point, the image center point is traversed to the left to calculate i,j Gray value gray i,j , and calculate the gray value gray of the pixel on its left side in turn i-1,j , gray i-2,j ,...,gray i-N,j , then calculate the grayscale mean in the left direction, the calculation formula is:

[0120]

[0121] Where N represents the number of white pixels. Then, the grayscale variance value in the left direction is calculated according to the grayscale mean value in the left direction and the grayscale value of each pixel in the left direction. The calculation formula is:

[0122]

[0123] Then, the following formula is used to determine whether the left direction is in a fuzzy state:

[0124]

[0125] When the grayscale variance value variance_left i When the error is less than the variance threshold (variance_thres), the defect state on the left side is judged to be fuzzy (result_left i = OK), otherwise it is in the non-fuzzy state (result_left i =ng), similarly, the grayscale variance values ​​from the center point of the image to the upper, right, and lower directions are calculated in sequence to determine the defect state in each direction, and the variance thresholds in each direction may be different. When the number of defect states in a fuzzy state exceeds a preset number threshold, the defect detection result of the target defect area is determined to be a fuzzy defect, and when the number of defect states in a fuzzy state does not exceed the preset number threshold, the defect detection result of the target defect area is determined to be a non-fuzzy defect.

[0126] In this way, this embodiment can evaluate the blurriness of the target defect area in the lens image by calculating the grayscale variance of the target defect area in the lens image, and then effectively distinguish between blurred defects (which may be caused by shooting conditions) and non-blurred defects (which directly reflect the real defects of the lens) in the lens image, thereby avoiding the misjudgment of defects caused by clarity problems in traditional lens defect detection methods and improving the accuracy of lens defect detection.

[0127] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the lens defect detection method of the present application. More simple transformations based on this technical concept are all within the protection scope of the present application.

[0128] The present application also provides a lens defect detection device. Figure 8 , the lens defect detection device comprises:

[0129] A defect area determination module 10 is used to obtain a lens image and determine a target defect area from the lens image;

[0130] A calculation module 20 is used to calculate the grayscale variance of the target defect area to obtain a calculation result;

[0131] The defect detection module 30 is used to determine the defect detection result of the target defect area according to the calculation result, wherein the defect detection result is a fuzzy defect or a non-fuzzy defect.

[0132] Optionally, the defect area determination module 10 is further configured to:

[0133] Binarizing the lens image according to a global threshold of the lens image to obtain a binary image;

[0134] Determine a binary initial defect area in the binary image, and determine a first coordinate position of the binary initial defect area in the binary image;

[0135] An initial defect region corresponding to the binary initial defect region is determined in the lens image according to the first coordinate position, and a target defect region is determined from the initial defect region.

[0136] Optionally, the defect area determination module 10 is further configured to:

[0137] intercepting the initial defect area from the lens image to obtain an initial defect image;

[0138] Binarizing the initial defect image according to a local threshold of the initial defect image to obtain a binarized initial defect image;

[0139] Determine a binary target defect area in the binary initial defect image, and determine a second coordinate position of the binary target defect area in the binary initial defect image;

[0140] A target defect area corresponding to the binarized target defect area is determined in the initial defect image according to the second coordinate position.

[0141] Optionally, the computing module 20 is further configured to:

[0142] intercepting the target defect area from the lens image to obtain a target defect image;

[0143] A grayscale variance calculation is performed on the target defect image to obtain a calculation result.

[0144] Optionally, the computing module 20 is further configured to:

[0145] Determining an image center point of the target defect image;

[0146] The grayscale variance values ​​of the center point of the image in multiple different preset directions are calculated, and the multiple grayscale variance values ​​obtained by calculation are used as calculation results.

[0147] Optionally, the defect detection module 30 is further configured to:

[0148] Determining the defect state of the center point of the image in a plurality of different preset directions according to each of the grayscale variance values, wherein the defect state is a fuzzy state or a non-fuzzy state;

[0149] When the number of defect states in the fuzzy state exceeds a preset number threshold, determining that the defect detection result of the target defect area is a fuzzy defect;

[0150] When the number of defect states in the fuzzy state does not exceed the preset number threshold, it is determined that the defect detection result of the target defect area is a non-fuzzy defect.

[0151] Optionally, the defect detection module 30 is further configured to:

[0152] For a first grayscale variance value among the grayscale variance values, comparing the first grayscale variance value with a preset variance threshold;

[0153] When the first grayscale variance value is less than or equal to the variance threshold, determining that the defect state of the center point of the image in the direction corresponding to the first grayscale variance value is a fuzzy state;

[0154] When the first grayscale variance value is greater than the variance threshold, it is determined that the defect state of the image center point in the direction corresponding to the first grayscale variance value is a non-fuzzy state.

[0155] The lens defect detection device provided in the embodiment of the present application adopts the lens defect detection method in the above embodiment, and can determine the true situation of the lens defect to improve the accuracy of lens defect detection. Compared with the prior art, the beneficial effects of the lens defect detection device provided in the embodiment of the present application are the same as the beneficial effects of the lens defect detection method provided in the above embodiment, and other technical features in the lens defect detection device are the same as the features disclosed in the lens defect detection method in the above embodiment, which will not be repeated here.

[0156] The present application provides a lens defect detection device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the lens defect detection method in the above-mentioned embodiment one.

[0157] Reference below Fig. 9 , which shows a schematic diagram of the structure of a lens defect detection device suitable for implementing an embodiment of the present application. The lens defect detection device in the embodiment of the present application may include but is not limited to mobile terminals such as laptop computers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions: tablet computers), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig. 9 The lens defect detection device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0158] like Fig. 9As shown, the lens defect detection device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM 1004, various programs and data required for the operation of the lens defect detection device are also stored. The processing device 1001, ROM 1002, and RAM 1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the lens defect detection device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a lens defect detection device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0159] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0160] The lens defect detection device provided by the present application adopts the lens defect detection method in the above embodiment to determine the true situation of the lens defect, so as to improve the accuracy of lens defect detection. Compared with the prior art, the beneficial effects of the lens defect detection device provided by the present application are the same as the beneficial effects of the lens defect detection method provided by the above embodiment, and other technical features in the lens defect detection device are the same as the features disclosed in the method of the previous embodiment, which will not be described in detail here.

[0161] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0162] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0163] An embodiment of the present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer program) stored thereon, and the computer-readable program instructions are used to execute the lens defect detection method in the above embodiment.

[0164] The computer-readable storage medium provided in the embodiment of the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0165] The computer-readable storage medium may be included in the head-mounted display device; or may exist independently without being assembled into the head-mounted display device.

[0166] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the lens defect detection device, the lens defect detection device: obtains a lens image, and determines a target defect area from the lens image; performs grayscale variance calculation on the target defect area to obtain a calculation result; determines a defect detection result of the target defect area based on the calculation result, wherein the defect detection result is a blurred defect or a non-blurred defect.

[0167] The computer program code for performing the operation of the embodiment of the present application can be written in one or more programming languages ​​or a combination thereof, and the above-mentioned programming languages ​​include object-oriented programming languages, such as Java, Smalltalk, C++, and also include conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer, partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN: Local Area Network) or a wide area network (WAN: Wide Area Network), or it can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0168] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession 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 flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0169] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0170] The readable storage medium provided in the embodiment of the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned lens defect detection method, and can determine the true situation of the lens defect to improve the accuracy of lens defect detection. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the embodiment of the present application are the same as the beneficial effects of the lens defect detection method provided in the above-mentioned embodiment, and will not be repeated here.

[0171] The above are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A lens defect detection method, characterized in that: The method comprises: Acquire a lens image, and determine a target defect area from the lens image; Performing grayscale variance calculation on the target defect area to obtain a calculation result; A defect detection result of the target defect area is determined according to the calculation result, wherein the defect detection result is a fuzzy defect or a non-fuzzy defect.

2. The lens defect detection method according to claim 1, characterized in that: The step of determining a target defect area from the lens image comprises: Binarizing the lens image according to a global threshold of the lens image to obtain a binary image; Determine a binary initial defect area in the binary image, and determine a first coordinate position of the binary initial defect area in the binary image; An initial defect region corresponding to the binary initial defect region is determined in the lens image according to the first coordinate position, and a target defect region is determined from the initial defect region.

3. The lens defect detection method according to claim 2, characterized in that: The step of determining the target defect area from the initial defect area comprises: intercepting the initial defect area from the lens image to obtain an initial defect image; Binarizing the initial defect image according to a local threshold of the initial defect image to obtain a binarized initial defect image; Determine a binary target defect area in the binary initial defect image, and determine a second coordinate position of the binary target defect area in the binary initial defect image; A target defect area corresponding to the binarized target defect area is determined in the initial defect image according to the second coordinate position.

4. The lens defect detection method according to claim 1, wherein: The step of calculating the grayscale variance of the target defect area to obtain the calculation result comprises: intercepting the target defect area from the lens image to obtain a target defect image; A grayscale variance calculation is performed on the target defect image to obtain a calculation result.

5. The lens defect detection method according to claim 4, characterized in that: The step of calculating the grayscale variance of the target defect image to obtain the calculation result comprises: Determining an image center point of the target defect image; The grayscale variance values ​​of the center point of the image in multiple different preset directions are calculated, and the multiple grayscale variance values ​​obtained by calculation are used as calculation results.

6. The lens defect detection method according to claim 5, characterized in that: The step of determining the defect detection result of the target defect area according to the calculation result comprises: Determining the defect state of the center point of the image in a plurality of different preset directions according to each of the grayscale variance values, wherein the defect state is a fuzzy state or a non-fuzzy state; When the number of defect states in the fuzzy state exceeds a preset number threshold, determining that the defect detection result of the target defect area is a fuzzy defect; When the number of defect states in the fuzzy state does not exceed the preset number threshold, it is determined that the defect detection result of the target defect area is a non-fuzzy defect.

7. The lens defect detection method according to claim 6, characterized in that: The step of determining the defect state of the center point of the image in a plurality of different preset directions according to each of the grayscale variance values ​​comprises: For a first grayscale variance value among the grayscale variance values, comparing the first grayscale variance value with a preset variance threshold; When the first grayscale variance value is less than or equal to the variance threshold, determining that the defect state of the center point of the image in the direction corresponding to the first grayscale variance value is a fuzzy state; When the first grayscale variance value is greater than the variance threshold, it is determined that the defect state of the image center point in the direction corresponding to the first grayscale variance value is a non-fuzzy state.

8. A lens defect detection device, characterized in that: The device comprises: A defect area determination module, used to obtain a lens image and determine a target defect area from the lens image; A calculation module, used for performing grayscale variance calculation on the target defect area to obtain a calculation result; A defect detection module is used to determine a defect detection result of the target defect area according to the calculation result, wherein the defect detection result is a fuzzy defect or a non-fuzzy defect.

9. A lens defect detection device, characterized in that: The lens defect detection device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the lens defect detection method according to any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the lens defect detection method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Plastic gear defect detection method, device and equipment and storage medium

    CN121207989A