Lens resolution quality detection method, device and equipment and readable storage medium

By acquiring the original image of the lens, extracting the region of interest, and calculating the grayscale distribution statistics, the problem of inaccurate and inefficient lens resolution detection in existing systems is solved. This enables automated quantitative analysis of lens resolution quality, improving detection efficiency and accuracy.

CN115908247BActive Publication Date: 2026-06-26WUHAN JINGLI ELECTRONICS TECH +2

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WUHAN JINGLI ELECTRONICS TECH
Filing Date
2022-09-30
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing lens resolution testing methods are inaccurate and inefficient, and are affected by film resolution and human interpretation.

Method used

By acquiring the original image of the lens to be tested, the region of interest is extracted, the segmentation threshold is determined based on the gray-level distribution statistics, the gray-level distribution statistics are divided into two parts, the first and second average gray levels are calculated, and the lens resolution quality quantization value is calculated using the lens resolution quality quantization formula.

Benefits of technology

It enables automated quantitative analysis of lens resolution quality, improving detection efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115908247B_ABST
    Figure CN115908247B_ABST
Patent Text Reader

Abstract

The application provides a lens resolution quality detection method, device and equipment and a readable storage medium. The method comprises the following steps: acquiring an original image collected by a lens to be detected, and extracting a region of interest from the original image; determining a segmentation threshold based on gray scale distribution statistical information of the region of interest, wherein the gray scale distribution statistical information comprises a number of pixel points corresponding to each gray scale; dividing the gray scale distribution statistical information into first gray scale distribution statistical information and second gray scale distribution statistical information according to the segmentation threshold; calculating a first average gray scale according to the first gray scale distribution statistical information; calculating a second average gray scale according to the second gray scale distribution statistical information; and calculating a lens resolution quality quantitative value based on the first average gray scale and the second average gray scale. Through the application, quantitative analysis of the lens resolution quality can be automatically completed, and the lens resolution quality detection efficiency and accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of optical inspection technology, and in particular to a method, apparatus, device, and readable storage medium for inspecting lens resolution quality. Background Technology

[0002] The quality of a lens directly affects the quality of the images it captures. Among the indicators for evaluating the optical quality of a lens, resolution is the most important indicator.

[0003] Currently, lens resolution is generally tested by photographing a standard resolution plate: the film containing the standard resolution plate is placed under a microscope and manually interpreted, and the resolution is measured by the reciprocal of the width of the smallest pair of equally spaced black and white lines that can be distinguished. However, this method is not the most accurate or ideal method because it is affected by both the objective limitations of the film resolution and the subjective limitations of human interpretation, and it is also inefficient. Summary of the Invention

[0004] The main objective of this invention is to provide a method, apparatus, device, and readable storage medium for detecting lens resolution quality, aiming to solve the technical problems of inaccurate detection results and low detection efficiency in existing methods for detecting lens resolution.

[0005] In a first aspect, the present invention provides a lens resolution quality detection method, the lens resolution quality detection method comprising:

[0006] Acquire the original image captured by the lens to be tested, and extract the region of interest from the original image;

[0007] The segmentation threshold is determined based on the grayscale distribution statistics of the region of interest, wherein the grayscale distribution statistics include the number of pixels corresponding to each gray level.

[0008] The grayscale distribution statistics are divided into first grayscale distribution statistics and second grayscale distribution statistics according to the segmentation threshold. The first grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscale levels less than the segmentation threshold, and the second grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscale levels greater than or equal to the segmentation threshold. Alternatively, the first grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscale levels less than or equal to the segmentation threshold, and the second grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscale levels greater than the segmentation threshold.

[0009] The first average gray level is calculated based on the statistical information of the first gray level distribution.

[0010] The second average gray level is calculated based on the statistical information of the second gray level distribution.

[0011] The lens resolution quality quantization value is calculated based on the first average gray level and the second average gray level.

[0012] Optionally, the step of determining the segmentation threshold based on the grayscale distribution statistics of the region of interest includes:

[0013] Based on the grayscale distribution statistics of the region of interest, the number of pixels corresponding to each grayscale level is accumulated in ascending order of grayscale level until the number of pixels corresponding to the first grayscale level is accumulated. If the first accumulated value is greater than or equal to the first preset threshold, the number of pixels corresponding to grayscale levels smaller than the first grayscale level is set to zero, and the number of pixels corresponding to the first grayscale level is set to the difference obtained by subtracting the first preset threshold from the first accumulated value.

[0014] Based on the grayscale distribution statistics of the region of interest, the number of pixels corresponding to each grayscale level is accumulated in descending order of grayscale level until the number of pixels corresponding to the second grayscale level is accumulated. If the second accumulated value is greater than or equal to the first preset threshold, the number of pixels corresponding to grayscale levels greater than the second grayscale level is set to zero, and the number of pixels corresponding to the second grayscale level is set to the difference obtained by subtracting the first preset threshold from the second accumulated value.

[0015] Based on the new grayscale distribution statistics, the average grayscale of the pixels in the region of interest is calculated;

