The doc page of TermCriteria says that the MAX_ITER is the same as COUNT and the type can be one of : COUNT, EPS or COUNT EPS. I am wondering whether there is a difference between COUNT EPS and MAX_ITER EPS. I found that in different places, there are these two different styles. Would that lead to different effects while running?
CodePudding user response:
There is no difference. COUNT and MAX_ITER mean the same. They have the same value, hence are indistinguishable.
Well, their meaning depends on what function takes a TermCriteria tuple/struct/object. Still, same value means the identifiers are interchangeable.
Those named constants live in an enum. The values are chosen to be bits in a bit field. So they're actually flags and should, ordinarily, be combined with | (bitwise OR operator).
The is a funny custom and probably because of the following... if you give two termination criteria, an algorithm terminates if any of them becomes true. So one could say both the one and the other are given... and now people get their brain gyri twisted thinking of "and" and "or". Combining those flags with sidesteps that nicely.
cv.TermCriteria_COUNT == 1
cv.TermCriteria_MAX_ITER == 1
cv.TermCriteria_EPS == 2
so your choices are:
COUNT (means MAX_ITER)
MAX_ITER (means COUNT)
EPS
COUNT EPS
MAX_ITER EPS
Beware that you don't say COUNT MAX_ITER (wrong!) because that is 1 1 = 2 and that is now EPS, which isn't what that expression was supposed to express.
CodePudding user response:
The documentation may not contain all the information, and it is generated from OpenCV public header files (via doxygen and its config file).
Just use an IDE/Editor, browsing the source code, search TermCriteria, and will see MAX_ITER and COUNT enumeration element values. Should be same.
