Conversation
|
EDIT: Link was added to the previous comment by workflow 🚀 |
|
We'll need to fix this coordinate convention discrepancy and update the docs too, they currently render weirdly. |
|
@jungerm2 That function does not convert OpenGL coordinates to OpenCV's convention, only to Blender's. I think it is correctly written for that case...? EDIT: Maybe the misconception is that OpenGL and Blender have the same coordinate convention, but they don't. Blender has +Z going upwards but OpenGL has +Y upwards. |
Will look into this. |
|
The documentation you linked to above is for the world coordinate frame, not the camera's local system. In blender, if you change the transforms orientation to be local (there's a dropdown in the header), then select a camera and hit "G" to grab it, then hit say "Z" you'll find that it does line up with the camera's optical axis, and if you the "+1", the camera will back up, confirming that +Z points away from the viewing direction. Same holds for X/Y. Try it. |
|
Does the
The gravity vector would be in the [0, -1, 0] direction in the camera frame per OpenGL convention, but gets mapped to the -Z or [0, 0, -1] direction in the world frame by this matrix. That is consistent with the convention written in the It might be worth renaming this function if it makes its purpose clearer: we really just want the coordinate conventions on both sides of the transform matrix to be the same, that's all. It can be the "World frame" convention (as it currently implements) or OpenGL, either is fine. |
|
Updated the code to fix the doc rendering issue, and the description based on my comment above. Also renamed the function itself. |
|
I suppose I can walk through my train-of-thought when implementing Let's assume the OpenGL convention for coordinate axes (this choice doesn't matter), so we have +Y up and +Z coming out of the image at the origin. The gravity vector in this frame of reference is At any time, I would need to transform this vector to the local frame of reference to simulate an accelerometer measurement in the camera frame. How do I do that? I take the Somewhere we need to explicitly handle this convention difference, so that we do not misinterpret the |
|
Although in the end this is not really a detail the end-user needs to care about; we only use this conversion as an implementation detail in |
|
This branch has been merged into this PR so I'm closing this issue. I've moved |


Add some docs for the different camera conventions.
@shantanu-gupta It seems
tform_camcoord_gl2blis using the wrong coordinates actually, converting to/from opencv/opengl would use this matrixopencv_to_opengl = np.array([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])whereas it seems we've swapped the Y/Z axes which is non-standard. See here too.📚 Documentation preview 📚: https://visionsim--24.org.readthedocs.build/en/24/