An imaging quality SFR detection method, system and electronic device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-16
- Publication Date
- 2026-08-11
AI Technical Summary
1、采样方向与真实边缘的法线方向存在夹角,导致ESF展宽,SFR计算结果偏低(即低估了镜头清晰度);
Smart Images

Figure CN122550573A_ABST
Abstract
Description
Technical Field
[0001] This application relates to an imaging quality SFR detection method, system, and electronic device, belonging to the technical field of image processing. Background Technology
[0002] Spatial frequency response (SFR) is an important indicator for evaluating the sharpness of an imaging system. Its classic algorithms (such as the ISO12233 slant edge method) are based on a core assumption: the black and white edges in the test target are an ideal straight line. The algorithm obtains a high-precision edge spread function (ESF) by oversampling along a direction perpendicular to this line.
[0003] However, in practical optical imaging systems, especially wide-angle lenses, fisheye lenses, or lenses with manufacturing errors, significant optical distortion (such as barrel distortion and pincushion distortion) is often present. This distortion causes the originally straight edge of the target to appear as a curve on the imaging plane. In this case, if the traditional straight-line assumption is still used for SFR calculation, the following problems will arise: 1. The sampling direction is at an angle to the normal direction of the real edge, which causes ESF to be broadened and SFR calculation results to be lower (i.e., the lens sharpness is underestimated). 2. Edge positioning error increases, especially in areas with large edge curvature.
[0004] To address this issue, the industry has attempted to improve sampling by fitting edge curves. Common fitting methods include circle fitting or ellipse fitting. However, in SFR testing, typically only a small segment of the ROI (Region of Interest) is analyzed, and the information contained in this arc length is limited. Under such circumstances, performing circle or ellipse fitting results in a larger deviation between the fitted edge and the actual edge, which is actually more detrimental to SFR analysis and calculation.
[0005] In conclusion, existing technologies can no longer meet people's needs and urgently need to be improved. Summary of the Invention
[0006] The main objective of this application is to provide an imaging quality SFR detection method, system, and electronic device that can adapt to edge curvature and maintain stable fitting under small sample arc lengths.
[0007] The embodiments of this application adopt the following technical solutions: According to one aspect of the embodiments of this application, an imaging quality smoothing (SFR) detection method is provided, comprising: acquiring an image to be detected; preprocessing the image to be detected; extracting an edge point set of the black-and-white transition region of the image to be detected; performing curve fitting on the edge point set using a higher-order polynomial to obtain a fitted curve equation; sampling base points on the fitted curve equation to obtain corresponding base points, wherein the higher-order polynomial is formed by multiplying each power term of the independent variable with its corresponding coefficient and then adding it to a constant term; determining the normal direction of the base points on the fitted curve; calculating the normal slope based on the normal direction; resampling the image to be detected based on the normal slope to generate a corresponding edge spread function; and processing the edge spread function to obtain an SFR curve.
[0008] According to at least one specific embodiment of the present application, the step of acquiring the image to be detected, preprocessing the image to be detected, and extracting the edge point set of the black-and-white transition region of the image to be detected further includes: performing denoising and linearization processing on the image to be detected, and extracting the sub-pixel level edge point set of the black-and-white transition region of the image to be detected.
[0009] According to at least one specific embodiment of the present application, the subpixel-level edge point set is specifically: by using a gradient operator to calculate the pixel-level gradient magnitude of the row and column array of the black and white transition region in the test image; and by using parabolic interpolation or quadratic curve fitting near the peak of the gradient magnitude to correct the edge position from integer pixel coordinates to subpixel precision. The subpixel-level edge point set includes multiple edge points, each edge point having coordinate values in subpixel units.
[0010] According to at least one specific embodiment of the present application, the step of using a higher-order polynomial to perform curve fitting on the edge point set to obtain a fitted curve equation, and sampling base points on the fitted curve equation to obtain corresponding base points, further includes: using the least squares method to perform curve fitting on the edge point set using a higher-order polynomial, wherein the higher-order polynomial is specifically a third-order or fourth-order polynomial.
[0011] According to at least one specific embodiment of the present application, the higher-order polynomial is the product of each power term of the independent variable with its corresponding coefficient and then added to the constant term. The dependent variable is equal to the sum of the constant term and each positive integer power term of the independent variable multiplied by its corresponding coefficient, wherein the power increases sequentially from the first power to the preset highest power. Base point sampling is performed on the fitted curve equation to obtain the corresponding base points. The slope of the normal line at each base point is determined according to the reciprocal of the first derivative of the fitted curve at each base point.
[0012] According to at least one specific embodiment of the present application, the step of determining the normal direction of the base point on the fitted curve, calculating the normal slope based on the normal direction, resampling the image to be detected based on the normal slope to generate a corresponding edge spread function, and processing the edge spread function to obtain an SFR curve, further includes: the dependent variable being equal to the sum of the constant term and each positive integer power term of the independent variable multiplied by the corresponding coefficient, wherein the power increases sequentially from the first power to the preset highest power; base point sampling is performed on the fitted curve equation to obtain the corresponding base point; and the normal slope at each base point is determined based on the reciprocal of the first derivative of the fitted curve at each base point.
[0013] According to at least one specific embodiment of the present application, the processing of the edge spread function further includes: extracting a sub-pixel level edge point set of the black-and-white transition region in the test image; constructing a local window with the edge points in the sub-pixel level edge point set as the center and the tangent direction of the fitting curve; within the local window, performing unequal-interval sampling along the direction perpendicular to the tangent, i.e., the normal direction; assigning the gray values obtained by the unequal-interval sampling to the corresponding edge points; sorting the gray values corresponding to all edge points according to their arc length coordinates on the fitting curve to construct an original edge spread function sequence; performing local weighted regression smoothing on the original edge spread function sequence; performing a fractional Fourier transform on the locally weighted regression smoothed edge spread function sequence; calculating the energy concentration in the fractional domain based on the magnitude of the result of the fractional Fourier transform; taking the fractional order corresponding to the maximum energy concentration as the optimal order; and outputting the transformation result under the current optimal order as the spatial frequency response curve.
[0014] According to another aspect of the embodiments of this application, an imaging quality SFR detection system is provided for implementing the imaging quality SFR detection method, comprising: an edge point set extraction module for acquiring an image to be detected, preprocessing the image to be detected, and extracting edge point sets of the black-and-white transition regions of the image to be detected; a fitting curve equation generation module for performing curve fitting on the edge point set using a higher-order polynomial to obtain a fitting curve equation, sampling base points on the fitting curve equation to obtain corresponding base points, wherein the higher-order polynomial is the product of each power term of the independent variable with its corresponding coefficient and then added to a constant term; and an edge expansion function processing module for determining the normal direction of the base points on the fitting curve, calculating the normal slope based on the normal direction, resampling the image to be detected based on the normal slope to generate a corresponding edge expansion function, and processing the edge expansion function to obtain an SFR curve.
[0015] According to another aspect of the embodiments of this application, an electronic device is provided, including: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method.
[0016] According to another aspect of the embodiments of this application, a computer-readable storage medium is provided that stores a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of the method.
[0017] The beneficial technical effects of the embodiments of this application are: This application embodiment adopts a combination of high-order polynomial curve fitting and normal direction resampling. By extracting the edge point set and fitting it to obtain the curve equation, the base point is sampled on the fitted curve and the normal direction is determined. Then, the image is resampled according to the normal slope to generate the edge spread function. After smoothing and denoising, differential differentiation, windowing, Fourier transform and normalization processing, the SFR curve is obtained.
[0018] In the technical solution provided in the embodiments of this application, the preprocessing extracts edge points to provide a data basis for fitting, the higher-order fitting gives the normal calculation a continuously differentiable mathematical model, the normal direction resampling converts geometric information into ESF signals, and the subsequent frequency domain processing completes the mapping from the spatial domain to the frequency domain, ensuring the accuracy and robustness of SFR quantization of curved edges, achieving the purpose of accurately tracking the geometric features of curved edges, and improving the adaptability of SFR detection to non-straight edges. Attached Figure Description
[0019] To more clearly illustrate the specific implementation methods of the embodiments of this application or the technical solutions in the prior art, the drawings used in the description of the specific implementation methods or the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart of the imaging quality SFR detection method.
[0021] Figure 2 This is an architecture diagram of the SFR (Self-Face Reflection) imaging quality detection system.
[0022] Figure 3 This is a schematic diagram of the electronic device.
[0023] Figure 4This is a flowchart illustrating a specific implementation of an embodiment of this application.
[0024] Figure 5 This is a diagram illustrating how lens distortion causes straight edges to bend.
[0025] Figure 6 This is a schematic diagram comparing ellipse fitting and high-order polynomial fitting on local arc segments.
[0026] Figure 7 This is a schematic diagram illustrating the principle of resampling along the normal direction of the fitted curve.
[0027] Figure 8 It is a coordinate graph of the traditional straight-line sampling method in the existing technology.
[0028] Figure 9 This is a comparison chart of SFR results for the curve normal sampling method in the embodiments of this application. Detailed Implementation
[0029] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the embodiments of this application, and not all embodiments. Based on the specific implementation methods in the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the embodiments of this application.
[0030] like Figure 1 The imaging quality SFR detection method shown includes: Step S1: Obtain the image to be detected, preprocess the image to be detected, and extract the edge point set of the black and white transition region of the image to be detected.
[0031] Step S2: Use a higher-order polynomial to perform curve fitting on the edge point set to obtain the fitted curve equation. Then, sample base points on the fitted curve equation to obtain the corresponding base points. The higher-order polynomial is the product of each power term of the independent variable and its corresponding coefficient, and then the product is added to the constant term.
[0032] Step S3: Determine the normal direction of the base point on the fitted curve, calculate the normal slope based on the normal direction, resample the image to be detected based on the normal slope, generate the corresponding edge spread function (ESF), process the edge spread function, and obtain the SFR curve.
[0033] In the technical solutions provided in steps S1 to S3, a high-order polynomial is first used to fit discrete curved edge points into a continuous curve. Then, the normal direction of each sampling point is analytically calculated based on the curve equation. The original image is resampled along the normal direction to construct an edge expansion function that can truly reflect the diffusion characteristics of curved edges, and the corresponding spatial frequency response evaluation is obtained.
[0034] In the above technical solution, step S1 completes the task of extracting effective data points from the original image, and the output edge point set provides the foundation for subsequent curve fitting. Step S2 uses a higher-order polynomial to transform the discrete points provided in step S1 into a differentiable continuous function. The continuous function describes the direction of the edge, and the normal direction at any position on the edge can be obtained by differentiation. Step S3, based on the normal direction calculated in step S2, resamples the image to obtain the preliminary measurement results of ESF. This is because only when the sampling direction is perpendicular to the real curved edge can the most obvious gray-level change be measured, thus obtaining the real ESF waveform, where: The edge point set output in step S1 determines the quality of curve fitting in step S2; the higher the accuracy of the point set, the closer the fitted curve is to the true edge. The fitted curve equation and its derivative provided in step S2 lay the mathematical foundation for resampling in step S3. Based on the continuous mathematical description in step S2, sampling in step S3 is performed according to the corresponding horizontal or vertical direction. Significant sampling direction deviations will occur at edge bends. The coordinate calculations, step size control, and other parameters required for resampling in step S3 also originate from the curve equation provided in step S2. Therefore, the technical solutions provided in steps S1 to S3 constitute a testing method from data extraction to mathematical modeling to directional sampling, forming a data-driven continuity and logical dependency, resulting in an accurate SFR curve.
[0035] In existing technologies, for a wide-angle lens with barrel distortion, if traditional methods are used to resample assuming the edges are straight lines, the sampling direction will create an angle with the true normal direction, causing the ESF waveform to be broadened and resulting in a lower calculated SFR value. However, the embodiments of this application solve the problem of sampling direction deviation through continuous curve modeling in step S2 and directional resampling in step S3. Since each sampling point is along the true normal direction, the constructed ESF waveform is steeper and closer to the theoretical value. The resulting SFR curve shows a higher frequency attenuation that better reflects the actual performance of the lens. In summary, the embodiments of this application are particularly suitable for imaging systems with significant geometric distortion, such as wide-angle lenses and fisheye lenses, and can obtain more accurate sharpness evaluation results than traditional straight-line assumption methods.
[0036] Preferably, in step S1, the image to be detected is preprocessed to extract the edge point set of the black-and-white transition region of the image to be detected. This further includes: denoising and linearizing the image to be detected to extract the sub-pixel level edge point set of the black-and-white transition region of the image to be detected. Specifically, the sub-pixel level edge point set is obtained by: calculating the pixel-level gradient magnitude using a gradient operator on the row and column matrix of the black-and-white transition region in the test image; and correcting the edge position from integer pixel coordinates to sub-pixel precision near the peak of the gradient magnitude using parabolic interpolation or quadratic curve fitting. The sub-pixel level edge point set includes multiple edge points, each edge point having coordinate values in sub-pixel units. An edge point is a pixel whose grayscale values are significantly different from those of its two adjacent pixels. An edge point exists between a pair of neighboring points, one neighboring point being inside the brighter region and the other neighboring point being outside the brighter region.
[0037] The optimization scheme in step S1 adds denoising and linearization preprocessing, and improves the edge point set from integer precision to sub-pixel precision. It also clearly defines the criteria for edge point determination. Denoising and linearization can suppress sensor noise and uneven illumination interference introduced during image acquisition, reducing numerical fluctuations in subsequent gradient calculations. By using parabolic interpolation or quadratic curve fitting to correct the edge positions from integer coordinates to sub-pixel precision, the positioning error of edge points can be reduced, improving accuracy. This makes the spatial distribution of the input points for curve fitting in step S2 closer to the geometric position of the real edge, and the deviation of the fitted curve equation from the real edge in the curved region is significantly reduced. Furthermore, the definition of edge points and neighboring points provides a quantifiable criterion for selecting valid edge points, eliminating the possibility of isolated noise points being misclassified as edge points. It can be seen that the precision of the sub-pixel level edge point set provided in step S1 will affect the precision of the derivative value of curve fitting in step S2. The derivative serves as the basis for subsequent calculation of the normal direction. Its small error will be accumulated successively in the unequal spacing sampling in step S3. Therefore, it is necessary to correct the sub-pixel of step S1.
[0038] Preferably, in step S2, the step of using a higher-order polynomial to perform curve fitting on the edge point set to obtain a fitted curve equation, and sampling base points on the fitted curve equation to obtain corresponding base points, further includes: using the least squares method to perform curve fitting on the edge point set using a higher-order polynomial, wherein the higher-order polynomial is specifically a third-order or fourth-order polynomial.
[0039] As an example, the higher-order polynomial in step S2 is the product of each power term of the independent variable with its corresponding coefficient and then added to the constant term. The dependent variable is equal to the sum of the constant term and each positive integer power term of the independent variable multiplied by its corresponding coefficient. The power increases sequentially from the first power to the preset highest power. Base points are sampled on the fitted curve equation to obtain the corresponding base points. The slope of the normal line at each base point is determined based on the reciprocal of the first derivative of the fitted curve at each base point.
[0040] In the preferred embodiment of step S2, the orientation of the local window in step S3 is determined by calculating the slope of the normal (the reciprocal of the first derivative). If the formulas used in the two steps are inconsistent, the sampling direction will deviate from the true normal. Therefore, the slope definition output in step S2 must be mathematically consistent with the sampling execution logic in step S3.
[0041] Preferably, in step S3, determining the normal direction of the base point on the fitted curve, calculating the normal slope based on the normal direction, resampling the image to be detected based on the normal slope to generate the corresponding edge spread function (ESF), and processing the edge spread function to obtain the SFR curve, further includes: The dependent variable is equal to the sum of the constant term and each positive integer power of the independent variable multiplied by its corresponding coefficient, where the power increases sequentially from the first power to the preset highest power. Base points are sampled on the fitted curve equation to obtain the corresponding base points; the slope of the normal line at each base point is determined based on the reciprocal of the first derivative of the fitted curve at each base point.
[0042] As an example, the processing of the edge expansion function further includes smoothing and denoising, differential differentiation, windowing, Fourier transform, and normalization.
[0043] In the test image, a set of subpixel-level edge points in the black-and-white transition region is extracted. A local window is constructed using the edge points in the subpixel-level edge point set as the center and the tangent direction of the fitted curve. The length of the local window is greater than its width.
[0044] Within the local window, unequal-interval sampling is performed along the direction perpendicular to the tangent (i.e., the normal direction). The gray values obtained from these unequal-interval samplings are assigned to the corresponding edge points. All gray values corresponding to the edge points are then sorted according to their arc length coordinates on the fitted curve to construct the original edge diffusion function sequence. During the unequal-interval sampling process, the sampling step size is dynamically adjusted based on the radius of curvature of the fitted curve at that point; the smaller the radius of curvature, the smaller the sampling step size.
[0045] Locally weighted regression smoothing is performed on the original edge spread function sequence. A fractional Fourier transform is then performed on the smoothed edge spread function sequence. The energy concentration is calculated in the fractional domain based on the magnitude of the fractional Fourier transform result. The fractional order corresponding to the maximum energy concentration is taken as the optimal order, and the transform result at the current optimal order is output as the spatial frequency response curve. During locally weighted regression smoothing, the regression weights decay exponentially with the arc distance between sampling points.
[0046] Locally weighted regression smoothing is a nonparametric regression method. In this method, for each target point to be smoothed, a local subset is constructed centered on that point, and weighted regression is performed on this local subset. The regression weights are coefficients assigned to each sample point within the local subset during the process, used to control the degree of influence of each point on the regression result. It can be seen that regression weights are the means to achieve locally weighted regression smoothing. Without weights, local regression degenerates into ordinary regression, meaning all points have equal weight, thus losing the significance of weighting and locality.
[0047] In this embodiment, the regression weight is specifically set to decay exponentially with the arc distance between sampling points, i.e., weight = exp(-d / σ), where d is the arc distance and σ is the bandwidth parameter. On the fitted curve, edge points closer to the current target sampling point by arc distance contribute more to the smoothed gray value; the farther away, the greater the contribution. By setting the regression weight, the smoothing operation is strictly performed along the natural direction of the curve (arc coordinates) rather than along the Cartesian coordinate direction of the image, thereby suppressing noise while preserving the geometric authenticity of the edges.
[0048] As can be seen from the description of the imaging quality SFR detection method in steps S1 to S3 above, the embodiments of this application have high fitting stability, high approximation accuracy, and correct physical meaning. The high-order polynomial is not prone to divergence within a finite arc length, avoiding the stringent requirements of elliptical fitting on the amount of data. Compared with straight lines or arcs, the high-order polynomial can more precisely describe the complex curvature changes caused by lens distortion. Sampling along the curve normal strictly follows the geometric relationship of optical imaging, eliminating the sampling angle error introduced by distortion, so that the SFR measurement results can better reflect the true resolving power of the lens.
[0049] As a preferred option, steps S2 and S3 can be combined and improved to form a new alternative technical solution. This solution avoids directional errors in curved edge sampling, achieves quantitative separation of distortion and aberration contributions, expands the output information dimension from one dimension to three dimensions, and significantly improves robustness to low-quality ROIs. The specific details of the alternative solution are as follows: Acquire the image to be detected, and extract the edge point set of the black and white transition region in the image to be detected; use a high-order polynomial to perform curve fitting on the edge point set to obtain the fitted curve equation; The fitted curve equation is regarded as a deformation mapping function from the ideal straight edge to the actual curved edge; a virtual coordinate system is established, in which the first coordinate axis is along the direction of the ideal straight edge and the second coordinate axis is perpendicular to the first axis. Each pixel in the image to be detected is transformed into the virtual coordinate system through the inverse mapping function of the deformation mapping function to generate a distortion-corrected virtual image. In the virtual image, with the ideal straight edge as the center line, the standard straight edge spatial frequency response is calculated along the direction of the second coordinate axis to obtain the first spatial frequency response curve. When performing standard straight-line edge spatial frequency response calculation, multiple parallel virtual sampling lines are generated along the first coordinate axis in the virtual coordinate system. The spacing between adjacent parallel virtual sampling lines is less than one pixel. The edge spread function and spatial frequency response curve corresponding to each parallel virtual sampling line are calculated to obtain a set of spatial frequency response curves. The mean and variance of the set of spatial frequency response curves at each spatial frequency are calculated, and the variance is used as a quantitative index of the consistency of the edge response along the first coordinate axis. The deformed mapping function is subjected to Taylor expansion to extract its first-order and second-order coefficients. Based on the first-order and second-order coefficients, the theoretical attenuation of the modulation transfer function caused by the deformed mapping itself is calculated. The theoretical attenuation is removed from the first spatial frequency response curve to obtain the second spatial frequency response curve.
[0050] After combining and improving steps S2 and S3, the problem of sampling direction deviation is explained, an evaluation dimension for sharpness uniformity is provided, and the separation of conformation and pixel difference is achieved. Existing technologies find sampling paths on the curved original image. No matter how accurate the curve fitting is, there is always a deviation between the sampling direction and the true normal. This preferred technical solution, however, no longer samples on the curved image but straightens the entire image in reverse. In the straightened virtual image, the edges become straight lines, and the sampling direction is the standard vertical direction, eliminating the problem of direction deviation. It can be seen that the more accurate the deformation relationship provided by the fitted curve equation, the closer the straightened image is to the true distortion-free state, and the more reliable the subsequent sharpness measurements will be.
[0051] Typically, existing technologies only provide a single SFR curve, losing information about the edge direction. A preferred approach involves arranging multiple parallel sampling lines along the edge direction in a virtual image. The SFR of each line is calculated independently, and then the dispersion of these parallel sampling lines at various frequencies is examined. A small variance indicates consistent sharpness across the edge, while a large variance indicates fluctuating sharpness along the edge. This effect relies on the virtual coordinate system established in the first layer—only in a straightened space can the sampling lines be arranged equally spaced and parallel. If sampling lines are directly placed on the curved original image, the spacing and direction of the lines will change with the curvature, making the statistical variance incomparable.
[0052] The above points to a key deficiency in existing technologies: the measured sharpness reduction is actually the result of two combined factors: first, geometric distortion caused by the distortion itself (even with a perfectly aberration-free lens, curved edges can still make sampling difficult); and second, the lens's actual optical aberrations. Therefore, in this preferred technical solution, a Taylor expansion is performed on the distortion mapping function. The first-order term corresponds to overall scaling and rotation, while the second-order term corresponds to barrel or pincushion distortion. Based on these coefficients, the amount of sharpness reduction caused by the distortion itself can be calculated. Subtracting this portion from the mixed SFR measured in the first layer leaves the SFR contributed purely by aberrations.
[0053] In summary, this preferred technical solution first provides a straightened virtual image, then performs uniformity statistics to obtain an accurate deformation mapping function, which is necessary for separating distortion and aberration. By providing the specific form of the deformation mapping function, data from multiple sampling lines can be used to verify the consistency of the separation results at different locations.
[0054] The following example, using a specific wide-angle lens test scenario, illustrates how this preferred technical solution is implemented in engineering applications: The preferred technical solution is implemented as follows in a specific application scenario: The lens under test was a fisheye lens with a 120-degree field of view and a sensor pixel size of 2.2 micrometers. The test chart used was the ISO 12233 standard bevel chart. A beveled block in the upper right corner of the image was selected as the ROI, and this beveled block exhibited a distinct barrel-shaped curvature on the imaging plane.
[0055] Step 1, extract the edge point set: The Region of Interest (ROI) is read, with a size of 300 pixels × 200 pixels. First, the color image is converted to a luminance image using the formula Y = 0.2126 × R + 0.7152 × G + 0.0722 × B. The Sobel operator is used to calculate the gradient magnitude of each pixel. The Sobel Gx kernel is [[-1,0,1],[-2,0,2],[-1,0,1]], and the Gy kernel is [[-1,-2,-1],[0,0,0],[1,2,1]]. For the pixel at coordinate (i,j) in the image, convolution yields Gx(i,j) and Gy(i,j), with the gradient magnitude G(i,j) = sqrt(Gx). 2 +Gy 2 ).
[0056] For each row, find the column position c_int of the pixel with the largest gradient magnitude. Take the gradient magnitudes of the current pixel and the pixels to its left and right, and denote them as G_left, G_center, and G_right. The vertex offset δ of the parabolic interpolation is δ = (G_left - G_right) / (2×(G_left - 2×G_center + G_right)). Then the sub-pixel edge column coordinates of this row are c_sub = c_int + δ. The value of δ ranges from -0.5 to 0.5. Processing row by row yields a set containing 200 sub-pixel edge points, each represented as (row number i, column coordinate c_sub).
[0057] Step 2, Curve Fitting and Deformation Mapping Function: A third-order polynomial was used to fit the above 200 points. Let the polynomial form be y = a0 + a1×x + a2×x. 2 + a3×x 3 Where x is the row number (ranging from 1 to 200) and y is the sub-pixel column coordinate. Construct a design matrix X, where the i-th row is [1, x_i, x_i]. 2 , x_i 3 The coefficient vector A = (X^T × X)^(-1) × X^T × Y, where Y is the column coordinate vector of each row.
[0058] After fitting, the fitted curve equation is considered as a deformation mapping function Φ. The physical meaning of the deformation mapping function Φ is: if there is no distortion in the original image, the edge should be a straight line perpendicular to the horizontal direction (i.e., y is equal to a certain constant when x is any value). Distortion causes this straight line to bend into the shape of the current fitted curve. Therefore, the inverse mapping from the curved image to the virtual image is: for a point with coordinates (u,v) in the virtual image (u along the edge direction, v perpendicular to the edge), its corresponding coordinates in the original image are (x,y) = Φ^(-1)(u,v). Since Φ is a polynomial, its inverse function does not have an analytical form, and a numerical method is used to solve it: for a given v (i.e., the column coordinate in the virtual image), search for x in the original image such that f(x) = v, and then y = u.
[0059] Step 3: Generate a virtual image and calculate the first SFR curve: Establish a virtual coordinate system: the first coordinate axis u is along the direction of the ideal straight line edge (i.e., the straight line from the start to the end of the original edge fitting curve), and the second coordinate axis v is perpendicular to u. The dimensions of the virtual image are set as follows: the length of the u direction is equal to the arc length of the original edge on the fitting curve, and the range of the v direction is from -5 pixels to +5 pixels to the left and right of the edge.
[0060] For each pixel (u, v) in the virtual image, first find the corresponding base point x_base on the fitted curve based on v, then determine the offset along the tangent direction based on u. The specific calculation process is as follows: first solve the equation f(x_base) = v to obtain x_base. Then, the tangent direction vector is (1, f'(x_base)), which, after normalization, yields the unit tangent vector t_unit. The corresponding point coordinates in the original image are then (x, y) = (x_base, f(x_base)) + u × t_unit. Bilinear interpolation is then used to obtain the grayscale value of this point from the original image.
[0061] In the virtual image, the ideal straight line edge is located at v=0. Using v=0 as the center line, a sampling point is taken every 0.1 pixels along the v direction, ranging from -2 pixels to +2 pixels, for a total of 41 points. The grayscale sequence of these points is the ESF. The ESF is smoothed using a fifth-order Savitzky-Golay smoothing (window width 11 points), and then the first-order central difference is calculated point-by-point to obtain the LSF. After adding a Hamming window, an FFT (256 points) is performed, and the modulus is taken and normalized to obtain the first SFR curve SFR_mixed(f).
[0062] Step 4: Obtain the sharpness consistency index from multiple sampling lines: In the virtual image, a sampling line is set every 0.5 pixels along the u direction, for a total of 20 lines. The ESF construction and SFR calculation process in step three above is repeated for each sampling line, resulting in 20 SFR curves. For each spatial frequency f (taken as 0.05, 0.10, 0.15… up to 0.50 cyc / pixel), the mean μ(f) and variance σ of the SFR values of the 20 curves at that frequency are calculated. 2 (f). Variance σ 2 (f) As an indicator of sharpness consistency at this frequency, the larger the variance, the greater the difference in sharpness at different locations of this curved edge, which may indicate the presence of blur or field curvature.
[0063] Step 5, Distortion and Aberration Separation: For the deformation mapping function f(x) = a0 + a1×x + a2×x 2 +a3×x 3 Performing a Taylor expansion, the expanded transformation function at x=0 (the starting point of the edge) is: f(x)=f(0)+f'(0)×x+(1 / 2)×f''(0)×x 2 + higher-order terms, f'(0)=a1, f''(0)=2×a2.
[0064] The first-order coefficient a1 represents overall scaling or rotation and does not affect SFR measurements. The second-order coefficient a2 represents barrel distortion (a2<0 for barrel distortion, a2>0 for pincushion distortion). The theoretical MTF attenuation caused by second-order distortion is calculated using the formula: MTF_distortion(f) = |sinc(π × f × D × a2 × L) 2 )|, where f is the spatial frequency (unit: cyc / pixel), D is the sampling line length in the virtual image (taken as 40 pixels), L is the span of the edge in the virtual image (taken as 200 pixels), sinc(x)=sin(x) / x.
[0065] For each frequency f, the SFR contribution from pure aberration is: SFR_lens(f) = SFR_mixed(f) / MTF_distortion(f). Truncation is performed when the denominator is close to 0: if MTF_distortion(f) < 0.05, then SFR_lens(f) is set to 0. This results in the second SFR curve, SFR_lens(f), which reflects the decrease in sharpness caused by the lens's inherent optical aberrations without considering distortion effects.
[0066] Output: The SFR_lens(f) curve is used to evaluate the true optical quality of the lens, with variance σ. 2(f) Used to evaluate the consistency of edge sharpness; the combination of both can be used to guide aberration balance in lens design.
[0067] like Figure 2 The imaging quality SFR detection system shown is used to implement the imaging quality SFR detection method described in any specific embodiment of the present application, including: The edge point set extraction module acquires the image to be detected, preprocesses the image to be detected, and extracts the edge point set of the black and white transition region of the image to be detected. The curve equation generation module uses a higher-order polynomial to perform curve fitting on the edge point set to obtain the fitted curve equation. Base point sampling is performed on the fitted curve equation to obtain the corresponding base points. The higher-order polynomial is the product of each power term of the independent variable and its corresponding coefficient, and then added to the constant term. The edge spread function processing module determines the normal direction of the base point on the fitted curve, calculates the normal slope based on the normal direction, resamples the image to be detected based on the normal slope, generates the corresponding edge spread function, and processes the edge spread function to obtain the SFR curve.
[0068] The implementation methods of the system described above are merely illustrative. For example, the various functional modules, units, or subsystems within the system may or may not be physically separate, or they may or may not be physical units; that is, they may be located in the same place or distributed across multiple different systems and their subsystems or modules. Those skilled in the art can select some or all of the functional modules, units, or subsystems to achieve the objectives of the embodiments of the present invention according to actual needs. Those skilled in the art can understand and implement the above-described situations without any creative effort.
[0069] like Figure 3 As shown, in addition to providing an imaging quality SFR detection method and system, this application also provides corresponding electronic devices and storage media: An electronic device includes: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus; the memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of an imaging quality SFR detection method.
[0070] A computer-readable storage medium storing a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of an image quality SFR detection method.
[0071] Explanation of reference numerals in the attached drawings: Electronic device 500, External device 514, Processor 516, Bus 518, Network adapter 520, I / O interface 522, Display device 524, Memory 528, RAM 530, Cache 532, Storage system 534, Program / Utility 540, Program module 542.
[0072] Figure 3The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this application. Typically, this electronic device could be a device within an electronic product based on the imaging quality SFR detection method described above. The electronic device 500 is represented as a general-purpose computing device. Components of the electronic device 500 may include, but are not limited to: one or more processing units or processors 516, a memory 528, and a bus 518 connecting different system components (including the memory 528 and the processor 516). The bus 518 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Microchannel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus. The electronic device 500 typically includes various computer system readable media. These media can be any available media accessible to the electronic device 500, including volatile and non-volatile media, removable and non-removable media. Memory 528 may include computer system readable media in the form of volatile memory, such as RAM 530 and / or cache 532. Electronic device 500 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 534 may be used to read and write non-removable, non-volatile magnetic media (not shown in the figure, commonly referred to as "hard disk drives"). Although not shown in the figure, storage system 534 may provide disk drives for reading and writing to removable non-volatile disks (e.g., floppy disks, portable hard disks, hot-swappable storage media) and optical disk drives for reading and writing to removable non-volatile optical disks (e.g., CD-ROMs, DVD-ROMs, or other optical media). In these cases, each drive may be connected to bus 518 via one or more data media interfaces. Memory 528 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of various specific embodiments of the present application. A program / utility 540 having a set (at least one) of program modules 542 may be stored, for example, in memory 528. Such program modules 542 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 542 typically perform the functions and / or methods described in the embodiments of this application.Electronic device 500 can also communicate with one or more external devices 514 (e.g., keyboard, pointing device, display device 524, etc.), and with one or more devices that enable a user to interact with electronic device 500, and / or with any device that enables electronic device 500 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed through I / O interface 522. Furthermore, electronic device 500 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 520. Network adapter 520 communicates with other modules of electronic device 500 via bus 518. It should be understood that, although not shown in the figures, those skilled in the art can use other hardware and / or software modules in conjunction with electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems. Processor 516 executes various functional applications and data processing by running programs stored in memory 528, such as implementing the methods provided in any one or more embodiments of this application.
[0073] like Figures 4 to 9 As shown, the embodiments of this application will be described in detail below with reference to a specific example, specifically using third-order polynomial fitting as an example: Step 1, Image Acquisition and ROI Cropping: Take a picture of a standard SFR test chart (such as the beveled block in the TE42X chart) using the camera module under test. This module exhibits significant barrel distortion. Crop a rectangular ROI containing the beveled edge from the image.
[0074] Step 2, Subpixel Edge Extraction: Convert the ROI image to grayscale, calculate the gradient magnitude using the Sobel operator, and find subpixel-level edge points along the gradient direction using parabolic interpolation. Assume we obtain n edge points: Step 3: High-order polynomial fitting, taking a third-order polynomial model as an example: Solving for coefficients using the least squares method This makes the sum of squared residuals Minimum. Compared to existing technologies, which typically employ elliptic fitting, the general equation expression is: In ellipse fitting, the ellipse boundary is obtained under short arc segments and large radii of curvature, and the edge normals are obtained at both ends of the arc. Polynomial fitting is always well-formed.
[0075] Step 4, Normal Direction Resampling: In the fitted curve Above, select a base point every 1 pixel along the x-axis. Calculate the derivative at that point: The slope of the normal at this point is: Along the slope is The straight line is sampled by floating-point interpolation on both sides of the base point to obtain a series of gray values.
[0076] Step 5, Constructing the ESF and subsequent calculations: All sampling points are arranged according to their curves Sort the data by vertical distance d to generate one-dimensional ESF data. Subsequent steps (differential LSF calculation, adding Hanning window, FFT) are consistent with the standard SFR algorithm.
[0077] Step Six, Results Output: Calculate and plot the SFR curve, outputting key indicators such as SFR@50 Cycle / Pixcel and @30 Cycle / Pixcel. Experiments demonstrate that, in lens testing with significant distortion, the SFR values of this embodiment are significantly improved compared to the traditional linear method, and exhibit better repeatability.
[0078] In the description of the embodiments of this application, the reference to terms such as "an embodiment," "example," "specific example," etc., means that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the embodiments of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0079] Furthermore, the technical solutions of the various implementation methods in this application can be combined with each other, but only if they are based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the scope of protection claimed by the embodiments of this application.
[0080] All features disclosed in the embodiments of this application, or all steps in the disclosed methods or processes, may be combined in any way, except for mutually exclusive features and / or steps. Any feature disclosed in the specification of the embodiments of this application, unless specifically stated otherwise, may be replaced by other equivalent or similar alternative features. That is, unless specifically stated otherwise, each feature is merely one example of a series of equivalent or similar features. Throughout the specification, the same reference numerals indicate the same elements.
[0081] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification of embodiments (including the corresponding claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification of embodiments (including the corresponding claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0082] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of this application, and are not intended to limit them. Although the embodiments of this application have been described in detail with reference to the foregoing specific embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein, and such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the specific embodiments of this application.
Claims
1. A method for detecting image quality surface roughness (SFR), characterized in that, include: Acquire the image to be detected, preprocess the image to be detected, and extract the edge point set of the black and white transition region of the image to be detected; A higher-order polynomial is used to fit the edge point set to obtain the fitted curve equation. Base points are sampled on the fitted curve equation to obtain the corresponding base points. The higher-order polynomial is the product of each power term of the independent variable and its corresponding coefficient, and then added to the constant term. The normal direction of the base point on the fitted curve is determined, the slope of the normal is calculated based on the normal direction, the image to be detected is resampled based on the slope of the normal to generate the corresponding edge spread function, and the edge spread function is processed to obtain the SFR curve.
2. The imaging quality SFR detection method according to claim 1, characterized in that, The step of acquiring the image to be detected, preprocessing the image to be detected, and extracting the edge point set of the black and white transition region of the image to be detected, further includes: performing denoising and linearization processing on the image to be detected, and extracting the sub-pixel level edge point set of the black and white transition region of the image to be detected.
3. The imaging quality SFR detection method according to claim 2, characterized in that, The subpixel-level edge point set is specifically defined as follows: by using the gradient operator to calculate the pixel-level gradient magnitude of the row and column array of the black and white transition region in the test image; and by using parabolic interpolation or quadratic curve fitting near the peak of the gradient magnitude to correct the edge position from integer pixel coordinates to subpixel precision. The subpixel-level edge point set includes multiple edge points, each edge point having coordinate values in subpixel units.
4. The imaging quality SFR detection method according to claim 1, characterized in that, The step of using a higher-order polynomial to perform curve fitting on the edge point set to obtain a fitted curve equation, and sampling base points on the fitted curve equation to obtain corresponding base points, further includes: using the least squares method to perform curve fitting on the edge point set using a higher-order polynomial, wherein the higher-order polynomial is specifically a third-order or fourth-order polynomial.
5. The imaging quality SFR detection method according to claim 4, characterized in that, The higher-order polynomial is the product of each power term of the independent variable and its corresponding coefficient, and then the sum of the power terms and the constant term. The dependent variable is equal to the sum of the constant term and each positive integer power term of the independent variable multiplied by its corresponding coefficient, wherein the power increases sequentially from the first power to the preset highest power. Base points are sampled on the fitted curve equation to obtain the corresponding base points. The slope of the normal line at each base point is determined based on the reciprocal of the first derivative of the fitted curve at each base point.
6. The imaging quality SFR detection method according to claim 1, characterized in that, The process of determining the normal direction of the base point on the fitted curve, calculating the normal slope based on the normal direction, resampling the image to be detected based on the normal slope to generate a corresponding edge spread function, and processing the edge spread function to obtain the SFR curve further includes: The dependent variable is equal to the sum of the constant term and each positive integer power of the independent variable multiplied by its corresponding coefficient, wherein the power increases sequentially from the first power to the preset highest power. Base points are sampled on the fitted curve equation to obtain the corresponding base points. The slope of the normal line at each base point is determined based on the reciprocal of the first derivative of the fitted curve at each base point.
7. The imaging quality SFR detection method according to claim 6, characterized in that, The processing of the edge expansion function further includes: Extract subpixel-level edge point sets of the black-and-white transition region from the test image, and construct a local window with the tangent direction of the fitted curve centered on the edge points in the subpixel-level edge point set. Within the local window, unequal interval sampling is performed along the direction perpendicular to the tangent, i.e., the normal direction. The gray values obtained by the unequal interval sampling are assigned to the corresponding edge points. The gray values corresponding to all edge points are sorted according to their arc length coordinates on the fitted curve to construct the original edge diffusion function sequence. Local weighted regression smoothing is performed on the original edge diffusion function sequence. Fractional Fourier transform is performed on the locally weighted regression smoothed edge diffusion function sequence. The energy concentration is calculated in the fractional domain based on the magnitude of the fractional Fourier transform result. The fractional order corresponding to the maximum energy concentration is taken as the optimal order. The transform result under the current optimal order is used as the spatial frequency response curve output.
8. An imaging quality SFR detection system for implementing the imaging quality SFR detection method according to any one of claims 1 to 7, characterized in that, include: The edge point set extraction module acquires the image to be detected, preprocesses the image to be detected, and extracts the edge point set of the black and white transition region of the image to be detected. The curve equation generation module uses a higher-order polynomial to perform curve fitting on the edge point set to obtain the fitted curve equation. Base point sampling is performed on the fitted curve equation to obtain the corresponding base points. The higher-order polynomial is the product of each power term of the independent variable and its corresponding coefficient, and then added to the constant term. The edge spread function processing module determines the normal direction of the base point on the fitted curve, calculates the normal slope based on the normal direction, resamples the image to be detected based on the normal slope, generates the corresponding edge spread function, and processes the edge spread function to obtain the SFR curve.
9. An electronic device, characterized in that, include: The system includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus; the memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It stores a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of the method according to any one of claims 1 to 7.