Imaging clarity detection method, device, electronic device and storage medium

The image image after the test panel was imaged through the camera module was calculated horizontally and vertically, and the edge features were directly used for clarity evaluation, which solved the problem of insufficient accuracy of traditional methods relying on specific charts and low-resolution detection, and achieved efficient and stable imaging clarity detection.

CN119766995APending Publication Date: 2025-04-04KUNSHAN QIUTI PHOTOELECTRIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510080775.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-17
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

The traditional camera module composition image clarity detection method relies on specific test charts, is complex and costly, and has insufficient detection accuracy under low resolution conditions, so it is impossible to fully and accurately evaluate imaging clarity.

Method used

By performing horizontal and vertical gradient set calculations on the image image imaged by the camera module to be tested, the edge features are directly used for clarity evaluation, and it does not rely on specific charts. It is suitable for a variety of scenarios, especially under low resolution conditions, providing stable, anti-interference and efficient detection.

Benefits of technology

The detection process is simplified, the calculation complexity is reduced, the detection efficiency is improved, and it can provide relatively stable clarity results under low resolution conditions. It has certain anti-interference ability and is suitable for imaging quality detection in complex or low-light environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119766995A_ABST
    Figure CN119766995A_ABST
Patent Text Reader

Abstract

The present application discloses an imaging clarity detection method, device, electronic device and storage medium, and relates to the field of image processing technology. The method comprises: imaging a test target plate through a camera module to be tested to obtain a target image to be tested; performing gradient calculation on the target image to be tested to obtain an image transverse gradient set and an image longitudinal gradient set; and determining the imaging clarity of the camera module to be tested according to the image transverse gradient set and the image longitudinal gradient set. The present application directly uses edge features to perform clarity assessment through transverse and longitudinal gradient sets, does not rely on specific charts, is applicable to a variety of scenarios, and can provide stable, interference-resistant and efficient imaging clarity detection, especially under low-resolution conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and more specifically, to an imaging clarity detection method, device, electronic device and storage medium. Background Art

[0002] With the continuous development of imaging technology, the clarity of camera modules, as an important indicator of image quality, has been widely used in many fields such as smart phones, security monitoring, car assisted driving, industrial inspection, etc. However, the evaluation of camera module imaging clarity faces challenges in practical applications. Traditional clarity detection methods usually rely on specific test charts, such as line pair test targets or black and white edge test targets. These methods require the use of specific scenes or charts, which are cumbersome and costly to operate. In addition, traditional methods are easily affected by the number of line pairs and edge transition details in low-resolution images, resulting in insufficient accuracy of the calculation results, and unable to comprehensively and accurately evaluate the imaging clarity of the camera module.

[0003] Especially under low-resolution conditions, traditional methods have poor representation of image details and significantly reduced detection accuracy. This limitation may cause errors in the selection and imaging quality evaluation of smart devices, affecting the final image quality effect. In other words, the imaging clarity detection method of the related technology has technical problems such as complex operation, reliance on specific charts, and poor adaptability to low-resolution images. Summary of the invention

[0004] A series of simplified concepts are introduced in the summary of the invention, which will be further described in detail in the detailed description. The summary of the invention of this application does not mean to attempt to define the key features and essential technical features of the technical solution claimed for protection, nor does it mean to attempt to determine the scope of protection of the technical solution claimed for protection.

[0005] The imaging clarity detection method and related device provided in the present application can directly use edge features to evaluate clarity through a set of horizontal and vertical gradients, does not rely on specific charts, is applicable to a variety of scenarios, and can provide stable, interference-resistant and efficient imaging clarity detection, especially under low-resolution conditions.

[0006] In a first aspect, the present application provides an imaging clarity detection method, comprising: imaging a test target plate through a camera module to be tested to obtain a target image to be tested; performing gradient calculation on the target image to be tested to obtain an image transverse gradient set and an image longitudinal gradient set; determining the imaging clarity of the camera module to be tested based on the image transverse gradient set and the image longitudinal gradient set.

[0007] In a feasible implementation, the gradient calculation of the target image to be tested to obtain an image transverse gradient set and an image longitudinal gradient set includes: performing gradient calculation on the target image to be tested through an edge detection operator to obtain a first number of pixel transverse gradients and a second number of pixel longitudinal gradients, wherein the first number is the number of all pixels in the target image to be tested whose transverse gradients can be calculated, and the second number is the number of all pixels in the target image to be tested whose longitudinal gradients can be calculated; determining the image transverse gradient set and the image longitudinal gradient set according to the first number of pixel transverse gradients and the second number of pixel longitudinal gradients.