[0016] The average gray level is used as the segmentation threshold.

[0017] Optionally, after the step of calculating the average gray level of pixels in the region of interest based on the new gray-level distribution statistics, the method further includes:

[0018] The grayscale distribution statistics are divided into third grayscale distribution statistics and fourth grayscale distribution statistics based on the average grayscale. The third grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscales that are less than the average grayscale, and the fourth grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscales that are greater than or equal to the average grayscale. Alternatively, the third grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscales that are less than or equal to the average grayscale, and the fourth grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscales that are greater than the average grayscale.

[0019] The third average gray level is calculated based on the statistical information of the third gray level distribution.

[0020] The fourth average gray level is calculated based on the statistical information of the fourth gray level distribution.

[0021] The fifth average gray level is obtained by averaging the third and fourth average gray levels.

[0022] The fifth average gray level is used as the segmentation threshold.

[0023] Optionally, after the step of averaging the third and fourth average gray levels to obtain the fifth average gray level, the method further includes:

[0024] Detect whether the absolute value of the difference between the fifth average gray level and the average gray level is less than a second preset threshold;

[0025] If it is not less than the second preset threshold, then the fifth average gray level is used as the average gray level, and the step of dividing the gray level distribution statistics into the third gray level distribution statistics and the fourth gray level distribution statistics based on the average gray level is returned.

[0026] If it is less than the second preset threshold, then the fifth average gray level is used as the segmentation threshold.

[0027] Optionally, the step of calculating the first average gray level based on the first gray-scale distribution statistical information includes:

[0028] Select the first target gray-scale distribution statistics from the first gray-scale distribution statistics;

[0029] The first average gray level is calculated based on the statistical information of the first target gray level distribution.

[0030] The step of calculating the second average gray level based on the second gray level distribution statistical information includes:

[0031] Select the second target gray-scale distribution statistics from the second gray-scale distribution statistics;

[0032] The second average gray level is calculated based on the statistical information of the second target gray level distribution.

[0033] Optionally, the step of calculating the lens resolution quality quantization value based on the first average gray level and the second average gray level includes:

[0034] Substituting the first average gray level and the second average gray level into the lens resolution quality quantization value calculation formula, we obtain the lens resolution quality quantization value. The lens resolution quality quantization value calculation formula is as follows:

[0035]

[0036] Where MTF is the lens resolution quality quantization value, MaxAve is the second average gray level, and MinAve is the first average gray level.

[0037] Optionally, before the step of acquiring the original image captured by the lens to be detected and extracting the region of interest from the original image, the method further includes:

[0038] Set the location of the region of interest in the original image and the size of the region of interest.

[0039] Secondly, the present invention also provides a lens resolution quality detection device, the lens resolution quality detection device comprising:

[0040] The extraction module is used to acquire the original image captured by the lens to be tested, and to extract the region of interest from the original image;

[0041] The determination module is used to determine a segmentation threshold based on the grayscale distribution statistics of the region of interest, wherein the grayscale distribution statistics include the number of pixels corresponding to each grayscale level.

[0042] The segmentation module is used to divide the grayscale distribution statistics into a first grayscale distribution statistics and a second grayscale distribution statistics according to the segmentation threshold. The first grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels less than the segmentation threshold, and the second grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels greater than or equal to the segmentation threshold. Alternatively, the first grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels less than or equal to the segmentation threshold, and the second grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels greater than the segmentation threshold.

[0043] The calculation module is used to calculate a first average gray level based on the first gray level distribution statistics; calculate a second average gray level based on the second gray level distribution statistics; and calculate a lens resolution quality quantization value based on the first average gray level and the second average gray level.

[0044] Thirdly, the present invention also provides a lens resolution quality testing device, the lens resolution quality testing device including a processor, a memory, and a lens resolution quality testing program stored in the memory and executable by the processor, wherein when the lens resolution quality testing program is executed by the processor, the steps of the lens resolution quality testing method as described above are implemented.

[0045] Fourthly, the present invention also provides a readable storage medium storing a lens resolution quality detection program, wherein when the lens resolution quality detection program is executed by a processor, it implements the steps of the lens resolution quality detection method as described above.

[0046] In this invention, an original image captured by the lens to be tested is acquired, and a region of interest (ROI) is extracted from the original image. A segmentation threshold is determined based on the grayscale distribution statistics of the ROI, whereby the grayscale distribution statistics include the number of pixels corresponding to each grayscale level. The grayscale distribution statistics are then divided into a first grayscale distribution statistics and a second grayscale distribution statistics according to the segmentation threshold. Specifically, the first grayscale distribution statistics are those corresponding to grayscale levels less than the segmentation threshold, and the second grayscale distribution statistics are those corresponding to grayscale levels greater than or equal to the segmentation threshold; alternatively, the first grayscale distribution statistics are those corresponding to grayscale levels less than or equal to the segmentation threshold, and the second grayscale distribution statistics are those corresponding to grayscale levels greater than the segmentation threshold. A first average grayscale level is calculated based on the first grayscale distribution statistics. A second average grayscale level is calculated based on the second grayscale distribution statistics. Finally, a lens resolution quality quantification value is calculated based on the first and second average grayscale levels. This invention automatically performs quantitative analysis of lens resolution quality, improving the efficiency and accuracy of lens resolution quality detection. Attached Figure Description

