psmoveservice / psmove-ue4

Plugin for using PSMove as input into Unreal Engine 4. Currently obsolete. Please use PSMoveService.
GNU General Public License v2.0
59 stars 28 forks source link

Poor Z-Estimate during partial oclusion and controller tilt #21

Open Ixstala opened 8 years ago

Ixstala commented 8 years ago

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.

cboulay commented 8 years ago

You're definitely right that the current method is sub-optimal. You're modification seems reasonable.

The the new PSMoveService that we are working on, we are thinking about implementing something like what's described here. My understanding is that it fits a cone to the data points then from the cone parameters it can get the 3D position of the sphere. I don't yet know how he does it, but I haven't begun to try.

Ixstala commented 8 years ago

Wow, that looks pretty stupendous!