[0008] In a feasible implementation, determining the image transverse gradient set and the image longitudinal gradient set based on the first number of pixel transverse gradients and the second number of pixel longitudinal gradients includes: determining the set composed of the first number of pixel transverse gradients as the image transverse gradient set; and determining the set composed of the second number of pixel longitudinal gradients as the image longitudinal gradient set.

[0009] In a feasible implementation, the determining the image horizontal gradient set and the image vertical gradient set based on the first number of pixel horizontal gradients and the second number of pixel vertical gradients includes: arranging the first number of pixel horizontal gradients in descending order to obtain a pixel horizontal gradient set, and determining a set consisting of the first third number of pixel horizontal gradients in the pixel horizontal gradient set as the image horizontal gradient set, wherein the third number is a preset number of horizontal gradients; arranging the second number of pixel vertical gradients in descending order to obtain a pixel vertical gradient set, and determining a set consisting of the first fourth number of pixel vertical gradients in the pixel vertical gradient set as the image vertical gradient set, wherein the fourth number is a preset number of vertical gradients.

[0010] In a feasible implementation, the imaging clarity of the camera module to be tested is determined based on the image transverse gradient set and the image longitudinal gradient set, including: adding the third number of pixel transverse gradients to obtain actual transverse gradient values; adding the fourth number of pixel longitudinal gradients to obtain actual longitudinal gradient values; calculating the transverse gradient theoretical peak value and the longitudinal gradient theoretical peak value based on the third number and the fourth number; and determining the imaging clarity based on the transverse gradient actual value, the longitudinal gradient actual value, the transverse gradient theoretical peak value and the longitudinal gradient theoretical peak value.

[0011] In a feasible implementation, the imaging clarity is determined based on the actual value of the transverse gradient, the actual value of the longitudinal gradient, the theoretical peak value of the transverse gradient and the theoretical peak value of the longitudinal gradient, including: calculating the ratio of the actual value of the transverse gradient to the theoretical peak value of the transverse gradient to obtain the transverse clarity of the camera module to be tested; calculating the ratio of the actual value of the longitudinal gradient to the theoretical peak value of the longitudinal gradient to obtain the longitudinal clarity of the camera module to be tested; and performing weighted summation of the transverse clarity and the longitudinal clarity to obtain the imaging clarity.

[0012] In a feasible implementation, the method of imaging the test target plate through the camera module to obtain the target image to be tested includes: imaging the test target plate through the camera module to obtain an initial image to be tested; grayscale processing the initial image to be tested to obtain a grayscale image to be tested; and denoising the grayscale image to be tested to obtain the target image to be tested.

[0013] In the second aspect, the present application also provides an imaging clarity detection device, comprising: a test imaging unit, used to image a test target plate through a camera module to be tested to obtain a target image to be tested; a gradient calculation unit, used to perform gradient calculation on the target image to be tested to obtain an image transverse gradient set and an image longitudinal gradient set; a clarity determination unit, used to determine the imaging clarity of the camera module to be tested based on the image transverse gradient set and the image longitudinal gradient set.

[0014] In a third aspect, the present application further provides an electronic device, comprising: a memory and a processor, wherein the processor is configured to implement the steps of the imaging clarity detection method described in the first aspect when executing a computer program stored in the memory.

[0015] In a fourth aspect, the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the imaging clarity detection method described in the first aspect.

[0016] In a fifth aspect, the present application also provides a computer program product, including a computer program or computer executable instructions, which, when executed by a processor, implements the imaging clarity detection method provided in the embodiment of the present application.

[0017] In summary, the present application can directly use the edge features of the test image to evaluate the clarity by calculating the horizontal and vertical gradient sets, avoiding the strong dependence on the specific test target plate, not relying on the specific test chart format, and can be applicable to a variety of different scenes or test targets, so that the imaging clarity detection method has good versatility; under low-resolution conditions, even if the number of line pairs or edges is small, a relatively stable clarity result can still be obtained by gradient calculation, thereby compensating for the problem of low quantization accuracy of traditional methods in low-resolution images; the imaging clarity can be obtained through simple gradient calculation and set processing, which greatly simplifies the detection process, reduces the calculation complexity, and improves the detection efficiency; because the gradient calculation method can directly reflect the clarity and change speed of the edge, the imaging clarity detection method of the embodiment of the present application has a certain anti-interference ability, and can still accurately judge the clarity of the image even in the presence of slight noise, which is particularly suitable for imaging quality detection in complex or low-light environments. In summary, the imaging clarity detection method provided in the present application directly utilizes edge features to perform clarity assessment through a set of horizontal and vertical gradients. It does not rely on specific charts and is applicable to a variety of scenarios. In particular, it can provide stable, interference-resistant and efficient imaging clarity detection under low-resolution conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present specification. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0019] Figure 1 A schematic diagram of a flow chart of an imaging clarity detection method provided in an embodiment of the present application;

