Halcon之单相机标定
相机的标定就是通过获取相机的内外参数,来纠正畸变和获取物理尺寸
纠正了畸变,测量才会准确(测量项目一般都需要考虑纠正畸变)
标定,实际操作就是根据当前相机对标定板拍出的图片,来摸清相机的品性,然后根据品性来获取纠正的模型参数,即相机的内外参数。
畸变纠正是用不到外参的
外参指的是位姿,在3D测量里面,3维世界离机械手的抓取里面才会用到。
内参指的是:
1.单个像元的高
2.单个像元的宽
3.焦距
4.kappa
5.中心点x的坐标
6.中心点y的坐标
7.图像宽
8.图像高
外参指的是:相机的位姿
即
1.x
2.y
3.z
4.x方向的旋转
5.y方向旋转
6.z方向旋转
畸变纠正,其实是一种插值算法
流程
1.标定获取内参
2.通过函数和内参获取无畸变的内参
3.通过无畸变的内参和内参,获取映射map
4.通过map,将有畸变的图像转为无畸变的内参
gen_caltab (7, 7, 0.0125, 0.5, 'caltab.descr', 'caltab.ps')
Parameters:
XNum (input_control) integer → (integer)
Number of marks in x direction.
Default value: 7
Suggested values: 5, 7, 9
Recommended increment: 1
Restriction: XNum > 1
YNum (input_control) integer → (integer)
Number of marks in y direction.
Default value: 7
Suggested values: 5, 7, 9
Recommended increment: 1
Restriction: YNum > 1
MarkDist (input_control) real → (real)
Distance of the marks in meters.
Default value: 0.0125
Suggested values: 0.1, 0.0125, 0.00375, 0.00125
Restriction: 0.0 < MarkDist
DiameterRatio (input_control) real → (real)
Ratio of the mark diameter to the mark distance.
Default value: 0.5
Suggested values: 0.5, 0.55, 0.6, 0.65
Restriction: 0.0 < DiameterRatio < 1.0
CalPlateDescr (input_control) filename.write → (string)
File name of the calibration plate description.
Default value: 'caltab.descr'
List of values: 'caltab.descr', 'caltab_100mm.descr', 'caltab_10mm.descr', 'caltab_200mm.descr', 'caltab_30mm.descr'
File extension: .descr
CalPlatePSFile (input_control) filename.write → (string)
File name of the PostScript file.
Default value: 'caltab.ps'
File extension: .ps
使用标定助手
相机内参
1.单个像元的高
2.单个像元的宽
3.焦距
4.kappa
5.中心点x的坐标
6.中心点y的坐标
7.图像宽
8.图像高
CameraParameters := []
相机外参
相机的位姿
即
1.x
2.y
3.z
4.x方向的旋转
5.y方向旋转
6.z方向旋转
CameraPose := []
示例
畸变纠正是用不到外参的
CameraParameters := []
CameraPose := []
change_radial_distortion_cam_par ('adaptive', CameraParameters, 0, CamParamChange)
gen_radial_distortion_map (Map, CameraParameters, CamParamChange, 'bilinear')
read_image (Image, 'printer_chip/printer_chip_01')
map_image (Image, Image, ImageMapped)