# How to choose a suitable threshold value for the Shi-Tomasi corner detection algorithm?

While implementing the Shi-Tomasi corner detection algorithm, I got stuck in deciding a suitable threshold for corner detection.

In the Shi-Tomasi algorithm, all those points that qualify $$\min( \lambda_1, \lambda_2) > \text{threshold}$$ are considered as corner points. (where $$\lambda_1, \lambda_2$$ are eigenvalues).

My question is: what is a suitable criterion to decide that threshold?

• – nbro
Dec 2, 2021 at 8:39

For example, let the criteria for selection, or scoring function, be $$R$$, which in the Shi-Tomasi case is $$R = min(\lambda_1, \lambda_2)$$. We could choose some value $$q \in (0,1)$$, so that the threshold becomes
$$t = q\max_p{R}$$,
where the max $$R$$ is calculated over all points $$p$$, an approach similar to OpenCV Good Features to Track.
You could examine the corners detected and adjust $$q$$ based on how stringently you wanted to select corners. If you don't want to waste the time manually fine-tuning the threshold, you could check out some automated approaches in the literature, such as Automated thresholding for low-complexity corner detection