[0020] Figure 2 It is a schematic diagram of a line pair test target board in the related art;

[0021] Figure 3 A schematic diagram of a black grid test target plate in the related art;

[0022] Figure 4 A schematic diagram of a Sobel operator for calculating a lateral gradient value provided in an embodiment of the present application;

[0023] Figure 5 A schematic diagram of a Sobel operator for calculating a longitudinal gradient value provided in an embodiment of the present application;

[0024] Figure 6 A schematic diagram of the structure of an imaging clarity detection device provided in an embodiment of the present application;

[0025] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0026] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "is" and "has" and any variations thereof involved in the present application are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0027] The term "module" or "unit" in this application refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0028] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. In the following description, it is related to "some embodiments", which describes a subset of all possible embodiments, but it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.

[0029] See also Figure 1 , Figure 1 1 is a flow chart of an imaging clarity detection method provided in an embodiment of the present application. The method may specifically include the following steps 101 to 103:

[0030] Step 101, imaging a test target plate through a camera module to obtain a target image to be tested;

[0031] Specifically, the camera module to be tested is a camera device for capturing images, which generates a target image to be tested by imaging a preset test target plate; the test target plate (Chart) usually contains a standardized pattern or structure for clarity evaluation, which is convenient for extracting the gradient information of the image to analyze the imaging quality of the camera; the target image to be tested refers to the image obtained by photographing the test target plate by the camera module, and the image will be used to calculate the gradient set and imaging clarity in subsequent steps.

[0032] For example, when the camera module is aimed at the test target plate for shooting, a clear black and white line pair pattern or edge structure appears in the image; by acquiring the image and defining it as the target image to be tested, it is ensured that the image content meets the requirements of clarity detection, which facilitates subsequent gradient calculation operations. For example, the camera module captures an image of a target plate containing black and white line pairs, and the image is used to extract the horizontal and vertical gradient sets in order to detect the imaging clarity of the camera.

[0033] Step 102, performing gradient calculation on the target image to be tested to obtain an image transverse gradient set and an image longitudinal gradient set;

[0034] Specifically, gradient calculation is to detect the brightness change in the image through image processing algorithms, and then extract the gradient information in the horizontal and vertical directions. Edge detection operators (such as Sobel operator, Prewitt operator, Roberts operator, Laplacian operator, Canny operator and Scharr operator, etc.) can be used to calculate the gradient value of each pixel in the image, thereby forming a horizontal and vertical gradient set. The image horizontal gradient set represents the edge change intensity in the horizontal direction of the image, while the vertical gradient set represents the edge change intensity in the vertical direction of the image. These gradient information can be used for subsequent clarity calculations.

[0035] For example, when processing a target image containing black and white line pairs, the Sobel operator can be used to calculate the transverse gradient value and the longitudinal gradient value of each pixel; after aggregating these transverse gradient values ​​and longitudinal gradient values ​​respectively, a transverse gradient set and a longitudinal gradient set are obtained.

[0036] It should be noted that the Sobel operator uses different forms when calculating the horizontal gradient value and the vertical gradient value. When calculating the horizontal gradient value, the following is used: Figure 4 The Sobel operator shown in the figure uses the following formula to calculate the longitudinal gradient value: Figure 5 The Sobel operator shown.

[0037] By implementing step 102 and utilizing gradient calculation, edge features in the image can be captured, which are crucial for clarity evaluation; separate calculations of the horizontal and vertical gradient sets enable the detection process to more accurately reflect the clarity effects of the image in different directions, thereby providing a more detailed image quality analysis and effectively enhancing the stability and accuracy of the detection results.

[0038] Step 103, determining the imaging clarity of the camera module to be tested according to the image transverse gradient set and the image longitudinal gradient set;

[0039] Specifically, the determination of imaging clarity is completed by statistical calculation of the transverse and longitudinal gradient sets. First, the values ​​in the transverse and longitudinal gradient sets can be accumulated respectively to obtain the transverse and longitudinal gradient sums; then, the theoretical peak values ​​of the transverse and longitudinal gradients are calculated, and these peak values ​​are used to normalize the gradient sums to quantify the clarity; finally, the transverse and longitudinal clarity scores are obtained by comparing the actual gradient sums with the theoretical peak values, and the weighted sum of the two is obtained to obtain the final imaging clarity.

[0040] For example, assuming that the sum of the transverse gradient set of the target image to be tested is 800 and the theoretical peak value is 1000, the transverse clarity ratio is 0.8; the sum of the longitudinal gradient set is 750 and the theoretical peak value is 1000, then the longitudinal clarity ratio is 0.75; the transverse and longitudinal clarity are weighted and summed according to the weights (for example, the weights are 0.5 respectively), and the imaging clarity is 0.775; this imaging clarity score can be used to evaluate the imaging effect of the camera module to be tested under the current test conditions, and the higher the score, the better the clarity.

