Halcon畸变矫正实现

参考视频https://www.bilibili.com/video/av41796442/

可以先使用标定助手获取标定参数

Halcon畸变矫正实现_第1张图片

在标定助手的安装页面,注意标定板的描述文件投影模型参数的设置

在标定页面先选择一幅图设为参考位姿,之后点击标定

标定完之后获得相机内参,图片矫正程序方法

* Calibration 01: Code generated by Calibration 01
CameraParameters := ['area_scan_division',0.0186441,-520.011,8.35005e-006,8.3e-006,246.657,254.674,640,480]
CameraPose := [0.00994196,-0.00291689,0.290462,358.424,32.411,91.0749,0]
stop ()
*获取径向畸变矫正的外参
change_radial_distortion_cam_par ('adaptive', CameraParameters, 0, CamParamOut)

read_image (CalibDistorted03, 'C:/Users/Public/Documents/MVTec/HALCON-13.0/examples/images/scratch/scratch_perspective.png')
*第一种方法使用map_image()进行畸变矫正
gen_radial_distortion_map (Map, CameraParameters, CamParamOut, 'bilinear')
map_image (CalibDistorted03, Map, ImageMapped)
*第二种方法使用change_radial_distortion_image进行径向畸变矫正
change_radial_distortion_image (CalibDistorted03,CalibDistorted03 , ImageRectified, CameraParameters, CamParamOut)

 

此种只进行畸变矫正,并不进行图像的由于高度差造成的3D方向的位姿矫正。若要进行3D方向的矫正可以参考范例

image_to_world_plane.hdev

畸变矫正范例为:

change_radial_distortion_image.hdev

change_radial_distortion_points.hdev

你可能感兴趣的:(Halcon)