[0047] Figure 1 This is a schematic diagram of the hardware structure of the lens resolution quality testing device involved in the embodiment of the present invention;

[0048] Figure 2 This is a flowchart illustrating an embodiment of the lens resolution quality detection method of the present invention;

[0049] Figure 3 for Figure 2 A detailed flowchart of an embodiment of step S20;

[0050] Figure 4 for Figure 2 A detailed flowchart of another embodiment of step S20;

[0051] Figure 5 for Figure 2 A detailed flowchart of another embodiment of step S20;

[0052] Figure 6 This is a schematic diagram of the functional modules of an embodiment of the lens resolution quality detection device of the present invention.

[0053] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0054] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0055] In a first aspect, embodiments of the present invention provide a lens resolution quality testing device, which can be a device with data processing capabilities such as a personal computer (PC), a laptop computer, or a server.

[0056] Reference Figure 1 , Figure 1 This is a schematic diagram of the hardware structure of the lens resolution quality testing device involved in the embodiment of the present invention. In this embodiment, the lens resolution quality testing device may include a processor 1001 (e.g., a Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to realize communication between these components; the user interface 1003 may include a display screen or an input unit such as a keyboard; the network interface 1004 may optionally include a standard wired interface or a wireless interface (e.g., Wireless Fidelity, Wi-Fi interface); the memory 1005 may be high-speed random access memory (RAM) or stable memory (non-volatile memory), such as a disk storage device. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001. Those skilled in the art will understand that… Figure 1 The hardware structure shown does not constitute a limitation of the invention and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0057] Continue to refer to Figure 1 , Figure 1 The memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a lens resolution quality detection program. The processor 1001 can call the lens resolution quality detection program stored in the memory 1005 and execute the lens resolution quality detection method provided in this embodiment of the invention.

[0058] Secondly, embodiments of the present invention provide a method for detecting lens resolution quality.

[0059] In one embodiment, reference is made to Figure 2 , Figure 2 This is a schematic flowchart of an embodiment of the lens resolution quality detection method of the present invention. Figure 2 As shown, the lens resolution quality testing methods include:

[0060] Step S10: Obtain the original image captured by the lens to be tested, and extract the region of interest from the original image;

[0061] In this embodiment, the original image is acquired by the lens to be tested, and then transmitted to the execution entity of this embodiment, such as a PC, so that the PC can obtain the original image acquired by the lens to be tested and extract the region of interest from the original image. The size (i.e., length and width) and position of the region of interest are set according to actual needs.

[0062] Furthermore, in one embodiment, before step S10, the method further includes:

[0063] Set the location of the region of interest in the original image and the size of the region of interest.

[0064] In this embodiment, the position and size of the region of interest in the original image can be set in the settings interface based on user operations.

[0065] Step S20: Determine the segmentation threshold based on the grayscale distribution statistics of the region of interest, wherein the grayscale distribution statistics include the number of pixels corresponding to each gray level;

[0066] In this embodiment, the region of interest (ROI) is essentially an image. First, the ROI is processed to obtain its grayscale histogram. Then, based on the grayscale histogram, the grayscale distribution statistics of the ROI are obtained. Finally, the segmentation threshold is determined based on these statistics. The grayscale distribution statistics include the number of pixels corresponding to each gray level. Taking gray levels 0-255 as an example, the grayscale distribution statistics include the number of pixels at gray level 0, gray level 1, gray level 2, ..., gray level 254, and gray level 255.

[0067] There are many ways to determine the segmentation threshold based on grayscale distribution statistics, and the specific method can be chosen according to actual needs. For example, first, determine the average grayscale of the pixels in the region of interest based on the grayscale distribution statistics, and use this average grayscale as the segmentation threshold. Alternatively, based on the grayscale distribution statistics, set the number of pixels with grayscale values ​​of 0, 1, 254, and 255 to zero to obtain new grayscale distribution statistics, and then determine the average grayscale of the pixels in the region of interest based on the new grayscale distribution statistics, and use this average grayscale as the segmentation threshold.

[0068] Furthermore, in one embodiment, reference is made to Figure 3 , Figure 3 for Figure 2 A detailed flowchart of one embodiment of step S20. (See attached diagram.) Figure 3As shown, step S20 includes:

[0069] Step S201: Based on the grayscale distribution statistics of the region of interest, the number of pixels corresponding to each grayscale level is accumulated in ascending order of grayscale level until the number of pixels corresponding to the first grayscale level is accumulated. If the first accumulated value is greater than or equal to the first preset threshold, the number of pixels corresponding to grayscale levels smaller than the first grayscale level is set to zero, and the number of pixels corresponding to the first grayscale level is set to the difference obtained by subtracting the first preset threshold from the first accumulated value.

