- Reference : https://github.com/mint-lab/3dv_tutorial/tree/master 글을 기반으로 공부한 내용입니다! 문제가 있으면 삭제하겠습니다.
- 위 코드와 slides의 part 2는 아래와 같은 순서로 코드가 구성되어 있습니다 :)
- Section 2. Single-view Geometry [slides]
- Getting Started with 2D
- 3D rotation conversion [python]
- Pinhole Camera Model
- Geometric Distortion Models
- Geometric distortion visualization [python]
- Geometric distortion correction [python] [cpp] [result video]
- Camera Calibration
- Absolute Camera Pose Estimation (a.k.a. perspective-n-point; PnP)
- Pose estimation (chessboard) [python] [cpp] [result video]
- Pose estimation (book) [python] [cpp]
- Pose estimation (book) with camera calibration [python] [cpp]
- Pose estimation (book) with camera calibration without initial � [python] [cpp] [result video]
- Getting Started with 2D
Representation of the Rotation in 3D
3차원 공간상에서 회전의 표현방법
• 회전행렬 (Rotation matrix 3*3) : 좌표계 간의 회전 변환 관계를 나타내는 행렬로 3Dof 표현을 위해 9개의 값을 이용함, 행
렬식이 1인 직교 행렬이라는 제약조건에 따라 최적화 문제에서의 복잡도 증가
• Euler angle (3*1) : 3축(x,y,z)축을 순차적으로 회전시키는 직관적인 표현법이지만, 특정상황에서 1dof 의
손실이 발생하는 (gimbal rock) 문제 발생, 보간과 반복에 적합하지 않아서 결과의 신속한 가시화를 위해서 사용
• Quaternion (4*1) : 4개의 값으로 이루어진 확장된 복소수 체계를 이용한 3차원 회전을 표현한 것 연산 속도가 행렬 연산에 비해 빠르고, 최단호 보간으로 오류 발생률이 적다는 장점을 가짐
🐱 3D Rotation
- 회전축을 돌릴 때의 기준에 따라서 방식이 달라짐
- post-multiplication : 그 직전의 회전축을 기준으로 회전하는 경우 ( 행렬을 뒤에다가 곱함 ) => Euler Angle 회전한 축을 기준으로 축을 회전하기 때문에 해당 규칙 적용
- pre-multiplication : 고정된 회전 축을 기준으로 회전하는 경우 ( 행렬을 앞에다가 곱함 )
import numpy as np
from scipy.spatial.transform import Rotation
# The given 3D rotation
euler = (45, 30, 60) # Unit: [deg] in the XYZ-order
# Generate 3D rotation object
robj = Rotation.from_euler('zyx', euler[::-1], degrees=True)
# Print other representations
print('\n## Euler Angle (ZYX)')
print(np.rad2deg(robj.as_euler('zyx'))) # [60, 30, 45] [deg] in the ZYX-order
print('\n## Rotation Matrix')
print(robj.as_matrix())
print('\n## Rotation Vector')
print(robj.as_rotvec()) # [0.97, 0.05, 1.17]
print('\n## Quaternion (XYZW)')
print(robj.as_quat()) # [0.44, 0.02, 0.53, 0.72]
'''
## Euler Angle (ZYX)
[60. 30. 45.]
## Rotation Matrix
[[ 0.4330127 -0.75 0.5 ]
[ 0.78914913 0.04736717 -0.61237244]
[ 0.43559574 0.65973961 0.61237244]]
## Rotation Vector
[0.97065042 0.04914191 1.17440579]
## Quaternion (XYZW)
[0.43967974 0.02226003 0.5319757 0.72331741]
'''
🐱 회전변환들..
- Similarity , Point transformation, Coordinate transformation 등 좌표계에서의 다양한 이동과 변환을 설명!
🐱 Pinhole Camera model
- 목차에서 볼 수 있었던 것처럼 Object localization과 Image formation을 진행할 수 있는 코드를 제공합니다.
0. Pinhole camera model
${K = \begin{bmatrix} f & 0 & cx \\ 0 & f & cy \\ 0 & 0 & 1 \end{bmatrix}}$
2022.02.24 - [Done/With Sensor, Board] - Camera calibration
1. Object Localization
"사람"의 키를 측정할 수 있도록 되어있는데요
이것이 어떻게 가능한가?를 생각해 보면 단안 카메라가 어떻게 세상을 2D image로 표현하는지를 고민해 보면 쉽게 알 수 있습니다.
Reference
[1] Euler Angle https://alida.tistory.com/8 , https://taeyoung96.github.io/mathematics/Euler/ , https://darkpgmr.tistory.com/81?category=460965, http://scipp.ucsc.edu/~haber/ph216/rotation_12.pdf
[2] Pinhole camera model https://darkpgmr.tistory.com/32
'Done > PointCloud&3DVision' 카테고리의 다른 글
[PointCloud] Point cloud 란 ? & 전처리 방법 (0) | 2024.04.07 |
---|