0
votes

I am using camera to trace one black marker on blue ball as shown in image below.

Blue ball with black marker

I can detect marker position on top of ball image reliably but would need to know how to calculate ball rotation angles based on marker location.

When marker is in the middle as shown both angles should be 0 degrees. When marker is only half visible at left edge as shown horizontal angle should be -90 degrees. I understand calculating angles from 2D-image is non-linear, near the edge similar movement in pixels means bigger change in rotation than in the middle but I just can't come up with the formula.

1

1 Answers

0
votes

Rotation about vertical axis:

Phi  = ArcSin((Marker.X - Center.X) / Radius)

In general, if you grab initial point with 2D coordinates (x0, y0) at the front surface of ball manipulator with radius 1 and drag it ti end point (x1,y1), then you rotate direction vector

d0 = (x0, y0, Sqrt(1 - x0^2 - y0^2))
to
d1 = (x1, y1, Sqrt(1 - x1^2 - y1^2))

What to do with these vectors? I depends on what approach are you going to use for rotation