[0070] In this embodiment, it is assumed that the grayscale distribution statistics are as shown in Table 1:

[0071] grayscale Number of pixels 0 <![CDATA[A0]]> 1 <![CDATA[A1]]> 2 <![CDATA[A2]]> ...... ...... 253 <![CDATA[A 253 ]]> 254 <![CDATA[A 254 ]]> 255 <![CDATA[A 255 ]]>

[0072] It should be noted that this is only an illustrative description of grayscale distribution statistics and does not constitute a limitation on grayscale distribution statistics. In addition to being presented in tabular form, grayscale distribution statistics can also be presented in other ways.

[0073] The number of pixels corresponding to each gray level is accumulated in ascending order of gray level. That is, starting from A0, A1, A2, A3, etc. are accumulated sequentially until the number of pixels corresponding to a certain gray level (i.e., the first gray level) is accumulated. The first accumulated value is greater than or equal to the first preset threshold.

[0074] For example, if the first preset threshold is set to 50, where A0 is 20, A1 is 20, A2 is 5, and A3 is 30, then the first accumulated value 75 will be greater than or equal to the first preset threshold 50 only after accumulating to the number of pixels corresponding to gray level 3. Therefore, gray level 3 is taken as the first gray level, and the number of pixels corresponding to gray levels lower than the first gray level is set to zero, that is, the number of pixels of gray level 0, gray level 1, and gray level 2 is set to zero, and the number of pixels corresponding to gray level 3 is set to the difference of 25 obtained by subtracting the first preset threshold 50 from the first accumulated value 75.

[0075] For example, if the first preset threshold is set to 50, and A0 is 70, then after accumulating the number of pixels corresponding to gray level 0, if the first accumulated value 70 is greater than or equal to the first preset threshold 50, then gray level 0 is taken as the first gray level, and the number of pixels corresponding to gray levels lower than the first gray level is set to zero. At this time, there is no gray level lower than gray level 0, so this step is ignored, and the number of pixels corresponding to gray level 0 is set to the difference of 20 obtained by subtracting the first preset threshold 50 from the first accumulated value 70.

[0076] This step is equivalent to removing the first preset threshold number of pixels with the smallest grayscale in the region of interest.

[0077] Step S202: Based on the grayscale distribution statistics of the region of interest, the number of pixels corresponding to each grayscale level is accumulated in descending order of grayscale level until the number of pixels corresponding to the second grayscale level is accumulated. If the second accumulated value is greater than or equal to the first preset threshold, the number of pixels corresponding to grayscale levels greater than the second grayscale level is set to zero, and the number of pixels corresponding to the second grayscale level is set to the difference obtained by subtracting the first preset threshold from the second accumulated value.

[0078] In this embodiment, it is assumed that the grayscale distribution statistics are as shown in Table 1.

[0079] Accumulate the number of pixels corresponding to each gray level in descending order of gray level, i.e., from A... 255 Start by accumulating A sequentially. 254 A 253 A 252 ... until the number of pixels corresponding to a certain gray level (i.e., the first gray level) is accumulated, the second accumulated value is greater than or equal to the first preset threshold.

[0080] For example, the first preset threshold is set to 50, where A 255 For 20, A 254 For 20, A 253 It is 5, A 252 If the value is 30, then the second accumulated value 75 will be greater than or equal to the first preset threshold 50 only after accumulating to the number of pixels corresponding to gray level 252. Therefore, gray level 252 is used as the second gray level, and the number of pixels corresponding to gray levels greater than the second gray level is set to zero. That is, the number of pixels of gray levels 253, 254 and 255 is set to zero, and the number of pixels corresponding to gray level 252 is set to the difference 25 obtained by subtracting the first preset threshold 50 from the second accumulated value 75.

[0081] This step is equivalent to removing the first preset threshold number of pixels with the highest grayscale in the region of interest.

[0082] Step S203: Calculate the average gray level of the pixels in the region of interest based on the new gray level distribution statistics.

[0083] In this embodiment, steps S201 and S202 are used to reset the number of pixels corresponding to one or more gray levels with the largest gray level in the gray-scale distribution statistics, and to reset the number of pixels corresponding to one or more gray levels with the smallest gray level in the gray-scale distribution statistics, thus obtaining new gray-scale distribution statistics. Based on the new gray-scale distribution statistics, the average gray level of the pixels in the region of interest is calculated.

[0084] The calculation formula is as follows:

[0085]

[0086] Where V0 is the average gray level of the pixels in the region of interest calculated based on the new gray level distribution statistics, i is the gray level, and Histogram(i) represents the number of pixels corresponding to gray level i.

[0087] Step S204: Use the average gray level as the segmentation threshold.

[0088] In this embodiment, the average gray level obtained in step S203 is used as the segmentation threshold.

[0089] Furthermore, in one embodiment, reference is made to Figure 4 , Figure 4 for Figure 2 A detailed flowchart of another embodiment of step S20 is shown. Figure 4 As shown, after step S203, the following steps are also included:

