Ask Your Question
0

How to determine when CamShift failed?

asked 2015-06-08 03:07:10 -0600

hoju gravatar image

updated 2015-06-08 03:07:38 -0600

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?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-11-12 16:17:18 -0600

ocvx gravatar image

From the source code it seems that on failure it returns the default RoteatedRect:

if( fabs(m00) < DBL_EPSILON )
    return RotatedRect();
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-06-08 03:07:10 -0600

Seen: 275 times

Last updated: Jun 08 '15