[0041] Through the implementation of step 103, the comprehensive information of the horizontal and vertical gradients is used to quantify the clarity of the image, thereby ensuring the accuracy and consistency of the clarity measurement. Moreover, by combining the analysis of a multi-directional gradient set, a reliable clarity score can be provided, which is suitable for camera module clarity detection under a variety of resolutions and shooting conditions.

[0042] It should be noted that the clarity detection in related technologies usually uses algorithms such as Modulation Transfer Function (MTF) and Spatial Frequency Response (SFR); however, these algorithms have certain limitations: they all rely on specific test targets: MTF needs to identify the brightest and darkest points in the black and white line pairs, so a line pair test target (such as Figure 2 As shown), SFR is calculated by analyzing the inclined edge, which requires a black grid test plate (such as Figure 3As shown in the figure, the related art is very sensitive to the selection of the test target. Once it is unreasonable, the result will be distorted. However, the embodiment of the present application uses the edge features of the test image to evaluate the clarity, avoiding the strong dependence on a specific test target.

[0043] In summary, the embodiment of the present application can directly use the edge features of the test image to evaluate the clarity by calculating the horizontal and vertical gradient sets, avoiding the strong dependence on the specific test target plate, not relying on the specific test chart format, and can be applicable to a variety of different scenes or test targets, so that the imaging clarity detection method has good versatility; under low-resolution conditions, even if the number of line pairs or edges is small, a relatively stable clarity result can still be obtained by gradient calculation, thereby compensating for the problem of low quantization accuracy of traditional methods in low-resolution images; the imaging clarity can be obtained through simple gradient calculation and set processing, which greatly simplifies the detection process, reduces the calculation complexity, and improves the detection efficiency; because the gradient calculation method can directly reflect the clarity and change speed of the edge, the imaging clarity detection method of the embodiment of the present application has a certain anti-interference ability, and even in the presence of slight noise, the clarity of the image can still be judged more accurately, which is particularly suitable for imaging quality detection in complex or low-light environments. In summary, the imaging clarity detection method provided in the embodiment of the present application directly utilizes edge features to perform clarity assessment through a set of horizontal and vertical gradients. It does not rely on specific charts and is applicable to a variety of scenarios. In particular, it can provide stable, interference-resistant and efficient imaging clarity detection under low-resolution conditions.

[0044] In some embodiments, the aforementioned step 102 may include: performing gradient calculation on the target image to be tested through an edge detection operator to obtain a first number of pixel transverse gradients and a second number of pixel longitudinal gradients, wherein the first number is the number of all pixels in the target image to be tested whose transverse gradients can be calculated, and the second number is the number of all pixels in the target image to be tested whose longitudinal gradients can be calculated; determining an image transverse gradient set and an image longitudinal gradient set based on the first number of pixel transverse gradients and the second number of pixel longitudinal gradients.

[0045] Specifically, the pixel horizontal gradient refers to the brightness change rate of each non-edge pixel in the target image to be tested in the horizontal direction (i.e., from left to right or from right to left). The pixel horizontal gradient can be positive, negative or zero. A positive value indicates an increase in brightness, a negative value indicates a decrease in brightness, and zero indicates no change. The pixel longitudinal gradient refers to the brightness change rate of each non-edge pixel in the target image to be tested in the vertical direction (i.e., from top to bottom or from bottom to top). The value of the pixel longitudinal gradient can also be positive, negative or zero, indicating different brightness changes. The image horizontal gradient set is a data set containing pixel horizontal gradients for evaluating the clarity of the image in the horizontal direction. The image longitudinal gradient set is a data set containing pixel longitudinal gradients for evaluating the clarity of the image in the horizontal direction. The edge detection operator can be a Sobel operator or other suitable operators for detecting the degree of pixel change in the image, thereby identifying edge information. The number of horizontal pixel rows refers to the total number of pixel rows in the horizontal direction of the target image to be tested, which is equivalent to the height of the target image to be tested (in pixels). The first number and the second number can be the same. In the implementation process, first, the edge detection operator can be used to scan each pixel in the target image to be tested, calculate the gradient values ​​of the pixel in the horizontal and vertical directions, and save the values ​​in the horizontal and vertical gradient sets; each column or row of pixels in the target image to be tested is calculated as the gradient in the horizontal and vertical directions, respectively, thereby forming a first number of horizontal gradients and a second number of vertical gradients; the horizontal gradient set represents the brightness change in the horizontal direction of the image, while the vertical gradient set represents the brightness change in the vertical direction, and these sets will be used for further clarity analysis.

[0046] For example, when calculating the gradient of a low-resolution image, an edge detection operator such as the Sobel operator can generate a pixel horizontal gradient and a pixel vertical gradient for each pixel in the image; assuming that the number of pixels of the target image to be tested is 100×100 and the number of non-edge pixels is 98×98=9604, then the first number and the second number are both 9604; by calculating these two sets, the edge features in the image can be captured to ensure the accuracy of the clarity assessment.

[0047] Through the implementation of the above embodiments, the edge detection operator is used to obtain the horizontal and vertical pixel gradient sets, which provides an efficient and accurate gradient calculation method, helps to capture the edge features in the image, ensures effective clarity detection at low resolution, and improves the applicability of clarity evaluation.

[0048] In some embodiments, the aforementioned determination of the image horizontal gradient set and the image vertical gradient set based on the first number of pixel horizontal gradients and the second number of pixel vertical gradients may include: determining the set composed of the first number of pixel horizontal gradients as the image horizontal gradient set; and determining the set composed of the second number of pixel vertical gradients as the image vertical gradient set.

[0049] For example, assuming that the first number of horizontal pixel gradient sets contains 5000 horizontal pixel gradient values, and the second number of vertical pixel gradient sets contains 5000 vertical pixel gradient values, then the 5000 horizontal pixel gradient values ​​are directly defined as the horizontal gradient set of the image, and the 5000 vertical pixel gradient values ​​are defined as the vertical gradient set of the image, thereby avoiding complicated sorting or screening processes.

[0050] Through the implementation of the above embodiment, the horizontal and vertical pixel gradient sets are directly used as the horizontal and vertical gradient sets of the image, which simplifies the data processing process, reduces unnecessary calculation steps, and effectively improves the efficiency of clarity detection. It is suitable for use in detection scenarios requiring high efficiency.

[0051] In some embodiments, the aforementioned determination of an image horizontal gradient set and an image vertical gradient set based on a first number of pixel horizontal gradients and a second number of pixel vertical gradients may include: arranging the first number of pixel horizontal gradients in descending order to obtain a pixel horizontal gradient set, and determining a set consisting of the first third number of pixel horizontal gradients in the pixel horizontal gradient set as the image horizontal gradient set, wherein the third number is a preset number of horizontal gradients; arranging the second number of pixel vertical gradients in descending order to obtain a pixel vertical gradient set, and determining a set consisting of the first fourth number of pixel vertical gradients in the pixel vertical gradient set as the image vertical gradient set, wherein the fourth number is a preset number of vertical gradients.

[0052] Specifically, the pixel longitudinal gradient set is a set consisting of the gradient values ​​of each non-edge pixel in the target image to be tested in the vertical direction (i.e., from top to bottom or from bottom to top); the pixel transverse gradient set is a set consisting of the gradient values ​​of each non-edge pixel in the target image to be tested in the horizontal direction (i.e., from left to right or from right to left); the gradient descending order process is used to screen the significant edge information in the image; after sorting the transverse and longitudinal pixel gradient sets, the maximum gradient values ​​of the preceding preset number are selected to form the transverse and longitudinal gradient sets.

[0053] Exemplarily, assuming that the first number of pixel transverse gradients is 8000 and the second number of pixel longitudinal gradients is also 8000; by arranging in descending order, a pixel transverse gradient set containing 8000 values ​​and a pixel longitudinal gradient set containing 8000 values ​​are obtained; then, assuming that the third number and the fourth number are both 500, the first 500 largest transverse gradients and the first 500 largest longitudinal gradients are selected as the final image transverse gradient set and image longitudinal gradient set to eliminate weak gradient interference.

[0054] Through the implementation of the above embodiment, the horizontal and vertical pixel gradients are arranged in descending order, and a preset number of gradients are selected as the image gradient set, which can effectively filter the low gradient noise or interference information in the image, ensure that the selected gradient value represents the important edge in the image, and further improve the accuracy of clarity detection.

[0055] In some embodiments, the aforementioned step 103 may include: adding the transverse gradients of a third number of pixels to obtain an actual value of the transverse gradient; adding the longitudinal gradients of a fourth number of pixels to obtain an actual value of the longitudinal gradient; calculating the theoretical peak value of the transverse gradient and the theoretical peak value of the longitudinal gradient based on the third number and the fourth number; determining the imaging clarity based on the actual value of the transverse gradient, the actual value of the longitudinal gradient, the theoretical peak value of the transverse gradient and the theoretical peak value of the longitudinal gradient.

[0056] Specifically, the sum of the gradient values ​​of the third number and the fourth number is the sum of the selected gradient values ​​in the pixel transverse gradient set and the pixel longitudinal gradient set to obtain the actual transverse and longitudinal gradient values; the theoretical peak value of the transverse gradient and the theoretical peak value of the longitudinal gradient are calculated by multiplying the third number and the fourth number by the maximum possible value of the gradient, respectively, to provide a standardized benchmark for clarity comparison; by comparing the actual gradient value with the theoretical peak value, the clarity performance in the transverse and longitudinal directions can be quantified, and finally the imaging clarity is determined by combining the ratio of the two directions.

[0057] For example, assume that in a low-resolution image, 500 transverse gradients and 500 longitudinal gradients are selected for calculation, and the actual value of the transverse gradient after actual addition is 40,000, and the actual value of the longitudinal gradient is 38,000; if the theoretical peak is calculated according to the maximum possible gradient of 255, the theoretical peak values ​​of the transverse gradient and the longitudinal gradient are both 127,500; the actual value is divided by the theoretical peak value, and the transverse clarity ratio is 0.31, and the longitudinal clarity ratio is 0.3. The overall imaging clarity of the image can be obtained by weighted summation or averaging.

[0058] Through the implementation of the above-mentioned embodiments, the actual values ​​and theoretical peak values ​​of the transverse and longitudinal gradient sets are compared, and the imaging clarity of the camera module is quantified, which can intuitively reflect the level of clarity, and the calculation process is clear and concise, which helps to improve the accuracy and objectivity of detection.

[0059] In some embodiments, the aforementioned determination of imaging clarity based on the actual value of the lateral gradient, the actual value of the longitudinal gradient, the theoretical peak value of the lateral gradient and the theoretical peak value of the longitudinal gradient may include: calculating the ratio of the actual value of the lateral gradient to the theoretical peak value of the lateral gradient to obtain the lateral clarity of the camera module to be tested; calculating the ratio of the actual value of the longitudinal gradient to the theoretical peak value of the longitudinal gradient to obtain the longitudinal clarity of the camera module to be tested; and performing weighted summation of the lateral clarity and the longitudinal clarity to obtain the imaging clarity.

[0060] Specifically, the image clarity is calculated by comparing the actual gradient value with the theoretical peak value to obtain the horizontal and vertical clarity scores respectively, thereby quantifying the image clarity in the horizontal and vertical directions; the weighted sum is used to combine the horizontal and vertical clarity, so that the image clarity can be flexibly weighted according to application requirements. For example, in some applications, you may pay more attention to the horizontal clarity or the vertical clarity, which can be achieved by adjusting the weight.

[0061] For example, it is assumed that the ratio of the actual value of the lateral gradient to the theoretical peak value is 0.8, and the ratio of the actual value of the longitudinal gradient to the theoretical peak value is 0.75; if the lateral clarity weight is 0.6 and the longitudinal clarity weight is 0.4, the imaging clarity is 0.8×0.6+0.75×0.4=0.78; this clarity score provides an intuitive quantitative result of the imaging quality of the camera module to be tested, which is suitable for comparing the clarity performance of different modules, and the weight can be adjusted according to actual application requirements to optimize the imaging quality evaluation.

[0062] Through the implementation of the above embodiment, the ratio of horizontal and vertical clarity is calculated and weighted summation is performed to obtain the overall imaging clarity of the camera module. The weighted summation allows the horizontal and vertical clarity to be adjusted as needed, thereby improving the comprehensiveness and flexibility of the detection results and adapting to the imaging requirements of different application scenarios.

[0063] In some embodiments, the aforementioned step 101 may include: imaging the test target plate through the camera module to obtain an initial test image; grayscale processing the initial test image to obtain a grayscale test image; denoising the grayscale test image to obtain a target test image.

[0064] Specifically, grayscale processing refers to converting the initial image to be tested into a grayscale image to reduce the interference of color information on gradient calculation, so that the image only retains brightness changes, which is convenient for subsequent edge detection and gradient calculation. De-noising further optimizes image quality by filtering out high-frequency noise or stray pixels in the image; the specific implementation process of denoising is as follows: first, calculate the mean of the 3×3 area centered on each pixel (that is, the mean of the nine-square grid); then, assuming that the grayscale value of the current pixel is "pixel value", calculate the ratio of the pixel value to the mean: ratio = |pixel value-mean| / mean; when the ratio exceeds the set threshold, the pixel is determined to be a noise point, and the original pixel value is replaced by the mean of the area, which can effectively reduce the interference of noise points on image gradient calculation.

[0065] For example, assuming that the camera module to be tested captures an image of a target plate containing multiple colors, the grayscale processing will convert the color information into corresponding grayscale values, thereby generating a grayscale image with clear brightness distribution; then, the denoising process is used to filter out the tiny noise points in the image, making the edge details of the grayscale image clearer; for example, in an image containing text or lines, the denoising process can reduce the influence of background stray pixels, making the edges of the text or lines in the image clearer, laying the foundation for subsequent gradient calculations.

[0066] Through the implementation of the above-mentioned embodiments, grayscale processing and denoising processing are used to reduce the influence of color interference and noise, ensure that the image is optimized before clarity detection, improve the accuracy of gradient calculation, and enhance the anti-interference ability of the detection method, which is particularly suitable for clarity detection in complex or low-light environments.

[0067] Furthermore, as an implementation of the aforementioned method embodiment, the present application also provides an imaging clarity detection device for implementing the aforementioned method embodiment. The device embodiment corresponds to the aforementioned method embodiment. For ease of reading, the present imaging clarity detection device embodiment will no longer repeat the details of the aforementioned method embodiment one by one, but it should be clear that the device in the present application embodiment can correspond to and implement all the contents of the aforementioned method embodiment. Figure 6 As shown, the imaging clarity detection device 20 includes: a test imaging unit 201, a gradient calculation unit 202 and a clarity determination unit 203, wherein the test imaging unit 201 is used to image the test target plate through the camera module to be tested to obtain the target image to be tested; the gradient calculation unit 202 is used to perform gradient calculation on the target image to be tested to obtain an image transverse gradient set and an image longitudinal gradient set; the clarity determination unit 203 is used to determine the imaging clarity of the camera module to be tested according to the image transverse gradient set and the image longitudinal gradient set.

[0068] In some embodiments, the gradient calculation unit 202 is also used to perform gradient calculation on the target image to be tested through an edge detection operator to obtain a first number of pixel transverse gradients and a second number of pixel longitudinal gradients, wherein the first number is the number of all pixels in the target image to be tested whose transverse gradients can be calculated, and the second number is the number of all pixels in the target image to be tested whose longitudinal gradients can be calculated; based on the first number of pixel transverse gradients and the second number of pixel longitudinal gradients, an image transverse gradient set and an image longitudinal gradient set are determined.

[0069] In some embodiments, the gradient calculation unit 202 is further configured to determine a set consisting of a first number of pixel transverse gradients as an image transverse gradient set; and determine a set consisting of a second number of pixel longitudinal gradients as an image longitudinal gradient set.

[0070] In some embodiments, the gradient calculation unit 202 is further used to arrange the first number of pixel horizontal gradients in descending order to obtain a pixel horizontal gradient set, and determine the set consisting of the first third number of pixel horizontal gradients in the pixel horizontal gradient set as the image horizontal gradient set, wherein the third number is a preset number of horizontal gradients; arrange the second number of pixel longitudinal gradients in descending order to obtain a pixel longitudinal gradient set, and determine the set consisting of the first fourth number of pixel longitudinal gradients in the pixel longitudinal gradient set as the image longitudinal gradient set, wherein the fourth number is a preset number of longitudinal gradients.

[0071] In some embodiments, the clarity determination unit 203 is also used to sum the transverse gradients of a third number of pixels to obtain an actual value of the transverse gradient; sum the longitudinal gradients of a fourth number of pixels to obtain an actual value of the longitudinal gradient; calculate the theoretical peak value of the transverse gradient and the theoretical peak value of the longitudinal gradient based on the third number and the fourth number; determine the imaging clarity based on the actual value of the transverse gradient, the actual value of the longitudinal gradient, the theoretical peak value of the transverse gradient and the theoretical peak value of the longitudinal gradient.

[0072] In some embodiments, the clarity determination unit 203 is also used to calculate the ratio of the actual value of the lateral gradient to the theoretical peak value of the lateral gradient to obtain the lateral clarity of the camera module to be tested; calculate the ratio of the actual value of the longitudinal gradient to the theoretical peak value of the longitudinal gradient to obtain the longitudinal clarity of the camera module to be tested; and perform weighted summation of the lateral clarity and the longitudinal clarity to obtain the imaging clarity.

[0073] In some embodiments, the test imaging unit 201 is further used to image the test target plate through the camera module to obtain an initial test image; grayscale process the initial test image to obtain a grayscale test image; and denoise the grayscale test image to obtain a target test image.

[0074] The present application also provides a computer-readable storage medium, which stores computer-executable instructions or computer programs. When the computer-executable instructions or computer programs are executed by a processor, the processor will be caused to execute any step of the imaging clarity detection method provided in the present application.

[0075] In some embodiments, the computer-readable storage medium may be a memory such as RAM, read-only memory (ROM), flash memory, magnetic surface memory, optical disk, or compact disc read-only memory (CD-ROM); or it may be various devices including one or any combination of the above memories.

[0076] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0077] In some embodiments, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file storing other programs or data, for example, in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0078] In some embodiments, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.

