Open EgalYue opened 6 years ago
I think the look at method assumes that the camera is placed above the points. For example, in my case, the 4 points were on the X-Y plane. Try to move now your camera above the points and see if it still works.
I ported that code from this one: https://www.3dgep.com/understanding-the-view-matrix/
ok, i will try it again
I know what is wrong there, we have to adapt it. They use the Y up convention and we are using the Z up convention. The whole method has to be rewritten to follow our convention and then it should be consistent independently if the camera is above or below the points.
If you want to be sure about the transformations take a look to the ROS tf python package. I think now that I get how everything works I will switch my code to use the basics from that package
This is another one that I will integrate later, is a good camera model in python: https://github.com/ros-perception/vision_opencv/blob/kinetic/image_geometry/src/image_geometry/cameramodels.py
ok, I will check look at method again, the problem is: R = [e1,e2,e3], e1 e2 e3 should be Column vector not Row vector.
I tested cam at [1,1,1]
This is the Wrong R: https://github.com/EgalYue/Mobile_Marker_Based_Navigation/blob/86818dfef778dcb3d1d927b5420c592088086ace/python/vision/camera.py#L268
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This is the Right R: https://github.com/EgalYue/Mobile_Marker_Based_Navigation/blob/86818dfef778dcb3d1d927b5420c592088086ace/python/vision/camera.py#L262
============================================================
R = [xaxis, yaxis, zaxis]. xaxis, yaxis, zaxis should be Column vector not Row vector. And i will read the link, which you gived me.
This R is the wrong one! https://github.com/EgalYue/Mobile_Marker_Based_Navigation/blob/6ffd21f7e1b3d67433a21e11998cc9fe925947c8/python/vision/camera.py#L268
Before that we get the right cam distribution because of following code: we got the right axis direction (because of R.T, but it should be R not R.T), but the cam.R is not the right one!!! https://github.com/EgalYue/Mobile_Marker_Based_Navigation/blob/6ffd21f7e1b3d67433a21e11998cc9fe925947c8/python/vision/camera_distribution.py#L53
For example: We set camera at [1,0,0] and using look at method, but if we using the old look at method we got R = [[ 0. 0. 1. 0.] [ 0. 1. 0. 0.] [-1. 0. 0. 0.] [ 0. 0. 0. 1.]]
This R is wrong!!!
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ we should use this R https://github.com/EgalYue/Mobile_Marker_Based_Navigation/blob/6ffd21f7e1b3d67433a21e11998cc9fe925947c8/python/vision/camera.py#L262
And the real R should be R = [[ 0. 0. -1. 0.] [ 0. 1. 0. 0.] [ 1. 0. 0. 0.] [ 0. 0. 0. 1.]]