duanzhiihao / CEPDOF_tools

Visualization and evaluation code for the CEPDOF dataset.
http://vip.bu.edu/cepdof/
22 stars 5 forks source link

question about rotation matrix #3

Closed yzz-cver closed 2 years ago

yzz-cver commented 2 years ago

Hello, according to the definition of the angle of the dataset, why is the rotation matrix in the following representation. image image Why not this representation?R = np.asarray([[c, -s], [s, c]]),thank you!

duanzhiihao commented 2 years ago

Hi, thank you for your interest.

If I understand your question correctly, you are referring to this line in the code: https://github.com/duanzhiihao/CEPDOF_tools/blob/20f3babe275b0ca10ebff25a0f62be8d521795c9/cepdof_api.py#L225

You said:

Why not this representation?R = np.asarray([[c, -s], [s, c]]),thank you!

Your version corresponds to a counterclockwise rotation matrix. See for example Wikipedia: image

However, in our case, the degree is clockwise, as you highlighted in your screenshot. So we should replace theta with -theta in the matrix, which will result in our version as in our code.

yzz-cver commented 2 years ago

The figure below is the calculated rotation matrix. I don't know which step is wrong. Please help me to take a look. Thank you. b5fffc0b28cc10d665ee523f5c6b7a3

duanzhiihao commented 2 years ago

Your definition of alpha is different than in our case. In our case, alpha should be the clock-wise rotation angle from the vertical axis pointing up. See the image below. image

With the above definition, your calculation would be correct.

Please let me know if this helps or not.

yzz-cver commented 2 years ago

Thank you for your patience to explain, it helped me a lot!

duanzhiihao commented 2 years ago

No problem :) I'm happy that you figured it out!

yzz-cver commented 2 years ago

Sorry, there is one place that I still don't fully understand. The solution of the rotation matrix is shown in the figure, and the obtained matrix is still incorrect. 0677122b5c663f8e918b924939de2a1

duanzhiihao commented 2 years ago

Your calculation in your setting is indeed correct. But I just recall that we need to reverse the y axis (should be pointing down), since in the image coordinate, the top-left corner is the origin (0,0). I also did it wrong in my previous reply. See below for the correct version.

image

yzz-cver commented 2 years ago

I understand, thank you very much!