The topography of surfaces produced by metal additive manufacturing is a challenge for optical measurement systems such as focus variation microscopes. These irregularities can lead to artifacts, such as incorrectly measured protrusions or spikes, hampering reliable topographic characterization. In order to eliminate this problem, we introduce a new algorithm based on dual convolving a vertical Sobel operator with cross sections of an image stack parallel to the scanning direction of the so-called depth scan. This has proven beneficial in order to distinguish the focus region from out-of-focus areas where outliers are frequently detected. This paper introduces a method for deriving self-adaptive thresholds from the convolution result and compares the effects of different operators in creating self-adaptive thresholds. Additionally, a simulation model of focus variation microscopy is introduced to validate both the measuring system and the proposed algorithm, thereby enhancing the overall performance of focus variation microscopy. Finally, comparisons of measurement results on rough metal additive manufacturing workpieces with and without self-adaptive thresholds are discussed to demonstrate the algorithm’s effectiveness.The utilization of self-adaptive thresholds demonstrably reduces the uncertainty range in roughness parameter calculations. For example, in the case of an additive manufactured metal sample due to outlier elimination, the Sz roughness value reduces from 543 µm to 413 µm.