halcon直线标定板对相机标定的效果评估(对比矫正前后、对比标定板矫正效果)

原图

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

程序源码

* gen_caltab (7, 7, 0.0025, 1/2.5, 'GB025标定板.descr', 'GB025标定板.ps')
* Calibration 01: Code generated by Calibration 01
* CameraParameters := [0.048105,-44.0585,8.31518e-006,8.3e-006,641.37,588.269,1280,1024]
* CameraPose := [-0.000849522,-0.00119001,0.155349,357.367,2.64825,174.694,0]
* stop ()
* Calibration 01: Code generated by Calibration 01
CameraParameters := [0.0481151,56.7536,-739213,1.05534e+010,0.00643696,0.00896216,8.31503e-006,8.3e-006,636.538,582.388,1280,1024]
CameraPose := [-0.000719502,-0.00103218,0.155376,357.307,2.70546,174.696,0]
stop ()



read_image (Image, '直线标定板图片/Left201113141949916.bmp')
get_image_size (Image, Width, Height)
dev_close_window ()
dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)
dev_display (Image)
* Image Acquisition 01: Code generated by Image Acquisition 01
list_files ('直线标定板图片', ['files','follow_links'], ImageFiles)
tuple_regexp_select (ImageFiles, ['\\.(tif|tiff|gif|bmp|jpg|jpeg|jp2|png|pcx|pgm|ppm|pbm|xwd|ima|hobj)$','ignore_case'], ImageFiles)
gen_empty_obj (Edges)
for Index := 0 to 20 - 1 by 1
    read_image (Image, ImageFiles[Index])
    
    edges_sub_pix (Image, ImageEdges, 'canny', 1, 10, 40)
    segment_contours_xld (ImageEdges, SplitEdges, 'lines_circles', 5, 4, 2)
    select_shape_xld (SplitEdges, SelectedEdges, 'contlength', 'and', 30, 100000)
    concat_obj (Edges, SelectedEdges, Edges)
    dev_display (Image)
    dev_set_colored (12)
    dev_display (SelectedEdges)
    wait_seconds (0.1)
*     stop ()
endfor


radial_distortion_self_calibration (Edges, CalibrationEdges, Width, Height, 0.08, 42, 'polynomial', 'variable', 0, CamParMultiImage)
dev_clear_window ()
dev_set_colored (12)
dev_display (CalibrationEdges)


**********对比矫正后的图片与矫正前的图片
change_radial_distortion_cam_par ('fixed', CamParMultiImage, 0, CamParMultiImageRect)
for Index := 0 to |ImageFiles| - 1 by 1
    read_image (Image, ImageFiles[Index])
    get_domain (Image, Domain)
    * Rectify the image, i.e., remove the radial distortions.
    change_radial_distortion_image (Image, Domain, ImageRectified, CamParMultiImage, CamParMultiImageRect)
    * Display the distorted and undistorted image to visualize the
    * differences between the images.
    dev_display (Image)
    
    sub_image (Image, ImageRectified, ImageSub3, 1, 0)
    stop ()
    disp_message (WindowHandle, 'Image with radial distortions', 'window', 0, 0, 'black', 'true')
    wait_seconds (0.5)
    dev_display (ImageRectified)
    disp_message (WindowHandle, 'Image without radial distortions', 'window', 0, 0, 'black', 'true')
    wait_seconds (0.5)
endfor

*标定板畸变矫正准备
change_radial_distortion_cam_par ('fixed', CameraParameters, [0,0,0,0,0], CamParVirtualFixed)
* CamParVirtualFixed:=CameraParameters
gen_radial_distortion_map(MapFixed,CameraParameters,CamParVirtualFixed,'bilinear')
*直线畸变矫正准备
change_radial_distortion_cam_par ('fixed', CamParMultiImage, [0,0,0,0,0], CamParMultiImageRect)
get_domain (Image, Domain)

for Index := 0 to |ImageFiles| - 1 by 1
    read_image (Image, ImageFiles[Index])
    * 直线标定
    change_radial_distortion_image (Image, Domain, ImageRectified, CamParMultiImage, CamParMultiImageRect)
    * 标定板标定
    map_image(Image,MapFixed,ImageRectifiedFixed)
    
    *标定板与直线标定
    sub_image (ImageRectified, ImageRectifiedFixed, ImageSub, 1, 128)
    intensity (Domain, ImageSub, Mean, Deviation)
    
    sub_image (Image, ImageRectifiedFixed, ImageSub1, 1, 128)
    intensity (Domain, ImageSub1, Mean1, Deviation1)
    
    sub_image (Image, ImageRectified, ImageSub2, 1, 128)
    intensity (Domain, ImageSub2, Mean2, Deviation2)
    
    dev_display (Image)
    disp_message (WindowHandle, 'Image with radial distortions', 'window', 0, 0, 'black', 'true')
    wait_seconds (0.5)
    dev_display (ImageRectified)
    disp_message (WindowHandle, 'Image without radial distortions', 'window', 0, 0, 'black', 'true')
    wait_seconds (0.5)
endfor

直线标定板标定前后对比:

在这里插入图片描述

直线标定板矫正与标定板差异

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值