Finding the best focused position is the key to shape from focus (SFF). Focus measure (FM) operators, sampling step, especially various noises usually cause unstable focused position searching and reduce the accuracy of SFF. Traditional methods usually use specific functions like Gaussian function and polynomial function to fit the focus measure curve and take the position of the peak of the fitting curve as the best focused position. However, due to the complexity of the imaging process and the noise, a fixed function is difficult to describe the focus measure curve. In this paper, a robust SFF method is proposed. In the process of finding the best focused position, the signal-to-noise ratio (SNR) of the values near the peak of the focus measure curve is relatively low, which usually leads to incorrect result. However, the rising and falling parts of the focus measure curve are more robust than the low SNR region, so we calculate the gradient of the focus measure curve with an adaptive derivative step. With the derivative step, we can reduce the influence of the SNR region. Then the zero point of the gradient curve and the derivative step are used to find the best focused position. Without any additional pre-work or constraints, our method can achieve high accuracy and strong robustness simultaneously. The effectiveness of the proposed method is evaluated by the simulated objects and real objects with different shapes. The 3D shape recovery results show that the proposed method is a superior alternative to enhance the focus volume in SFF. The RMSE of simulated objects is reduced by more than 25% when the proposed method is applied. For real objects, the RMSE of our method is 36%, 53% lower, compared with the Gaussian interpolation method and the polynomial fitting method, respectively.
Read full abstract