intrinsic data
sensing isx031만 적용됩니다.
타 모델은 추후 업데이트 됩니다.
setup
target device 에서 실행하세요.
sudo apt update
sudo apt install -y v4l-utils
git clone https://gitlab.com/telelian-jetpack/util/camera_intrinsic.git
usage
# python3 camera_intrinsic.py [video device] [output folder] [config file]
python3 camera_intrinsic.py /dev/video0 ../output sensing.yaml
성공하면 ../output/camera_info_video0.yaml, ../output/camera_intrinsic_video0.yaml 두 개의 파일이 생성됩니다.
camera_info_video[n].yaml
ros에서 사용하는 camera_info.yaml
image_width: 1920
image_height: 1536
camera_name: video0
camera_matrix:
rows: 3
cols: 3
data: [508.264403709, 0.0, 961.9093835162,
0.0, 508.4781129138, 768.1251286854,
0.0, 0.0, 1.0]
distortion_model: equidistant
distortion_coefficients:
rows: 1
cols: 4
data: [0.1341471966, -0.033778229, -0.0026520847, 0.0012829212]
rectification_matrix:
rows: 3
cols: 3
data: [1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0]
projection_matrix:
rows: 3
cols: 4
data: [508.264403709, 0.0, 961.9093835162, 0.0,
0.0, 508.4781129138, 768.1251286854, 0.0,
0.0, 0.0, 1.0, 0.0]
camera_intrinsic[n].yaml
camera eeprom의 모든 정보를 표시
SN:
serial_number: H190XA-H03110528
camera_info:
embedded_data: ENABLED
fps: 30
height: 1536
image_format: UYVY
isp_id: UNDEFINED
sensor_id: ISX031
trigger_mode: ENABLED
video_device: video0
width: 1920
camera_matrix:
cmei_k1: 0.0
cmei_k2: 0.0
cmei_k3: 0.0
cmei_p1: 0.0
cmei_p2: 0.0
cmei_xi: 0.0
cx: 961.9093835162
cy: 768.1251286854
fisheye_k1: 0.1341471966
fisheye_k2: -0.033778229
fisheye_k3: -0.0026520847
fisheye_k4: 0.0012829212
fx: 508.264403709
fy: 508.4781129138
image_height: 1536
image_width: 1920
model: FISHEYE
pinhole_k1: 0.0
pinhole_k2: 0.0
pinhole_k3: 0.0
pinhole_k4: 0.0
pinhole_k5: 0.0
pinhole_k6: 0.0
pinhole_p1: 0.0
pinhole_p2: 0.0
lens_info:
f_number: 2.0
focal_length: 1.5099999904632568
fov: 190
lens_index: 0
lens_type: 65
manufacturer_id: X
serial_number:
day: 255
month: 255
serial: 4294967295
year: 255
gstreamer dewarper parameter config file
yaml로 추출된 intrinsic 정보를 사용하여 dewarper 파라미터 설정 파일을 생성합니다.
focal_length = (fx + fy) / 2
distortio n= k0; k1; k2; p0; p1
src-x0 = cx
src-y0 = cy
projection-type = 4 (pinhole은 3번, fisheye은 4번을 사용하나 상황에 따라 7, 9번을 사용해야 할 수 있습니다.)
3: Perspective to Perspective: 원근 투영 입력을 다른 원근 투영으로 변환합니다. 일반적인 카메라 영상을 다른 시점이나 화각의 원근 투영으로 변환할 때 사용될 수 있습니다. 이미지 보정 또는 시점 변경에 활용될 수 있습니다.
4: Fisheye to Perspective: 어안 렌즈 입력을 일반적인 원근 투영으로 변환합니다. 어안 렌즈로 촬영된 광각 이미지를 왜곡이 보정된 일반 카메라 영상처럼 보이게 만듭니다. 특정 관심 영역을 잘라내어 원근 뷰로 볼 때 유용합니다.
7: Fisheye to Equirectangular: 어안 렌즈 입력을 직사각형 투영(Equirectangular)으로 변환합니다. 360도 어안 영상을 360도 VR 영상에서 흔히 사용되는 직사각형 형태로 만듭니다. VR 애플리케이션과의 연동에 필요할 수 있습니다.
9: Perspective to Equirectangular: 원근 투영 입력을 직사각형 투영으로 변환합니다. 일반 카메라 여러 대로 촬영한 영상을 합쳐서 360도 직사각형 영상을 만들 때 사용될 수 있습니다.
dewarper_config.txt 파일 예시
[property]
output-width=1920
output-height=1536
num-batch-buffers=1
[surface0]
projection-type=4
width=1920
height=1536
focal-length=508.3712583114
distortion=0.1341471966;-0.033778229;-0.0026520847;0.0012829212;0
src-x0=961.9093835162
src-y0=768.1251286854
nvdewarper 사용 예시
gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 ! \
"video/x-raw(memory:NVMM),format=(string)UYVY,width=(int)1920,height=(int)1536,framerate=(fraction)30/1" ! \
queue ! nvvidconv ! nvdewarper dewarper_config.txt ! nvvidconv ! nv3dsink