I want to use the opencv function cv::cornerSubPix()
for that I need another one, the cv::TermCriteria
my question is about the last parameter of this function :
cv::TermCriteria(cv::TermCriteria::MAX_ITER +
cv::TermCriteria::EPS,
50, // max number of iterations
0.0001)); // min accuracy
what does the min accuracy here mean?
The structure of TermCriteria is
TermCriteria(
int type, // CV_TERMCRIT_ITER, CV_TERMCRIT_EPS, or both
int maxCount,
double epsilon
);
Typically we use the TermCriteria() function to generate the structure we need. The first argument of this function is either CV_TERMCRIT_ITER or CV_TERMCRIT_EPS, which tells the algorithm that we want to terminate either after some number of iterations or when the convergence metric reaches some small value (respectively). The next two arguments set the values at which one, the other, or both of these criteria should terminate the algorithm.
The reason we have both options is so we can set the type to CV_TERMCRIT_ITER | CV_TERMCRIT_EPS and thus stop when either limit is reached.
The exact meaning of the epsilon term depends on the algorithm for which the termination criteria is intended. (See pp 299-300 of the Learning OpenCV book for some more details on cvTermCriteria
)
Here, specifically, from the documentation:
... the process of corner position refinement stops either after
criteria.maxCount
iterations or when the corner position moves by less thancriteria.epsilon
on some iteration.
So the epsilon term specifies the accuracy you require in your subpixel values, for example a value of 0.0001
means you are asking for subpixel values down to an accuracy of 1/10000th of a pixel. (See p 321 of the Learning OpenCV book)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With