YutaItoh / 3D-Eye-Tracker

MIT License
286 stars 91 forks source link

How to manage camera rotation and position ? #5

Closed de-Grimouard closed 7 years ago

de-Grimouard commented 7 years ago

Hello,

I am trying to use your program on another camera with a different angle and distance. I saw in the code that some values are hard coded, like the focal length . Do you have some parameters to change the camera position and rotation too ?

Regards,

de-Grimouard commented 7 years ago

I found my answer thanks !

YutaItoh commented 7 years ago

Hi @poulet-g , thanks for trying out our code. I put some additional information. The code computes the gaze and eyeball center in the camera coordinate system. The focal distance is used by the 3D model builder to determine the scale of the image space.

Precisely speaking, the current code uses the mean of the fx and fy in the camera intrinsic matrix and the center of the camera's image plane. So it does not consider cases where two axial focal lengths are very different each other or where the camera center is largely shifted from its image center. In such cases, estimate eye pose would be inaccurate.

Hope this information also helps. YI

de-Grimouard commented 7 years ago

Hi @YutaItoh, thanks for your answer.

Yes these informations can help me. Moreover, that's probably a debug case but the informations send in the img at main.cpp:296 and 302 are not shown. maybe you should add a shortcut option to shown it or remove it from the code.

Gabriel

YutaItoh commented 7 years ago

that's probably a debug case but the informations send in the img at main.cpp:296 and 302 are not shown.

Perhaps you mean L297??? https://github.com/YutaItoh/3D-Eye-Tracker/blob/master/main/main.cpp#L297

de-Grimouard commented 7 years ago

Sorry because I added some things in my code that's not the same numbers. I mean 287 and 293.

I think even if the camera is shifted if we know that are the camera position ine the world coordonate center and this rotation, We can maybe apply the conversion from the CCS to the WCS explained in the General theory about eye tracking by guestrin to get to eye posiiton and vector in the world coordonate system.

YutaItoh commented 7 years ago

I mean 287 and 293.

aha, then probably the position of the lines are outside of your camera image? I know the position is so far hardcoded and it's tuned for 640x480 size....

We can maybe apply the conversion from the CCS to the WCS

Please correct me if I'm wrong, but you want to determine the eye position in a world space? If so, as you wrote, I would track the 6DoF pose of the eye camera in a world coordinate system, then the convert the eye position to the WCS.

FYI, in our lab, we attached a retroreflective marker on an eye-camera headset (PupilPro) and track it by the OptiTrack tracking system.

de-Grimouard commented 7 years ago

for the lines it's just that there is no imshow of it. Just by adding cv::imshow(window_names[cam], img); to the code after the other imshow it's working haha.

Yes that's exactly what I want to do. Thanks for your answer.