I'm using the matchFeatures function to match two sets of SURF features. Running with the default arguments, I know that sum-of-squares distances (SSD) are computed and both a threshold test and ratio test are used. I'm a little curious at how the threshold test works. Ratio tests and nearest neighbor matching are well documented.
From generating C code output, I know with the default threshold parameter of 1%, match metrics greater than 0.4 are rejected. This is because (per the documentation) ideal matches have a metric of 0 and the worst matches have a metric of 4. Everything else is buried in library code.
If I were trying to replicate this threshold test in Python (or even C++ without Coder) and OpenCV, what kind of math would I be doing to compute the metrics? Why is the max distance 4? Is there some sort of normalization or statistical technique being used?