# Revision history [back]

### How to determine when CamShift failed?

How to determine when CamShift failed to confidently find the new location?

Previously with meanShift I checked the return value for the number of iterations to converge, and if it reached the maximum set in criteria then I assumed this was not a match:

criteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 1) retval, window = cv2.meanShift(probImage, window, criteria) retval 10

However with CamShift the return value is no longer the number of iterations:

retval, window = cv2.CamShift(probImage, window, criteria) retval ((327.0, 323.0), (205.42239379882812, 253.79466247558594), 19.084074020385742)

The documentation says this method returns:

(in old interfaces) Number of iterations CAMSHIFT took to converge

I am using version 3 so I guess is not the old version. Is there a way in version 3 to find the number of iterations to converge? Or a better way to determine whether camshift failed?

### How to determine when CamShift failed?

How to determine when CamShift failed to confidently find the new location?

Previously with meanShift I checked the return value for the number of iterations to converge, and if it reached the maximum set in criteria then I assumed this was not a match:

>>> criteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 1)
>>> retval, window = cv2.meanShift(probImage, window, criteria)
>>> retval
10 


10 

However with CamShift the return value is no longer the number of iterations:

>>> retval, window = cv2.CamShift(probImage, window, criteria)
>>> retval
((327.0, 323.0), (205.42239379882812, 253.79466247558594), 19.084074020385742) 


19.084074020385742) 

The documentation says this method returns:

(in old interfaces) Number of iterations CAMSHIFT took to converge

I am using version 3 so I guess is not the old version. Is there a way in version 3 to find the number of iterations to converge? Or a better way to determine whether camshift failed?