赞
踩
1.相机设置
相机设置自动曝光,bayerRG8, 触发模式关闭,触发源=软触发
2.异步采集 设置及程序
采集助手设置 colortype=default bit=8
相机分辨率3072x2048,下采样2=1536x1024,否则无法采集
- * Example for grabbing images from two GigEVision cameras.
- *
- * For this example we assume that both cameras are connected
- * to the PC directly. If the cameras are connected to the PC
- * via a switch please refer to the example
- * gigevision2_interpacket_delay.hdev.
- *
- *
- dev_close_window ()
- dev_close_window ()
- info_framegrabber ('GigEVision2', 'device', Information, Devices)
- while (|Devices| < 2)
- * This example requires two GigEVision cameras.
- endwhile
- scale:=5
- open_framegrabber ('GigEVision2', 0, 0, 0, 0, 0, 0, 'progressive', 8, 'default', -1, 'false', 'default', 'LL', 0, -1, AcqHandle1)
-
- get_framegrabber_param (AcqHandle1, ['image_width','image_height'], ImageSize1)
- dev_open_window (0, 0, ImageSize1[0] / scale, ImageSize1[1] / scale, 'black', WindowHandle1)
- open_framegrabber ('GigEVision2', 0, 0, 0, 0, 0, 0, 'progressive', 8, 'default', -1, 'false', 'default', 'RR', 0, -1, AcqHandle2)
-
- get_framegrabber_param (AcqHandle2, ['image_width','image_height'], ImageSize2)
- dev_open_window ((ImageSize1[0] / scale) + 10, 0, ImageSize2[0] / scale, ImageSize2[1]/ scale , 'black', WindowHandle2)
-
- * Deactivate HDevelop update for better performance.
- dev_update_off ()
- grab_image_start (AcqHandle1, -1)
- grab_image_start (AcqHandle2, -1)
- while (true)
- dev_set_window (WindowHandle1)
- *grab_image (Image1, AcqHandle1)
- grab_image_async (Image1, AcqHandle1, -1)
- dev_display (Image1)
- *
- dev_set_window (WindowHandle2)
- *grab_image(Image2, AcqHandle2)
- grab_image_async (Image2, AcqHandle2, -1)
-
- dev_display (Image2)
- endwhile
- dev_close_window ()
- dev_close_window ()
- close_framegrabber (AcqHandle1)
- close_framegrabber (AcqHandle2)
3.新建程序,创建标定板文件
我的标定板尺寸:外形70x70,图案56x56,直径3.5,圆心距7,阵列7x7
gen_caltab (7, 7, 0.07, 0.5, 'caltab_hc070x_56x_7_35.descr', 'caltabcaltab_hc070x_56x_7_35.ps')
执行后当前目录产生对应2个文件 ,只用描述文件。ps是photoshop文件
4.打开标定助手
引入上面描述文件
线扫描多相式,单个像素宽2.4um,焦距3.37mm,其他默认
我的海康相机cb060:
传感器类型 | CMOS,卷帘快门 |
传感器型号 | IMX178 |
像元尺寸 | 2.4 µm × 2.4 µm |
靶面尺寸 | 1/1.8” |
分辨率 | 3072 × 2048 |
生成标定函数
- * Calibration 03: Code generated by Calibration 03
- ImageFiles := []
- TmpCtrl_ReferenceIndex := -1
- TmpCtrl_PlateDescription := '/opt/halcon/calib/calplate_80mm.cpd'
- StartParameters := ['line_scan_polynomial',0.00337,0,0,0,0,0,2.4e-06,2.4e-06,320,0,640,480,0,0.0005,0]
- TmpCtrl_FindCalObjParNames := 'sigma'
- TmpCtrl_FindCalObjParValues := 1
- * Calibration 03: Create calibration model for managing calibration data
- create_calib_data ('calibration_object', 1, 1, CalibHandle)
- set_calib_data_cam_param (CalibHandle, 0, [], StartParameters)
- set_calib_data_calib_object (CalibHandle, 0, TmpCtrl_PlateDescription)
- * Calibration 03: Collect mark positions and estimated poses for all plates
- for Index := 0 to |ImageFiles|-1 by 1
- read_image (Image, ImageFiles[Index])
- * Calibration 03: No image files. Please load images first!
- endfor
- * Calibration 03: Perform the actual calibration
- calibrate_cameras (CalibHandle, TmpCtrl_Errors)
- get_calib_data (CalibHandle, 'camera', 0, 'params', CameraParameters)
- get_calib_data (CalibHandle, 'calib_obj_pose', [0, TmpCtrl_ReferenceIndex], 'pose', CameraPose)
- * Calibration 03: Adjust origin for plate thickness
- set_origin_pose (CameraPose, 0.0, 0.0, 0.001, CameraPose)
- stop ()
5.标定
线阵相机矫正所需参数共17个
11个参数为内参CamParam:= [Focus, Kappa, Sx, Sy, Cx, Cy, ImageWidth, ImageHeight, Vx, Vy, Vz]
6个参数分别为x,y,z三个轴的旋转角度和x,y,z三个轴的平移量
4. ------------------------
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。