[0079] like Figure 7 As shown, the present application also provides an electronic device 30, including a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and executable on the processor, and when the processor 320 executes the computer program 311, any step of the above-mentioned imaging clarity detection method is implemented.

[0080] The present application also provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer program or the computer executable instruction from the computer-readable storage medium, and the processor executes the computer program or the computer executable instruction, so that the electronic device performs any step of the imaging clarity detection method described above in the present application.

[0081] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for detecting imaging clarity, characterized in that: include: The test target plate is imaged by the camera module to obtain the target image to be tested; Performing gradient calculation on the target image to be tested to obtain an image transverse gradient set and an image longitudinal gradient set; The imaging clarity of the camera module to be tested is determined according to the image transverse gradient set and the image longitudinal gradient set.

2. The method according to claim 1, characterized in that The step of performing gradient calculation on the target image to be tested to obtain an image transverse gradient set and an image longitudinal gradient set includes: Performing gradient calculation on the target image to be tested by an edge detection operator to obtain a first number of pixel transverse gradients and a second number of pixel longitudinal gradients, wherein the first number is the number of all pixels in the target image to be tested whose transverse gradients can be calculated, and the second number is the number of all pixels in the target image to be tested whose longitudinal gradients can be calculated; The image transverse gradient set and the image longitudinal gradient set are determined according to the first number of pixel transverse gradients and the second number of pixel longitudinal gradients.

