Abstract
This paper establishes a quantitative relationship model between the relative root mean square error (RRMSE) and noise parameters under the additive white Gaussian noise model. According to the difference in operator operation structure, focus measure operators are divided into two categories: squared-type and absolute-value type. Theoretical derivation shows that the RRMSE of squared-type operators is proportional to the noise variance σ2, while for absolute-value type operators, when the noise variance is large, their RRMSE is approximately proportional to the noise standard deviation σ. On this basis, a new quantitative metric—noise response slope—is proposed to characterize the robustness of operators against noise perturbation. For squared-type operators, the value of the noise response slope can be accurately derived; for absolute-value type operators, the value of the noise response slope can only be approximated. Five squared-type operators and five absolute-value type operators are selected for experiments, and the experimental slopes are obtained via linear regression fitting. The experimental results show that for squared-type operators, the coefficient of determination exceeds 0.999; except for the sine image sequence, the relative error between the theoretical slope and the experimental slope is less than 2%, and for the sine image sequence the error is less than 10%, because the sine image has a large number of pixels whose grayscale values are close to 0 or 255. For absolute-value type operators, the coefficient of determination exceeds 0.98; there is a significant difference between the theoretical slope and the experimental slope, but the Spearman correlation coefficient between them is 1, with a two-tailed test significance level of 0.05. The proposed model can estimate the robustness of operators without adding noise to the image sequence, providing an effective analytical method for the robustness evaluation and design of focus measure operators.
1. Introduction
Focus measure operators are essential tools for quantifying image sharpness, and their performance directly influences the accuracy and stability of autofocus systems, microscopic imaging, and shape-from-focus [1,2,3,4,5]. In practical imaging, images are inevitably corrupted by noise, and the stability of focus measure operators under noisy conditions has become a crucial factor limiting system performance. Therefore, how to objectively and quantitatively evaluate the noise robustness of focus measure operators has been a key issue in related research.
To compare the performance of different focus measure operators, both qualitative and quantitative evaluation metrics have been proposed in the literature, and performance assessments are typically conducted from two aspects: the shape of the focus curve and its numerical characteristics [6,7,8,9]. Qualitative metrics are often used to describe macroscopic properties of the focus curve, such as unimodality, symmetry, steepness, and unbiasedness. Although these metrics can intuitively reflect the ideal shape of the curve, they lack rigorous numerical standards, making objective comparison among operators difficult. To establish a quantifiable comparison framework, early studies such as Firestone et al. introduced basic metrics like accuracy, monotonic range, and number of false maxima, but these metrics are still insufficient to fully characterize operator behavior [10]. To further improve comparability, Pertuz et al. provided a systematic review proposing metrics such as sensitivity, peak contrast, and noise robustness, which evaluate the response intensity and anti-interference ability of operators from multiple dimensions; however, their stability remains limited under strong noise or in complex real-world scenes [11]. Subsequently, Zhai et al. introduced the width of the steep region and the local extremum factor to mathematically characterize curve structure integrity and false-peak suppression capability, offering more refined evaluation means for operator selection [12]. Yu and Lu proposed a Gaussian fitting-based performance analysis method for operators, which fits the focus measure values at different focal planes to a Gaussian curve and uses parameters such as peak width and peak change rate to quantify the peak search ability and stability of operators, applicable to performance evaluation in the absence of reference images [13]. To strengthen performance assessment under noise, Piao et al. further proposed the width of the steep region (Ws), steep-to-gentle ratio (Rsg), peak curvature (Cp), and relative root mean square error (RRMSE), forming a more comprehensive quantitative evaluation system [14]. Among these, RRMSE directly reflects the sensitivity of an operator to noise perturbation by comparing focus values before and after adding noise, providing a new approach for robustness quantification.
However, existing robustness evaluation methods, including current RRMSE research, are mainly applied based on experimental phenomena, and several issues deserve further exploration. First, the calculation of RRMSE usually depends on artificially set noise intensity, while the noise level in actual imaging systems is often unknown and changes with the environment, making the RRMSE value difficult to use directly for robustness comparison in different scenarios. Second, different focus evaluation operators show significant differences under the action of noise, but there is currently a lack of systematic theoretical analysis of the relationship between RRMSE and noise statistical parameters, which to some extent limits the interpretability and guiding significance of RRMSE as a robustness indicator.
To address the above issue, this paper investigates the response behavior of focus measure operators under additive white Gaussian noise (AWGN) from the perspective of noise statistical characteristics, with an emphasis on analyzing the quantitative relationship between RRMSE and noise parameters. Since the noise response characteristics of operators differ depending on their operation structures, the operators are first classified according to their operation structure. Then, a relationship model between RRMSE and noise statistical parameters is established. Based on this model, a new operator robustness metric is explored and designed. Commonly used typical focus measure operators are selected for experiments to verify the accuracy of the proposed model and the reliability of the robustness metric. This paper aims to provide a clearer theoretical basis for the robustness analysis and comparison of focus measure operators.
2. Methodology
2.1. Influence of Noise on Image Focus
The core task of focus evaluation operators is to quantify the local or global sharpness of an image through specific mathematical operations. However, in the actual imaging process, image signals are inevitably affected by noise, leading to deviations in focus evaluation results. To analyze the impact of noise on focus evaluation operators, this paper adopts the method of adding noise to image sequences and then evaluating the robustness of the focus operator by analyzing the difference between the focus evaluation values of the noisy image and the original image.
AWGN is a typical type of noise in the field of image processing. It possesses properties such as zero mean, controllable variance, and independent and identical distribution, enabling it to effectively simulate sensor thermal noise in real environments. AWGN is often used to evaluate the robustness of systems. Therefore, this paper uses the AWGN model to add noise to images. The additive noise model is expressed as follows:
where Ix,y represents the original image signal, εx,y~N(0,σ2) represents white Gaussian noise with a mean of 0 and variance of σ2, and zx,y represents the noisy image signal.
2.2. Relationship Between RRMSE and Noise Parameters
The focus values of different evaluation operators vary greatly. To quantify the impact of noise, it is necessary to design an error indicator that reflects the relative degree of noise disturbance. The Relative Root Mean Square Error (RRMSE) meets this requirement.
By normalizing the Root Mean Square Error (RMSE), it makes the error metric independent of the absolute scale of the focus values, eliminating the influence of different numerical scales across operators and enabling comparability among different operators. In focus evaluation, the RRMSE is computed by comparing the deviation between the noisy focus value Fn(k) and the original focus value F(k), using the average value μ of the original focus values as the normalization baseline. The calculation formula is shown in Equation (2):
where k represents the image number and K represents the total number of images. The RRMSE value reflects the relative interference degree of noise on the focus evaluation operator. A smaller RRMSE indicates that the focus value change caused by noise is relatively small and the operator is not sensitive to noise, possessing strong anti-noise robustness; a larger RRMSE indicates significant changes in the focus value due to noise and weak stability.
However, directly using the RRMSE value as a robustness indicator has limitations: it highly depends on the current noise intensity (σ2 or σ). Since the noise variance in actual environments is often unknown and dynamic, it is difficult to use it as an objective standard for inherent robustness. To address this, this paper extracts a feature quantity independent of noise intensity as a new robustness evaluation indicator by studying the laws of RRMSE changes with noise parameters.
Based on the computational structure of operators, this paper classifies them into square-type and absolute-value-type. From a signal processing perspective, the noise response mechanisms of the two types are fundamentally different:
- Squared-type: Squaring operations amplify noise energy; noise energy is linearly added to the result. It is inferred that RRMSE is related to noise variance σ2.
- Absolute-value-type: Absolute-value operations exhibit different behaviors in low-noise and high-noise regions. In the high-noise region, the output is mainly determined by noise amplitude. It is inferred that RRMSE is related to noise standard deviation σ.
Based on this theoretical hypothesis, this paper proposes using the ratio of RRMSE to the corresponding noise parameter to quantify the robustness of operators. Since this ratio is theoretically determined only by the operator’s structural parameters and image content characteristics, and is independent of the specific noise intensity level, it has the potential to serve as an objective evaluation metric. This means that, by calculating the theoretical ratio based on the content characteristics of the image sequence, we can directly predict and estimate the robustness of a focus operator without prior knowledge of the noise variance or additional noise-addition experiments.
2.3. Squared-Type Operator Derivation
According to the computational structure, square-type operators are further divided into neighborhood-difference square-type and convolution square-type.
2.3.1. Neighborhood-Difference Square-Type Operators
If the operator uses the square of the difference between a central pixel and its neighboring pixels to measure focus, the focus measure value of the image can generally be simplified as:
where Ω denotes the neighborhood of point (x,y), and M,N are the image height and width. Since image sizes are usually large, the summation can be statistically approximated by expectation:
After adding white Gaussian noise, the value Fn becomes:
Because the noise is spatially independent and zero-mean, the difference in two noise terms (εx,y−εi,j) still follows a zero-mean Gaussian distribution with variance 2σ2. In expectation, the cross term between signal and noise is zero, so the effect of noise on the focus measure mainly comes from the square term of the noise difference:
where n represents the number of difference operations in the neighborhood Ω. Substituting this into the definition of RRMSE yields:
Thus, for neighborhood-difference square-type operators, RRMSE is approximately proportional to the noise variance σ2. The coefficient before σ2 quantitatively reflects the growth rate of RRMSE with noise variance; we call it the noise response slope. Its value mainly depends on the ratio n/μ. Note that the noise response slope is not a fixed constant: as the number of participating neighborhood points n increases, the expectation of the focus measure μ also increases accordingly. Therefore, the noise response slope is an inherent property determined jointly by the operator structural parameter n and the image characteristic μ.
2.3.2. Convolution Square-Type Operators
If the operator convolves the image with a mask and then squares the convolution result to measure focus, the focus measure value F can generally be simplified as:
where H denotes the mask and ∗ denotes convolution. Under AWGN, because convolution is a linear operation, the noise after convolution still follows a zero-mean Gaussian distribution, with variance determined by the noise variance and the mask coefficients. Then, the focus measure under noise, Fn is:
Since (H∗ε)x,y has zero mean, the expectation of the cross term in the square expansion is zero, and the error is dominated by the square of the noise convolution term:
Inserting this into the RRMSE definition gives:
Therefore, for convolution square-type operators, RRMSE is also proportional to noise variance σ2; only the expression of the noise response slope differs from that of neighborhood-difference square-type operators. The key factors determining the noise response slope include not only the image mean μ but also the sum of squares of the convolution kernel coefficients (the energy of the filter). This implies that when designing an operator, by rationally optimizing the energy distribution of the mask coefficients, the noise robustness can be theoretically predicted.
From the above derivations, both neighborhood-difference and convolution square-type operators have RRMSE proportional to σ2; therefore, they can be uniformly classified as square-type operators.
2.4. Absolute-Value-Type Operator Derivation
Based on the computational structure, absolute-value-type operators are further divided into neighborhood-difference absolute-value type and convolution absolute-value type.
2.4.1. Neighborhood-Difference Absolute-Value-Type Operators
If the operator uses the absolute value of the difference between a central pixel and its neighboring pixels to measure focus, the focus measure value F can generally be simplified as:
Fn denote the focus measure after adding noise:
Any image can be divided into grayscale flat areas, grayscale change areas, and grayscale transition areas. If the grayscale variance of a certain area is much smaller than the noise variance, then this area belongs to a grayscale flat area. If the grayscale variance is much greater than the noise variance, then this area belongs to a region with obvious grayscale variation. If the grayscale variance is close to the noise variance, then this region belongs to a grayscale transition region. This paper mainly discusses the influence of grayscale flat areas and grayscale change areas on the output of the focusing measure operator. For the grayscale transition areas, this paper does not discuss the resulting error, which will be explained by experiments later.
Let F′ be the focus measure from flat regions of the original image, be the focus measure from flat regions after adding noise, and P be the number of pixels in flat regions. When the noise variance is large, it can be assumed that Ix,y−Ii,j << εx,y−εi,j; therefore,
Let . Note that the probabilities of sgn(Ix,y−Ii,j) ≥ 0 and sgn(Ix,y−Ii,j) < 0 are approximately equal, so there is
For regions with significant gray variation, it can be assumed that Ix,y−Ii,j >> εx,y−εi,j. Let F″ be the focus measure from those regions in the original image, be the focus measure after adding noise, and Q be the number of pixels in those regions. Then,
Considering that the probabilities of sgn(εx,y−εi,j) ≥ 0 and sgn(εx,y−εi,j) < 0 are approximately equal; therefore, for areas where the grayscale of the image changes significantly, it can be considered that − F″ ≈ 0.
For any image, without considering gray transition regions, the above two cases can be obtained:
Now,
It can be seen from Equation (20) that, under the condition of a constant area of grayscale flat areas, the RRMSE of the neighborhood difference absolute-value type operator is proportional to the noise standard deviation σ. In practical applications, the size of the grayscale flat areas correlates with σ2 and increases with its magnitude. When the area of grayscale flat areas does not change significantly, the RRMSE can be considered approximately proportional to the noise standard deviation σ, and the noise response slope can be used to represent the robustness of the operator. C reflects the intercept of the linear relationship, which is always negative. Experimental results show that the value of C is generally small and has little effect on robustness evaluation; therefore, in practical applications, the influence of C can be ignored.
Since the area of grayscale flat areas in an image is generally unknown, the actual value of the noise response slope of absolute-value type operator is difficult to obtain accurately. To estimate the noise response slope, we can set P/MN = 1, meaning the area of grayscale flat areas equals the total image area. The noise response slope obtained under this condition is referred to as the theoretical slope in this paper. Obviously, the theoretical slope is always greater than the actual value of the noise response slope and can be considered as the theoretical upper bound of the actual value.
2.4.2. Convolution Absolute-Value-Type Operators
If the operator convolves the image with a mask and then takes the absolute value of the convolution result, the focus measure F can generally be simplified as:
The focus measure of the noisy image Fn is:
Again, we separate the image into flat regions and regions with significant variation. For flat regions, it can be assumed that (H∗I)x,y << (H∗ε)x,y; therefore,
At this moment,
Let C = E[∣(H∗I)x,y∣], considering that the probabilities of sgn(H∗I)x,y ≥ 0 and sgn(H∗I)x,y < 0 are approximately equal, so that
For regions with significant variation, it can be assumed that (H∗I)x,y >> (H∗ε)x,y; therefore, − F″ ≈ 0. Combining both cases yields:
We know that
We obtain
Equation (28) demonstrates that the relationship between the RRMSE of convolutional absolute-value operators and σ resembles that of neighborhood difference absolute-value operators. Thus, their robustness can still be quantified using the noise response slope.
From the above derivations, both neighborhood-difference and convolution absolute-value-type operators have RRMSE approximately proportional to σ; thus, they can be uniformly classified as absolute-value-type operators.
2.5. Summary
Combining the theoretical derivations in Section 2.3 and Section 2.4, although square-type and absolute-value-type operators have different computational forms, their noise response behavior under AWGN can be unified into a linear model in a statistical sense. The only difference is the independent variable of the linear model, which is determined by the operator structure: square-type operators correspond to noise variance σ2, while absolute-value-type operators correspond to noise standard deviation σ.
Based on this unified description, we introduce the noise response slope (ktheory) to characterize the inherent sensitivity of a focus measure operator to noise perturbation. It is defined as the ratio of RRMSE to the corresponding noise parameter, i.e., the theoretical slope of the RRMSE–noise relationship curve, as shown in Equation (29). This parameter integrates the operator’s structural parameters, image statistics, and noise propagation behavior into a single scalar indicator, providing a unified quantitative standard for comparing the robustness of different operators.
where Ψnoise denotes the noise statistical parameter matching the operator type (σ2 for square-type, σ for absolute-value-type). Table 1 lists the expressions of ktheory for different operator types. The establishment of this unified noise response model clarifies the physical meaning of ktheory and provides a direct basis for verifying the theoretical analysis by fitting the RRMSE–noise curve slopes in subsequent experiments.
Table 1.
Expressions of ktheory for different operator types.
3. Focus Measure Operators
To verify the theoretical differences in noise response between square-type and absolute-value-type operators [15,16,17], this section introduces the typical operators selected for the experiments.
3.1. Square-Type Focus Operators
- Brenner
Brenner operator measures image detail intensity by calculating the square of the gray difference between two pixels spaced horizontally by two. It is defined as:
- 2.
- EOG
Energy of Gradient operator uses the cumulative sum of squared gray differences between adjacent pixels in both horizontal and vertical directions as the sharpness measure.
- 3.
- Roberts
Roberts operator adopts the squared sum of the cross subtraction of the grayscale values of four adjacent pixels as the gradient value at each pixel. The gradient values of all pixels are then summed to obtain the measure.
- 4.
- Tenengrad
Tenengrad operator is based on the Sobel operator. It calculates the sum of squares of the horizontal and vertical gradient responses at each pixel to represent the overall gradient energy of the image.
Gx and Gy are the layer responses of the Sobel operator in the horizontal and vertical directions.
- 5.
- EOL
Energy of Laplacian operator uses the sum of squares of the Laplacian operator response. The Laplacian operator is more sensitive to details and edges, capturing local variations better.
Among these five operators, Brenner, EOG, and Roberts belong to the neighborhood-difference square-type, while Tenengrad and EOL belong to the convolution square-type.
3.2. Absolute-Value-Type Operators
- SMD
Sum of Modulus of Differences operator computes the sum of absolute gray differences between adjacent pixels to reflect the intensity of gray variations. It has low computational cost and good real-time performance.
- 2.
- Improved Brenner
Improved Brenner operator adds vertical gradient calculation to the traditional Brenner algorithm and uses absolute summation instead of squares, making it more adaptable to complex images while maintaining computational efficiency [18].
- 3.
- RobertsAbs
RobertsAbs is an alternative form of the Roberts operator, directly using the sum of absolute values of the two gradient components obtained from the Roberts cross operator. In fact, many FM operators have both absolute and square versions.
- 4.
- SML
Sum of Modified Laplacian operator accumulates the absolute values of horizontal and vertical second-order differences, highlighting details while being relatively robust.
- 5.
- Prewitt
Prewitt operator uses the Prewitt operator to compute the sum of absolute horizontal and vertical gradients.
Px and Py are the layer responses of the Prewitt operator in the horizontal and vertical directions.
Among these five operators, SMD, Improved Brenner, and RobertsAbs belong to the neighborhood-difference absolute-value-type, while SML and Prewitt belong to the convolution absolute-value-type.
4. Experiments
4.1. Experimental Setup
To comprehensively evaluate the accuracy and applicability of the proposed theoretical model, the experiments were designed to cover diverse test data ranging from ideal simulations to complex real-world scenarios. The experimental study mainly consisted of two parts: first, verifying the linear assumption of the noise response model; and second, validating the effectiveness of the theoretical sensitivity coefficient as a robustness indicator.
4.1.1. Experimental Datasets
Two representative types of image sequences are selected for the experiments to systematically evaluate the validity and applicability of the proposed theoretical model under both controlled conditions and real-world scenes. Each sequence covers multiple images at different depths of field. Partial examples are shown in Figure 1, and the sequence parameters are listed in Table 2.
Figure 1.
Examples of image sequences: (a–c) Cone; (d–f) Sine; (g–i) Coin; (j–l) Pencil.
Table 2.
Parameters of image sequences.
The first category consists of simulated sequences, generated according to the defocus imaging model in [19], including two typical surface topographies: a cone and a sinusoidal curved surface. This type of data features precisely controllable focal plane variations and structural parameters, effectively excluding complex interfering factors present in real imaging, thereby enabling validation of the correctness and underlying mechanisms of the theoretical model. Among them, the cone and the sinusoidal curved surface represent monotonic and periodic structures, respectively, covering typical geometric characteristics.
The second category comprises real sequences, all sourced from public datasets, including a coin surface and a pencil image sequence. This type of data exhibits complex texture distributions and rich spectral components, which can be used to evaluate the model’s performance under actual imaging conditions, thereby verifying its generalization capability and engineering applicability.
The experiment simulated the noise environment by adding zero-mean AWGN. For squared operators, the noise variance σ2 was set within the range of [0,100]; for absolute-value operators, the noise standard deviation σ was set within the range of [0,10].
To simulate the dynamic range limitations of real imaging systems and evaluate their impact, this experiment established two grayscale processing conditions for comparison:
Restricted grayscale range: constraining the grayscale values of noise-embedded images within the 0–255 range to approximate real-world noise constraints, enabling more objective assessment of the model’s actual performance in practical applications.
Unrestricted grayscale range: Allows noise-superimposed grayscale values to exceed the 0–255 range to maintain the ideal statistical distribution of noise.
Under each of the above conditions, to eliminate the influence of random noise and improve the statistical reliability, multiple independent repeated experiments are conducted for each noise intensity. In each experiment, independent Gaussian white noise is randomly generated and added to the original image sequence. For each operator, the experiment is repeated 5 times at each noise level, and the corresponding RRMSE–noise relationship curves and their linear fitting results are calculated.
4.1.2. Evaluation Metrics
To quantitatively evaluate the effectiveness of the established theoretical model, this paper selects Linear goodness of fit and relative error as the core evaluation indicators. This selection is based on the structural characteristics of the theoretical model and the validation objectives, as detailed below:
- Linear goodness of fit
The core assumption of the theoretical model in this paper is that a linear relationship exists between the RRMSE and the noise parameter (σ2 or σ). Therefore, the primary issue in verifying the model is to determine whether the experimental data conform to a linear trend. The linear goodness of fit, R2, can comprehensively measure the consistency between the experimental data and the theoretical linear model. When R2 is close to 1, it indicates that the experimental results statistically support the proposed linear relationship. Thus, this metric is used to verify the rationality of the model’s structural assumption. The definition of R2 is shown in Equation (42):
where represents the experimental observed values, the linear fitted values, the mean of the observed values, and N the number of data points.
- 2.
- Relative error
After confirming the validity of the linear relationship, it is further necessary to evaluate the reliability of the noise response slope as a robustness indicator. To this end, a relative error between the theoretical slope ktheory and the experimental regression slope kexp is introduced to measure the predictive accuracy of the theoretical noise response slope value relative to the actual value. This relative error is denoted by Re and is defined as shown in Equation (43).
The experiments were conducted on the Microsoft Windows 11 (Microsoft Corp., Redmond, WA, USA), with an Intel Core i5-1035G1 processor (Intel Corporation, Santa Clara, CA, USA) and 8 GB of memory. MATLAB R2017 (The MathWorks, Inc., Natick, MA, USA) was used as the software platform.
4.2. Linear Validation of the Noise Response Model
This section focuses on validating the unified noise response model derived in Section 2. Specifically, for squared-type operators, the RRMSE is proportional to the noise variance σ2; for absolute-value-type operators, the RRMSE is proportional to the noise standard deviation σ in the noise-dominant region.
4.2.1. Linear Validation for Squared-Type Operators
Figure 2, Figure 3, Figure 4 and Figure 5 illustrate the single-experiment values and fitted lines of RRMSE versus σ2 for the five squared-type operators introduced in Chapter 3 under different image sequences.
Figure 2.
RRMSE–σ2 experimental values and their fitted lines under the Cone sequence.
Figure 3.
RRMSE–σ2 experimental values and their fitted lines under the Sine sequence.
Figure 4.
RRMSE–σ2 experimental values and their fitted lines under the Coin sequence.
Figure 5.
RRMSE–σ2 experimental values and their fitted lines under the Pencil sequence.
As shown in Figure 2, Figure 3, Figure 4 and Figure 5, for all four image sequences, the RRMSE of each squared-type focus measure operator exhibits an approximately linear increasing trend with the noise variance σ2. To quantitatively evaluate the reliability of this linear relationship, Table 3 presents the coefficient of determination R2 for each operator on each image sequence.
Table 3.
Goodness of Linear Fit of Squared-Type Operators on Different Sequences.
The experimental results show that whether for simulated image sequences (Cone and Sine) or real image sequences (Coin and Pencil), the R2 values of all squared-type operators remain above 0.999, indicating a strong linear correlation between RRMSE and σ2 within the considered noise range. Although slight differences in R2 values exist across image sequences, all values remain at a very high level, demonstrating that this linear relationship is highly stable. This observation is consistent with the theoretical analysis of squared-type operators presented in Section 2.3, namely that under additive Gaussian noise, the RRMSE of squared-type operators is linearly related to the noise variance.
Table 4, Table 5, Table 6 and Table 7 present, for five squared-type operators on different image sequences, the theoretical slope ktheory, as well as the mean values of the experimental slopes kexp1 (Restricted grayscale range) and kexp2 (Unrestricted grayscale range) obtained from repeated experiments under the two grayscale processing conditions, together with the mean and standard deviation of the corresponding relative errors Re1 and Re2. Due to the minimal variations in kexp1 and kexp2 during experiments, resulting in small standard deviations, this study only presents the standard deviations S1 and S2 for Re1 and Re2. The numbers in parentheses within the table indicate the slope-based operator robustness ranking (listed in descending order of robustness).
Table 4.
Slope Comparison of Squared-Type Operators on the Cone Sequence.
Table 5.
Slope Comparison of Squared-Type Operators on the Sine Sequence.
Table 6.
Slope Comparison of Squared-Type Operators on the Coin Sequence.
Table 7.
Slope Comparison of Squared-Type Operators on the Pencil Sequence.
4.2.2. Analysis of Experimental Results for Squared-Type Operators
From the experimental results, it can be seen that for the same image sequence, the noise response slopes of different operators differ significantly, yet their numerical values remain comparable. For different image sequences, the noise response slope of the same operator varies markedly, indicating that the noise response slope changes with image content, but the robustness ranking of the operators remains unchanged. For all image sequences, the Spearman correlation coefficient between the theoretical slope and the experimental slope is 1, with an exact probability of p = 0.017 (two-tailed), which is significant at the 0.05 level. Moreover, the results of repeated experiments show that the standard deviation of Re for each operator is much smaller than its mean, indicating that random noise has limited impact on the overall conclusions, and the proposed model exhibits good stability and repeatability.
Except for the sine image sequence, the relative errors between the theoretical slope and the experimental slope for the other image sequences remain low, with a maximum relative error not exceeding 2%. For the sine image sequence, there is a noticeable difference (less than 10%) between the values of ktheory and kexp1, but the difference between ktheory and kexp2 is very small (less than 2%), and the Re1 values of different operators are essentially the same. This indicates that the error is mainly caused by the image itself and has little relation to the computational structure of the focus measure operators. The sine image contains a large number of pixels with grayscale values near the extremes (0 or 255). Grayscale truncation significantly affects the noise distribution, leading to a considerable deviation in the kexp1 values. Comparing the experimental data under the two grayscale processing conditions shows that the influence of grayscale truncation on the noise response model proposed in this paper depends primarily on the grayscale distribution of the image. If the image contains many pixels with grayscale values near the extremes, a notable deviation occurs; if most pixels have grayscale values at intermediate levels, grayscale truncation does not have a significant effect. In practical applications, the grayscale distribution of most images is at intermediate levels, and under such conditions, the proposed noise response model exhibits strong robustness against deviations in statistical distribution caused by limited dynamic range. For the sine image sequence, although there is a noticeable difference between ktheory and kexp1, the robustness ranking of operators based on kexp1 values is the same as that based on ktheory and kexp2 values.
Overall, for squared-type operators, the theoretical model established based on the assumption of noise energy superposition can accurately characterize the error propagation behavior under noise, and it is therefore feasible to use ktheory as an indicator for evaluating operator robustness.
4.2.3. Linear Validation for Absolute-Value-Type Operators
Figure 6, Figure 7, Figure 8 and Figure 9 illustrate the single-experiment values and fitted lines of RRMSE versus σ for the five absolute-value-type operators introduced in Chapter 3 under different image sequences.
Figure 6.
RRMSE–σ experimental values and their fitted lines under the Cone sequence.
Figure 7.
RRMSE–σ experimental values and their fitted lines under the Sine sequence.
Figure 8.
RRMSE–σ experimental values and their fitted lines under the Coin sequence.
Figure 9.
RRMSE–σ experimental values and their fitted lines under the Pencil sequence.
From Figure 6, Figure 7, Figure 8 and Figure 9, it is observed that for all sequences, the RRMSE of each absolute-value-type operator generally increases monotonically with σ. Unlike square-type operators, the RRMSE–σ curves exhibit some nonlinear deviation in the low-noise region, gradually approaching linearity as noise intensity increases. The fitted lines show negative intercepts, which is consistent with the theoretical model.
To quantitatively analyze the overall noise response characteristics of absolute-value-type operators, the linear fit goodness (R2) over the entire noise range was calculated, as shown in Table 8. It can be seen that the linear goodness of fit of each operator under different image sequences is maintained at a high level as a whole, and the R2 values are all greater than 0.98, indicating that the relationship between RRMSE and noise standard deviation sigma can be approximated by a linear model.
Table 8.
Goodness of Linear Fit of Absolute-Value-Type Operators on Different Sequences.
The experimental results demonstrate that when noise variance is small, the slope of the RRMSE-σ curve exhibits significant variation with changes in noise variance; however, when noise variance is large, the slope remains nearly constant. Clearly, when noise variance is sufficiently small, the area of grayscale flat areas approaches zero, while the area of grayscale change areas approaches the total image area. As previously discussed, the RRMSE output approaches zero under these conditions. As noise variance increases, the area of grayscale flat areas gradually expands, while the area of grayscale change areas decreases—resulting in an increasing p-value. This leads to a gradual rise in the slope of the RRMSE-σ curve, indicating a noticeable change in its gradient. When noise variance reaches a certain threshold, further increases in noise variance no longer significantly alter the area of grayscale flat areas or the p-value; consequently, the slope of the RRMSE-σ curve remains largely unchanged, approximating a straight line. Therefore, in noise-dominated high-noise regions, the RRMSE of absolute-value operators is approximately proportional to the noise standard deviation σ, allowing the noise response slope to serve as an indicator of their robustness. Equations (20) and (28) objectively describe this phenomenon. In practical applications, we recommend using the noise response slope to estimate the robustness of absolute-value operators when the noise standard deviation exceeds 1.
Differences in fit results across sequences are related to the structural complexity of image content, but they do not change the basic linear trend. This indicates that the proposed noise response model is applicable across different types of image sequences.
Table 9, Table 10, Table 11 and Table 12 present, for five absolute-value type operators on different image sequences, the theoretical slope ktheory, as well as the mean values of the experimental slopes kexp1 (Restricted grayscale range) and kexp2 (Unrestricted grayscale range) obtained from repeated experiments under the two grayscale processing conditions, together with the mean and standard deviation of the corresponding relative errors Re1 and Re2.
Table 9.
Slope Comparison of Absolute-Value-Type Operators on the Cone Sequence.
Table 10.
Slope Comparison of Absolute-Value-Type Operators on the Sine Sequence.
Table 11.
Slope Comparison of Absolute-Value-Type Operators on the Coin Sequence.
Table 12.
Slope Comparison of Absolute-Value-Type Operators on the Pencil Sequence.
4.2.4. Analysis of Experimental Results for Absolute-Value-Type Operators
It can be seen from the experimental results that the deviation between ktheory and kexp of the absolute value operator is large. Overall, the deviation on the simulated image sequence is relatively large, and the deviation on the real image sequence is relatively small. It can be seen from the previous text that in addition to the grayscale flat area and the grayscale obvious change area, there is also a grayscale transition area in the image. The theoretical model in this paper ignores the grayscale transition area, so there is an error. Although there are differences between the two, ktheory is always greater than kexp, which is consistent with the assumption of this paper.
For the same image sequence, the relative errors of ktheory and kexp of different absolute value operators are different, mainly because the noise robustness of different operators is different, which leads to the different division of the grayscale flat area, grayscale transition area and grayscale obvious area of the image by the operator. That is, the grayscale flat area for one operator belongs to the grayscale obvious area or grayscale transition area for another operator. Therefore, the division of the grayscale area of the image is not fixed, but is related to the robustness of the operator. It can be seen from the experimental results that the stronger the robustness of the operator, the greater the relative error, and the weaker the robustness of the operator, the smaller the relative error.
At the same time, it can be seen from the experimental results that the relative error of the same absolute value operator is different for different image sequences. For example, the relative error of the Prewitt operator in the cone image sequence is 42.08%, and the relative error in the Pencil image sequence is only 18.98%, which shows that the relative error is also closely related to the structural complexity of the image content. Therefore, for the absolute value operator, the relative error of ktheory and kexp is related to both the image content and the operation structure of the operator. To estimate the actual value of the noise response slope more accurately in practical applications, we recommend multiplying the theoretical slope by a coefficient. This coefficient is derived from the mean Re value and appropriately approximated: for synthetic image sequences, the coefficient is 0.7; for real image sequences, the coefficient is 0.85.
Similar to square-type operators, grayscale truncation has a significant impact on the experimental values for the sine image sequence (kexp1 values are noticeably larger than kexp2 values), while its effect on other image sequences is minor. This further validates our inference—that the deviation is caused by the large number of pixels at the grayscale extremes in the sine image sequence and is unrelated to the computational structure of the operators.
For the absolute-valued focusing evaluation operator, although there is always a certain difference between ktheory and kexp, there is a certain law in this difference, that is, the relative errors of all operators change synchronously. For example, for all operators, the relative error of the Pencil image sequence is always the smallest, while the relative error of the cone image sequence is always the largest, and it also shows a similar law on the sine image sequence and the coin image sequence. In addition, we have also done experiments on other image sequences, all of which show similar laws, which shows that the change law of the relative error is mainly determined by the image content. As a result, although there are differences between ktheory and kexp, the order of operator robustness is exactly the same for different image sequences. For all image sequences, the Spearman correlation coefficient between theoretical slope and experimental slope was 1, with an exact probability of p = 0.017 (two-tailed), which is significant at the 0.05 level. For operator robustness analysis, the main purpose is to compare the robustness of different operators and provide a reference for operator selection. From this perspective, ktheory can be used as an upper limit estimate of the actual value of the noise response slope and as a reference index for evaluating the robustness of absolute-valued operators.
Combining the results for square-type and absolute-value-type operators, the theoretical sensitivity coefficient ktheory numerically approximates kexp well enough to capture the basic characteristics of the RRMSE growth rate under noise. This means that, in practical applications, one can estimate the noise sensitivity of an operator using image statistics and operator structural parameters without performing multiple noise-addition experiments. Compared with computing RRMSE at a specific noise level, the noise response slope, as a parameter describing the error trend with noise, does not depend on the choice of noise intensity and more intuitively reflects the overall noise sensitivity of the operator. Therefore, the noise response slope provides a more concise analysis tool for selecting and optimizing focus measure operators.
5. Conclusions
This paper systematically analyzes the noise robustness of focus measure operators from both theoretical derivation and experimental validation, and establishes a quantitative relationship model between the RRMSE and noise parameters. On this basis, a new robustness metric—the noise response slope—is proposed, providing a quantitative reference for evaluating the robustness of operators. The study reveals the essential differences in error growth mechanisms between different types of operators under AWGN. Theoretical analysis and experimental results show that:
- For squared-type operators, the RRMSE is highly linearly correlated with the noise variance σ2 across all tested sequences. When the image gray-level distribution lies in the mid-range, the theoretical slope and the mean experimental regression slope are in high agreement; when the image contains a large number of pixels at the extreme gray limits, a deviation exists between the theoretical slope and the mean experimental regression slope. This deviation is typically less than 10% and does not alter the robustness ranking of the operators.
- For absolute-value type operators, the RRMSE is approximately linearly correlated with the noise standard deviation σ over the full noise range, with a certain nonlinear deviation when the noise variance is small, which is consistent with the theoretical assumption of “large noise variance”. Although there is a numerical difference between the theoretical slope and the experimental slope, their rankings of operator robustness are consistent.
The proposed “noise response slope” describes the global trend of RRMSE as a function of noise intensity. This metric can be directly calculated via theoretical formulas without actually adding noise to the image sequences. Overall, this metric can reveal the intrinsic sensitivity of operators to noise and provide a theoretical benchmark for robustness evaluation. The theoretical model presented in this paper provides a more concise and efficient theoretical analysis tool for performance evaluation of focus measure operators and even for the design of new operators, and holds good potential for engineering applications. For absolute-value type operators, there still exists a noticeable deviation between the theoretical and experimental values, and the theoretical model requires further optimization. Future work can extend the model to other noise types (e.g., Poisso–Gaussian mixed noise) and introduce finer modeling of gray-level transition regions to reduce the theoretical deviation of absolute-value type operators, thereby enhancing its applicability in practical focus measurement and 3D surface reconstruction systems.
Author Contributions
Conceptualization, W.P.; Methodology, W.P.; Software, C.W.; Validation, W.P. and C.W.; Formal analysis, W.P. and C.W.; Investigation, Y.H.; Resources, W.P.; Data curation, C.W.; Writing—original draft, C.W.; Writing—review and editing, W.P.; Visualization, Y.H.; Supervision, W.P.; Project administration, W.P.; Funding acquisition, W.P. All authors have read and agreed to the published version of the manuscript.
Funding
This work was supported by Natural Science Foundation of Heilongjiang Province of China (LH2022F028).
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
The data that support the findings of this study are available from the corresponding author upon reasonable request.
Conflicts of Interest
The authors declare no conflicts of interest.
References
- Nayar, S.K.; Nakagawa, Y. Shape from focus. IEEE Trans. Pattern Anal. Mach. Intell. 1994, 16, 824–831. [Google Scholar] [CrossRef] [Scilit]
- Dogan, R.O.; Dogan, H.; Cal, S. From Handcrafted Focus Measurement Operators to Deep Learning: A Comprehensive Review of Shape from Focus Strategies. Arch. Comput. Methods Eng. 2026, 33, 4609–4623. [Google Scholar] [CrossRef] [Scilit]
- Billiot, B.; Cointault, F.; Journaux, L.; Simon, J.-C.; Gouton, P. 3D Image Acquisition System Based on Shape from Focus Technique. Sensors 2013, 13, 5040–5053. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Zheng, Z.; Feng, S.; Chen, C.; Qu, Y. Depth From Focus in 3-D Measurement: An Overview. IEEE Trans. Instrum. Meas. 2025, 74, 1–38. [Google Scholar] [CrossRef] [Scilit]
- Chen, L.; Zhang, S. Large depth-of-field microscopic structured-light 3D imaging with focus stacking. Opt. Lasers Eng. 2023, 167, 107623. [Google Scholar] [CrossRef] [Scilit]
- Groen, F.C.; Young, I.T.; Ligthart, G. A comparison of different focus functions for use in autofocus algorithms. Cytometry 1985, 6, 81–91. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Sun, Y.; Duthaler, S.; Nelson, B.J. Autofocusing algorithm selection in computer microscopy. In Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems, Edmonton, Alta, 2–6 August 2005. [Google Scholar] [CrossRef] [Scilit]
- Sun, J.; Yuan, Y.; Wang, C. Comparison and Analysis of Algorithms for Digital Image Processing in Autofocusing Criterion. Acta Opt. Sin. 2007, 27, 35–39. [Google Scholar]
- Ang, W.; Rong, L. Research on focus evaluation algorithm for three-dimensional microscopic vision measurement of focusing. Meas. Technol. 2023, 43, 102–111. [Google Scholar] [CrossRef]
- Firestone, L.; Cook, K.; Culp, K.; Talsania, N.; Preston, K., Jr. Comparison of autofocus methods for automated microscopy. Cytometry 1991, 12, 195–206. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Pertuz, S.; Puig, D.; Angel Garcia, M. Analysis of focus measure operators for shape-from-focus. Pattern Recognit. 2013, 46, 1415–1432. [Google Scholar] [CrossRef] [Scilit]
- Zhai, Y.; Zhou, D.; Liu, Y.; Liu, S.; Peng, K. Design of Evaluation Index for Auto-Focusing Function and Optimal Function Selection. Acta Opt. Sin. 2011, 31, 242–252. [Google Scholar] [CrossRef]
- Yu, C.; Lu, R. Performance Evaluation Method for Focusing Evaluation Operator in Superposed Large Depth Imaging. Laser Optoelectron. Prog. 2022, 59, 1415027. [Google Scholar]
- Piao, W.; Han, Y.; Hu, L.; Wang, C. Quantitative Evaluation of Focus Measure Operators in Optical Microscopy. Sensors 2025, 25, 3144. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Wang, X.; Yao, T.; Liu, M.; Zheng, K.; Zhao, C.; Xiao, L.; Zhu, D. A Normalized Absolute Values Adaptive Evaluation Function of Image Clarity. Sensors 2023, 23, 9017. [Google Scholar] [CrossRef] [Scilit]
- Shang, M.; Yu, F. Research on Microscopic 3D Measurement System Based on Focus Variation. Laser Optoelectron. Prog. 2021, 58, 1600002. [Google Scholar]
- Wang, X.; Sun, X.; Wang, J.; Gao, X.; Yang, H. Focus Measure Operator Combining Cosine Transform and Laplacian Operator. Laser Optoelectron. Prog. 2021, 58, 2410005. [Google Scholar]
- Bi, T.; Du, W. Improved Brenner definition evaluation function. Electr. Meas. Technol. 2021, 42, 80–84. [Google Scholar]
- Subbarao, M.; Lu, M.C. Image sensing model and computer simulation for CCD camera systems. Mach. Vis. Apps. 1994, 7, 277–289. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.








