티스토리 뷰
그냥 Open3D rendering이 다 OpenGL convention쓰는거같은데 저 이슈의 답변은 뭘까...
look_at 함수 참조는 이게 훌륭하다. http://learnwebgl.brown37.net/07_cameras/camera_introduction.html
________________________________________________________
Open3D. Camera coordinate은 convention을 따른다고 하는데 (https://github.com/isl-org/Open3D/issues/1347), 이미지렌더링은 OpenGL을 쓰기 때문에 Y,Z가 flip되어있음. 그래서 y,z 부호바꿔줘야함. 정확히 말하면, 나는 현재 Open3D로 geometry 그리고 poll_events()로 screen에 렌더링하고 그걸 capture_screen_float_buffer(False)로 capture하고 있는데, 그러다보니 우분투렌더링은 OpenGL을 써서 camera coordinate이 다름. 스크린렌더링안하고 버퍼에서 바로 캡쳐하면 문제없을듯.
if __name__ == "__main__":
sample_data = o3d.data.DemoCustomVisualization()
pcd_flipped = o3d.io.read_point_cloud(sample_data.point_cloud_path)
# Flip it, otherwise the pointcloud will be upside down
pcd_flipped.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0],
[0, 0, 0, 1]])
print("1. Customized visualization to mimic DrawGeometry")
custom_draw_geometry(pcd_flipped)
print("2. Changing field of view")
custom_draw_geometry_with_custom_fov(pcd_flipped, 90.0)
custom_draw_geometry_with_custom_fov(pcd_flipped, -90.0)
print("3. Customized visualization with a rotating view")
custom_draw_geometry_with_rotation(pcd_flipped)
print("4. Customized visualization showing normal rendering")
custom_draw_geometry_load_option(pcd_flipped,
Solutions
To get the correct camera coordinates of objects and to project objects to the image plane correctly, one should invert the y and z values of objects' coordinates in the OpenGL camera coordinate system. Physically, this means rotating the objects 180 degrees around the x-axis.
Alternatively, as Shubham suggested, one can do below
To get the correct camera coordinates of objects and to project objects to the image plane correctly, one should invert the y and z values of objects' coordinates in the OpenGL camera coordinate system. Physically, this means rotating the objects 180 degrees around the x-axis.
Alternatively, as Shubham suggested, one can do below
# world_T_cam: 4x4 transformation matrix that defines a camera pose in the world coordinate system
# In other words, the inverse of `world_T_cam` transforms a 3D point in the world coordinate system to the camera coordinate system
world_T_cam[:, 1:3] = -world_T_cam[:, 1:3]
Or
world_T_cam[:3, :3] = world_T_cam[:3, :3] @ np.diag([1., -1., -1.]) # np.diag([1.,-1.,-1.]) is a 3D rotation matrix that defines 180 degree rotation around the x-axis; this should be multiplied on the right side of world_T_cam
'Research (연구 관련)' 카테고리의 다른 글
Python multiprocessing (0) | 2023.06.21 |
---|---|
Mask, Polygon, Simplify (0) | 2023.06.16 |
Quantization error (0) | 2023.04.07 |
Resolving sparse conv tensor's randomness (0) | 2023.03.04 |
(mano, smpl) root-joint angle rotation (0) | 2023.03.04 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 비전
- world coordinate
- Virtual Camera
- 에디톨로지
- focal length
- pytorch
- Machine Learning
- VAE
- 인터뷰
- 피트니스
- pyrender
- Generative model
- Interview
- demo
- 컴퓨터비젼
- densepose
- camera coordinate
- Pose2Mesh
- deep learning
- nerf
- nohup
- Transformation
- spin
- 헬스
- 머신러닝
- part segmentation
- 컴퓨터비전
- 2d pose
- Docker
- 문경식
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함