xucong-zhang / ETH-XGaze

Official implementation of ETH-XGaze dataset baseline
185 stars 33 forks source link

How to calculate 3d gaze vector by subject*.csv? #6

Open xjcvip007 opened 3 years ago

xjcvip007 commented 3 years ago

hi, one question, in raw/data/annotation_train/subject*.csv, column 3-4, column 5-7 are gaze point and gaze point. How to calculate 3d gaze vector by column 3-4 and column 5-7?

xucong-zhang commented 3 years ago

Hi, I added a code example "normalization_example.py" which does the data normalization frow raw to the normalized data. Basically, you need to get the face centre as the gaze origin, and the gaze 3d location (column 5-7) as the end of gaze direction. You can see the gaze direction definition here.

xjcvip007 commented 3 years ago

Another question, in "demo.py", when I use cam00.JPG as input, the output of head pose rotation is [[-0.56751225] [ 0.12823843] [-0.01663368]], the pitch result may be wrong? Then I plot head pose orientation as blue arrow shown. Is anything wrong in demo.py? results_gaze

xucong-zhang commented 3 years ago

Hi, sorry for the late reply.

The head rotation "hr" is not a pointing vector. It is the rotation vector on roll, yaw and pitch axis.

If you want to show it on the image, you can convert the rotation vector to a rotation matrix with OpenCV (cv2.Rodrigues) and apply this rotation to a vector [0, 0, 1], and then you can draw its projection on the image.