[0090] Step S205: Based on the average gray level, the gray level distribution statistics are divided into third gray level distribution statistics and fourth gray level distribution statistics. The third gray level distribution statistics are gray level distribution statistics corresponding to gray levels less than the average gray level, and the fourth gray level distribution statistics are gray level distribution statistics corresponding to gray levels greater than or equal to the average gray level. Alternatively, the third gray level distribution statistics are gray level distribution statistics corresponding to gray levels less than or equal to the average gray level, and the fourth gray level distribution statistics are gray level distribution statistics corresponding to gray levels greater than the average gray level.

[0091] In this embodiment, assuming the average gray level is n, the gray level distribution statistics corresponding to gray levels less than n are used as the third gray level distribution statistics, and the gray level distribution statistics corresponding to gray levels greater than or equal to n are used as the fourth gray level distribution statistics; or, the gray level distribution statistics corresponding to gray levels less than or equal to n are used as the third gray level distribution statistics, and the gray level distribution statistics corresponding to gray levels greater than n are used as the fourth gray level distribution statistics.

[0092] Step S206: Calculate the third average gray level based on the third gray level distribution statistics;

[0093] Step S207: Calculate the fourth average gray level based on the fourth gray level distribution statistics.

[0094] In this embodiment, it is assumed that the third grayscale distribution statistics include grayscale distribution statistics from grayscale 0 to grayscale 100, namely, the number of pixels corresponding to grayscale 0, the number of pixels corresponding to grayscale 1, ..., and the number of pixels corresponding to grayscale 100. The fourth grayscale distribution statistics include grayscale distribution statistics from grayscale 101 to grayscale 255, namely, the number of pixels corresponding to grayscale 101, the number of pixels corresponding to grayscale 102, ..., and the number of pixels corresponding to grayscale 255. Based on a method similar to step S203 above, the third average grayscale V3 can be calculated based on the third grayscale distribution statistics, and the fourth average grayscale V4 can be calculated based on the fourth grayscale distribution statistics.

[0095] Step S208: Calculate the average value of the third and fourth average gray levels to obtain the fifth average gray level;

[0096] In this embodiment, the average value of the third average gray level V3 and the fourth average gray level V4 is calculated to obtain the fifth average gray level V5.

[0097] Step S209: Use the fifth average gray level as the segmentation threshold.

[0098] In this embodiment, the fifth average gray level V5 is used as the segmentation threshold.

[0099] Furthermore, in one embodiment, reference is made to Figure 5 , Figure 5 for Figure 2 A detailed flowchart of another embodiment of step S20. (See attached diagram.) Figure 5 As shown, after step S208, the following steps are also included:

[0100] Step S210: Detect whether the absolute value of the difference between the fifth average gray level and the average gray level is less than the second preset threshold.

[0101] In this embodiment, the absolute value of the difference between the fifth average gray level and the average gray level V0 obtained in step S203 is calculated, and then it is detected whether the absolute value is less than the second preset threshold.

[0102] Step S211: If it is not less than the second preset threshold, then the fifth average gray level is used as the average gray level, and the step of dividing the gray level distribution statistics into the third gray level distribution statistics and the fourth gray level distribution statistics based on the average gray level is returned.

[0103] In this embodiment, if it is not less than the second preset threshold, the fifth average gray level V5 calculated in this instance is used as the average gray level V0, and the process returns to step S205.

[0104] Step S212: If it is less than the second preset threshold, then the fifth average gray level is used as the segmentation threshold.

[0105] In this embodiment, if the value is less than the second preset threshold, the fifth average gray level V5 calculated in this instance is used as the segmentation threshold.

[0106] Step S30: Divide the grayscale distribution statistics into first grayscale distribution statistics and second grayscale distribution statistics according to the segmentation threshold. The first grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels less than the segmentation threshold, and the second grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels greater than or equal to the segmentation threshold. Alternatively, the first grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels less than or equal to the segmentation threshold, and the second grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels greater than the segmentation threshold.

[0107] In this embodiment, the specific implementation of dividing the gray-scale distribution statistics into first gray-scale distribution statistics and second gray-scale distribution statistics according to the segmentation threshold is similar to the implementation of step S205 above, and will not be repeated here.

[0108] Step S40: Calculate the first average gray level based on the first gray level distribution statistics;

[0109] Step S50: Calculate the second average gray level based on the second gray level distribution statistics.

[0110] In this embodiment, the first average gray level and the second average gray level are calculated in a manner similar to that of the embodiment in step S203 described above. That is, the first average gray level is calculated based on all the first gray level distribution statistics, and the second average gray level is calculated based on all the second gray level distribution statistics.

[0111] Further, in one embodiment, step S40 includes:

[0112] Select the first target gray level statistical information from the first gray level distribution statistical information; calculate the first average gray level based on the first target gray level distribution statistical information.

[0113] Step S50 includes:

[0114] Select the second target gray level statistical information from the second gray level distribution statistical information; calculate the second average gray level based on the second target gray level distribution statistical information.