3. The method according to claim 2, characterized in that The determining the image transverse gradient set and the image longitudinal gradient set according to the first number of pixel transverse gradients and the second number of pixel longitudinal gradients comprises: Determine a set consisting of the first number of pixel transverse gradients as the image transverse gradient set; A set consisting of the second number of pixel longitudinal gradients is determined as the image longitudinal gradient set.

4. The method according to claim 2, characterized in that: The determining the image transverse gradient set and the image longitudinal gradient set according to the first number of pixel transverse gradients and the second number of pixel longitudinal gradients comprises: Arranging the first number of pixel transverse gradients in descending order to obtain a pixel transverse gradient set, and determining a set consisting of the first third number of pixel transverse gradients in the pixel transverse gradient set as the image transverse gradient set, wherein the third number is a preset number of transverse gradients; The second number of pixel longitudinal gradients are arranged in descending order to obtain a pixel longitudinal gradient set, and a set consisting of the first fourth number of pixel longitudinal gradients in the pixel longitudinal gradient set is determined as the image longitudinal gradient set, wherein the fourth number is a preset number of longitudinal gradients.

5. The method according to claim 4, characterized in that The step of determining the imaging clarity of the camera module to be tested according to the image transverse gradient set and the image longitudinal gradient set includes: Adding the third number of pixel transverse gradients to obtain actual transverse gradient values; Adding the fourth number of longitudinal gradients of pixels to obtain actual longitudinal gradient values; Calculate the theoretical peak value of the transverse gradient and the theoretical peak value of the longitudinal gradient according to the third quantity and the fourth quantity; The imaging clarity is determined according to the actual value of the transverse gradient, the actual value of the longitudinal gradient, the theoretical peak value of the transverse gradient and the theoretical peak value of the longitudinal gradient.

