Poor Z-Estimate during partial oclusion and controller tilt #21
Description
I've noticed that the Z-estimate from either the circle or ellipse fit becomes very unstable when only part of the 'bulb' is visible. This can happen when you tip the controller away from the camera by as little as 30 degrees.
I tested out using cvMinEnclosingCircle to fit the circle and this works much much better. It yields a more accurate and stable solution than the current methods for even more extreme sight lines than was previously possible. This method also seems to be faster.
I added the following to "psmove_tracker_update_controller_position_from_contour" where it would usually estimate a circle from the contour:
CvPoint2D32f Center;
CvPoint Center2;
float Radii = 0;
cvMinEnclosingCircle(contourBest, &Center, &Radii);
tc->x = Center.x;
tc->y = Center.y;
tc->r = Radii;
And then I ignore the contour quality check in "psmove_tracker_update_controller" where it looks at the aspect ratio of a bounding box. This may not be the 'correct' thing to do, but it let me check functionality.
Try it out and see what you think. This may be worth incorporating unless you've already found some other reason to kill this.