moving head track a danser

Hi beautiful Of people,
i want track a danser with a moving head light
i got a mathemamtique trouble,
i know the x,Y position of the danser thanks to opencv and Ir cam tracking,
and i have to convert this position to a polar coordinate to control the moving head.
do you have any idea ??

Here a draft to explain my trouble>>>

Hi tarrabass,

Assuming your camera is above the stage, and your moving head light is at the same position (not sure about that), you can try something like that :

  
ofVec2f D = getDancerPosition();  // Dancer position, relative to camera image  
ofVec2f C(camera.width / 2.0f, camera.height / 2.0f);  // Center  
ofVec2f CD = D - C;  // green vector (see picture)  
float A1 = CD.angleRad();  // angle A1 (radians)  
  
float stageWidht = 12.0f;  // physical stage width, in meters  
float ratio = camera.width / stageWidth;  // conversion from meters to pixels  
float physicalH = 6.0f;  // moving head light altitude, above the dancer head, in meters  
float H = physicalH * ratio;  // moving head light altitude, in pixels  
float A2 = atan( CD.length() / H );  // angle A2 (radians)  

Look at the pictures to understand what I mean.
The tangent is the link between A2, H, and the distance between the dancer and the center of the stage :
tangent(A2) = CD.length / H
I use the tangent inverse function (atan) to compute A2 (http://en.wikipedia.org/wiki/Trigonometric-functions#Sine.2C-cosine-and-tangent).

I hope this is right, but it’s theorical. You probably need to do some calibration to find the correct H value.

2 Likes

thanks you very much,
that works really well !!!
i just have to adjust the H.
i still have a little trouble when moving head pan is around 0 or 360 degre.
i will send you movie of the result.
thanks again
francois

I’m glad to hear that.
And you reply really fast. Impressive :slight_smile:
I will appreciate to see the result, of course.