[0115] In this embodiment, a first target grayscale distribution statistical information is selected from the first grayscale distribution statistical information, and a second target grayscale distribution statistical information is selected from the second grayscale distribution statistical information, according to a preset selection rule. The preset selection rule can be to randomly select a preset proportion of grayscale distribution statistical information, for example, a preset proportion set to 80%. Alternatively, the preset selection rule can be to select the portion with the smallest grayscale (e.g., accounting for 85% of the first grayscale distribution statistical information) as the first target grayscale distribution statistical information; and to select the portion with the largest grayscale (e.g., accounting for 85% of the second grayscale distribution statistical information) as the second target grayscale distribution statistical information.

[0116] Subsequently, the specific embodiments for calculating the first average gray level based on the statistical information of the first target gray level distribution and the second average gray level based on the statistical information of the second target gray level distribution are similar to the embodiments of step S203 above, and will not be repeated here. That is, the first average gray level is calculated based on a portion of the statistical information of the first gray level distribution and the second average gray level is calculated based on a portion of the statistical information of the second gray level distribution.

[0117] Step S60: Based on the first average gray level and the second average gray level, calculate the lens resolution quality quantization value.

[0118] In this embodiment, the lens resolution quality quantization value can be obtained by substituting the first average gray level and the second average gray level into the preset lens resolution quality quantization value calculation formula.

[0119] Further, in one embodiment, step S60 includes:

[0120] Substituting the first average gray level and the second average gray level into the lens resolution quality quantization value calculation formula, we obtain the lens resolution quality quantization value. The lens resolution quality quantization value calculation formula is as follows:

[0121]

[0122] Where MTF is the lens resolution quality quantization value, MaxAve is the second average gray level, and MinAve is the first average gray level.

[0123] In this embodiment, the lens resolution quality quantization value can be obtained by substituting the first average gray level and the second average gray level into the above-mentioned lens resolution quality quantization value calculation formula.

[0124] In this embodiment, the original image captured by the lens to be tested is acquired, and the region of interest (ROI) is extracted from the original image. A segmentation threshold is determined based on the grayscale distribution statistics of the ROI, whereby the grayscale distribution statistics include the number of pixels corresponding to each grayscale level. The grayscale distribution statistics are divided into a first grayscale distribution statistics and a second grayscale distribution statistics according to the segmentation threshold. The first grayscale distribution statistics are those corresponding to grayscale levels less than the segmentation threshold, and the second grayscale distribution statistics are those corresponding to grayscale levels greater than or equal to the segmentation threshold; alternatively, the first grayscale distribution statistics are those corresponding to grayscale levels less than or equal to the segmentation threshold, and the second grayscale distribution statistics are those corresponding to grayscale levels greater than the segmentation threshold. A first average grayscale is calculated based on the first grayscale distribution statistics. A second average grayscale is calculated based on the second grayscale distribution statistics. Based on the first and second average grayscales, a quantized value for lens resolution quality is calculated. This embodiment automatically completes the quantification analysis of lens resolution quality, improving the efficiency and accuracy of lens resolution quality detection.

[0125] Thirdly, embodiments of the present invention also provide a lens resolution quality detection device.

[0126] In one embodiment, reference is made to Figure 6 , Figure 6 This is a functional module diagram of an embodiment of the lens resolution quality detection device of the present invention. Figure 6 As shown, the lens resolution quality testing device includes:

[0127] Extraction module 10 is used to acquire the original image captured by the lens to be detected, and extract the region of interest from the original image;

[0128] The determining module 20 is used to determine a segmentation threshold based on the grayscale distribution statistics of the region of interest, wherein the grayscale distribution statistics include the number of pixels corresponding to each gray level.

[0129] The segmentation module 30 is used to divide the grayscale distribution statistics into a first grayscale distribution statistics and a second grayscale distribution statistics according to the segmentation threshold. The first grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels less than the segmentation threshold, and the second grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels greater than or equal to the segmentation threshold. Alternatively, the first grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels less than or equal to the segmentation threshold, and the second grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels greater than the segmentation threshold.

[0130] The calculation module 40 is used to calculate a first average gray level based on the first gray level distribution statistics; calculate a second average gray level based on the second gray level distribution statistics; and calculate a lens resolution quality quantization value based on the first average gray level and the second average gray level.

[0131] Furthermore, in one embodiment, the determining module 20 is configured to:

[0132] Based on the grayscale distribution statistics of the region of interest, the number of pixels corresponding to each grayscale level is accumulated in ascending order of grayscale level until the number of pixels corresponding to the first grayscale level is accumulated. If the first accumulated value is greater than or equal to the first preset threshold, the number of pixels corresponding to grayscale levels smaller than the first grayscale level is set to zero, and the number of pixels corresponding to the first grayscale level is set to the difference obtained by subtracting the first preset threshold from the first accumulated value.