6. The method according to claim 5, characterized in that The determining of the imaging clarity according to the actual value of the transverse gradient, the actual value of the longitudinal gradient, the theoretical peak value of the transverse gradient and the theoretical peak value of the longitudinal gradient comprises: Calculating the ratio of the actual value of the lateral gradient to the theoretical peak value of the lateral gradient to obtain the lateral clarity of the camera module to be tested; Calculate the ratio of the actual value of the longitudinal gradient to the theoretical peak value of the longitudinal gradient to obtain the longitudinal clarity of the camera module to be tested; The imaging clarity is obtained by performing a weighted summation on the lateral clarity and the longitudinal clarity.

7. The method according to any one of claims 1 to 6, characterized in that: The method of imaging the test target plate through the camera module to obtain the target image to be tested includes: The test target plate is imaged by the camera module to obtain an initial image to be tested; Performing grayscale processing on the initial image to be tested to obtain a grayscale image to be tested; The grayscale image to be tested is subjected to denoising processing to obtain the target image to be tested.

8. An imaging clarity detection device, characterized in that: include: The test imaging unit is used to image the test target plate through the camera module to obtain the target image to be tested; A gradient calculation unit, used for performing gradient calculation on the target image to be tested to obtain an image transverse gradient set and an image longitudinal gradient set; The clarity determination unit is used to determine the imaging clarity of the camera module to be tested according to the image transverse gradient set and the image longitudinal gradient set.

9. An electronic device, comprising: A memory and a processor, wherein the processor is used to implement the steps of the method according to any one of claims 1 to 7 when executing the computer program stored in the memory.

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