[0133] Based on the grayscale distribution statistics of the region of interest, the number of pixels corresponding to each grayscale level is accumulated in descending order of grayscale level until the number of pixels corresponding to the second grayscale level is accumulated. If the second accumulated value is greater than or equal to the first preset threshold, the number of pixels corresponding to grayscale levels greater than the second grayscale level is set to zero, and the number of pixels corresponding to the second grayscale level is set to the difference obtained by subtracting the first preset threshold from the second accumulated value.

[0134] Based on the new grayscale distribution statistics, the average grayscale of the pixels in the region of interest is calculated;

[0135] The average gray level is used as the segmentation threshold.

[0136] Furthermore, in one embodiment, the determining module 20 is configured to:

[0137] The grayscale distribution statistics are divided into third grayscale distribution statistics and fourth grayscale distribution statistics based on the average grayscale. The third grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscales that are less than the average grayscale, and the fourth grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscales that are greater than or equal to the average grayscale. Alternatively, the third grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscales that are less than or equal to the average grayscale, and the fourth grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscales that are greater than the average grayscale.

[0138] The third average gray level is calculated based on the statistical information of the third gray level distribution.

[0139] The fourth average gray level is calculated based on the statistical information of the fourth gray level distribution.

[0140] The fifth average gray level is obtained by averaging the third and fourth average gray levels.

[0141] The fifth average gray level is used as the segmentation threshold.

[0142] Furthermore, in one embodiment, the determining module 20 is configured to:

[0143] Detect whether the absolute value of the difference between the fifth average gray level and the average gray level is less than a second preset threshold;

[0144] If it is not less than the second preset threshold, then the fifth average gray level is used as the average gray level, and the step of dividing the gray level distribution statistics into the third gray level distribution statistics and the fourth gray level distribution statistics based on the average gray level is returned.

[0145] If it is less than the second preset threshold, then the fifth average gray level is used as the segmentation threshold.

[0146] Furthermore, in one embodiment, the computing module 40 is used for:

[0147] Select the first target gray-scale distribution statistics from the first gray-scale distribution statistics;

[0148] The first average gray level is calculated based on the statistical information of the first target gray level distribution.

[0149] Select the second target gray-scale distribution statistics from the second gray-scale distribution statistics;

[0150] The second average gray level is calculated based on the statistical information of the second target gray level distribution.

[0151] Furthermore, in one embodiment, the computing module 40 is used for:

[0152] Substituting the first average gray level and the second average gray level into the lens resolution quality quantization value calculation formula, we obtain the lens resolution quality quantization value. The lens resolution quality quantization value calculation formula is as follows:

[0153]

[0154] Where MTF is the lens resolution quality quantization value, MaxAve is the second average gray level, and MinAve is the first average gray level.

[0155] Furthermore, in one embodiment, the lens resolution quality detection device further includes a setting module for:

[0156] Set the location of the region of interest in the original image and the size of the region of interest.

[0157] The functions of each module in the above-mentioned lens resolution quality detection device correspond to the steps in the above-mentioned lens resolution quality detection method embodiment, and their functions and implementation processes will not be described in detail here.

[0158] Fourthly, embodiments of the present invention also provide a readable storage medium.

[0159] The present invention provides a lens resolution quality detection program stored on a readable storage medium, wherein when the lens resolution quality detection program is executed by a processor, it implements the steps of the lens resolution quality detection method described above.

[0160] The method implemented when the lens resolution quality detection program is executed can be referred to in various embodiments of the lens resolution quality detection method of the present invention, and will not be repeated here.

[0161] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0162] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0163] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device to execute the methods described in the various embodiments of the present invention.

[0164] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A method for detecting lens resolution quality, characterized in that, The lens resolution quality detection method includes: Acquire the original image captured by the lens to be tested, and extract the region of interest from the original image; The segmentation threshold is determined based on the grayscale distribution statistics of the region of interest, wherein the grayscale distribution statistics include the number of pixels corresponding to each gray level. The grayscale distribution statistics are divided into first grayscale distribution statistics and second grayscale distribution statistics according to the segmentation threshold. The first grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscale levels less than the segmentation threshold, and the second grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscale levels greater than or equal to the segmentation threshold. Alternatively, the first grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscale levels less than or equal to the segmentation threshold, and the second grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscale levels greater than the segmentation threshold. The first average gray level is calculated based on the statistical information of the first gray level distribution. The second average gray level is calculated based on the statistical information of the second gray level distribution. The lens resolution quality quantization value is calculated based on the first average gray level and the second average gray level. The step of calculating the lens resolution quality quantization value based on the first average gray level and the second average gray level includes: Substituting the first average gray level and the second average gray level into the lens resolution quality quantization value calculation formula, we obtain the lens resolution quality quantization value. The lens resolution quality quantization value calculation formula is as follows: MTF stands for Lens Resolution Quality Quantization. The second average gray level, This represents the first average gray level.

2. The lens resolution quality detection method as described in claim 1, characterized in that, The step of determining the segmentation threshold based on the grayscale distribution statistics of the region of interest includes: Based on the grayscale distribution statistics of the region of interest, the number of pixels corresponding to each grayscale level is accumulated in ascending order of grayscale level until the number of pixels corresponding to the first grayscale level is accumulated. If the first accumulated value is greater than or equal to the first preset threshold, the number of pixels corresponding to grayscale levels smaller than the first grayscale level is set to zero, and the number of pixels corresponding to the first grayscale level is set to the difference obtained by subtracting the first preset threshold from the first accumulated value. Based on the grayscale distribution statistics of the region of interest, the number of pixels corresponding to each grayscale level is accumulated in descending order of grayscale level until the number of pixels corresponding to the second grayscale level is accumulated. If the second accumulated value is greater than or equal to the first preset threshold, the number of pixels corresponding to grayscale levels greater than the second grayscale level is set to zero, and the number of pixels corresponding to the second grayscale level is set to the difference obtained by subtracting the first preset threshold from the second accumulated value. Based on the new grayscale distribution statistics, the average grayscale of the pixels in the region of interest is calculated; The average gray level is used as the segmentation threshold.

3. The lens resolution quality detection method as described in claim 2, characterized in that, After the step of calculating the average gray level of pixels in the region of interest based on the new gray level distribution statistics, the method further includes: The grayscale distribution statistics are divided into third grayscale distribution statistics and fourth grayscale distribution statistics based on the average grayscale. The third grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscales that are less than the average grayscale, and the fourth grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscales that are greater than or equal to the average grayscale. Alternatively, the third grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscales that are less than or equal to the average grayscale, and the fourth grayscale distribution statistics are the grayscale distribution statistics corresponding to grayscales that are greater than the average grayscale. The third average gray level is calculated based on the statistical information of the third gray level distribution. The fourth average gray level is calculated based on the statistical information of the fourth gray level distribution. The fifth average gray level is obtained by averaging the third and fourth average gray levels. The fifth average gray level is used as the segmentation threshold.

4. The lens resolution quality detection method as described in claim 3, characterized in that, After the step of averaging the third and fourth average gray levels to obtain the fifth average gray level, the method further includes: Detect whether the absolute value of the difference between the fifth average gray level and the average gray level is less than a second preset threshold; If it is not less than the second preset threshold, then the fifth average gray level is used as the average gray level, and the step of dividing the gray level distribution statistics into the third gray level distribution statistics and the fourth gray level distribution statistics based on the average gray level is returned. If it is less than the second preset threshold, then the fifth average gray level is used as the segmentation threshold.

5. The lens resolution quality detection method as described in claim 1, characterized in that, The step of calculating the first average gray level based on the first gray level distribution statistical information includes: Select the first target gray-scale distribution statistics from the first gray-scale distribution statistics; The first average gray level is calculated based on the statistical information of the first target gray level distribution. The step of calculating the second average gray level based on the second gray level distribution statistical information includes: Select the second target gray-scale distribution statistics from the second gray-scale distribution statistics; The second average gray level is calculated based on the statistical information of the second target gray level distribution.

6. The lens resolution quality testing method according to any one of claims 1 to 4, characterized in that, Before the steps of acquiring the original image captured by the lens to be detected and extracting the region of interest from the original image, the method further includes: Set the location of the region of interest in the original image and the size of the region of interest.

7. A lens resolution quality testing device, characterized in that, The lens resolution quality detection device includes: The extraction module is used to acquire the original image captured by the lens to be tested, and to extract the region of interest from the original image; The determination module is used to determine a segmentation threshold based on the grayscale distribution statistics of the region of interest, wherein the grayscale distribution statistics include the number of pixels corresponding to each grayscale level. The segmentation module is used to divide the grayscale distribution statistics into a first grayscale distribution statistics and a second grayscale distribution statistics according to the segmentation threshold. The first grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels less than the segmentation threshold, and the second grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels greater than or equal to the segmentation threshold. Alternatively, the first grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels less than or equal to the segmentation threshold, and the second grayscale distribution statistics are grayscale distribution statistics corresponding to grayscale levels greater than the segmentation threshold. The calculation module is used to calculate a first average gray level based on the first gray level distribution statistics; calculate a second average gray level based on the second gray level distribution statistics; and calculate a lens resolution quality quantization value based on the first average gray level and the second average gray level. The step of calculating the lens resolution quality quantization value based on the first average gray level and the second average gray level includes: Substituting the first average gray level and the second average gray level into the lens resolution quality quantization value calculation formula, we obtain the lens resolution quality quantization value. The lens resolution quality quantization value calculation formula is as follows: MTF stands for Lens Resolution Quality Quantization. The second average gray level, This represents the first average gray level.

8. A lens resolution quality testing device, characterized in that, The lens resolution quality testing device includes a processor, a memory, and a lens resolution quality testing program stored in the memory and executable by the processor, wherein when the lens resolution quality testing program is executed by the processor, it implements the steps of the lens resolution quality testing method as described in any one of claims 1 to 6.

9. A readable storage medium, characterized in that, The readable storage medium stores a lens resolution quality detection program, wherein when the lens resolution quality detection program is executed by a processor, it implements the steps of the lens resolution quality detection method as described in any one of claims 1 to 6.