|
- dev_update_off ()
- dev_close_window ()
- dev_open_window (0, 0, 652, 494, 'white', WindowHandle)
- dev_set_draw ('margin')
- dev_set_line_width (3)
- dev_get_preferences ('suppress_handled_exceptions_dlg', SuppressExceptionSetting)
- dev_set_preferences ('suppress_handled_exceptions_dlg', 'true')
- set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
- * Perform the standard camera calibration using the calibration plate.
- create_calib_data ('calibration_object', 1, 1, CalibDataID)
- set_calib_data_cam_param (CalibDataID, 0, 'area_scan_division', [0.0125,0,0.0000075,0.0000075,325.5,246.5,652,494])
- set_calib_data_calib_object (CalibDataID, 0, 'caltab_800mm.descr')
- for I := 1 to 10 by 1
- read_image (Image, 'self_calib/calib_' + I $ '02d')
- dev_display (Image)
- Message := 'Find calibration plate in all calibration images (' + I + '/10)'
- disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')
- * Find the calibration table
- find_calib_object (Image, CalibDataID, 0, 0, I, [], [])
- get_calib_data_observ_contours (Caltab, CalibDataID, 'caltab', 0, 0, I)
- get_calib_data_observ_points (CalibDataID, 0, 0, I, Row, Column, Index, Pose)
- gen_circle (Circles, Row, Column, gen_tuple_const(|Row|,2.0))
- dev_set_color ('green')
- dev_display (Caltab)
- dev_set_color ('red')
- dev_display (Circles)
- endfor
- disp_continue_message (WindowHandle, 'black', 'true')
- stop ()
- calibrate_cameras (CalibDataID, Errors)
- get_calib_data (CalibDataID, 'camera', 0, 'params', CamParam)
- clear_calib_data (CalibDataID)
复制代码- S := CamParam[3]
- dev_open_window (0, 0, 652, 494, 'white', WindowHandle)
- Message[1] := 'From calibration:\n '
- Message[2] := 'Focal length: ' + (CamParam[0] * 1000) $ '5.2f' + ' mm'
- Message[3] := 'Kappa: ' + CamParam[1] $ '12.2f'
- Message[4] := 'Cx: ' + CamParam[4] $ '15.2f'
- Message[5] := 'Cy: ' + CamParam[5] $ '15.2f'
- Message[6] := 'Sx: ' + (CamParam[2] * 1e6) $ '15.2f' + ' μm'
- Message[7] := 'Sy: ' + (CamParam[3] * 1e6) $ '15.2f' + ' μm'
- disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'false')
复制代码
输出结果解释如下:- 标定时个参数值的确定技巧
- Focus f:镜头的标称焦距, e.g., 0.016 m.; 对于远心镜头为0.
- κ: 一般去0.0
- Or:
- K1, K2, K3,P1, P2:可全部初始化为0
- Sx: 由CCD\CMOS确定建议取值如下:
- Full image (640*480) Subsampling (320*240)
- 1/3"-Chip 0.0000055 m 0.0000110 m
- 1/2"-Chip 0.0000086 m 0.0000172 m
- 2/3"-Chip 0.0000110 m 0.0000220 m
- Sy: 由CCD\CMOS确定建议取值如下:
- for example:
- Full image (640*480) Subsampling (320*240)
- 1/3"-Chip 0.0000055 m 0.0000110 m
- 1/2"-Chip 0.0000086 m 0.0000172 m
- 2/3"-Chip 0.0000110 m 0.0000220 m
- Cx and Cy: 光心坐标初始值,建议取值如下:
- for example:
- Full image (640*480) Subsampling (320*240)
- Cx 320.0 160.0
- Cy 240.0 120.0
- ImageWidth,ImageHeight:有实际图片大小来初始化该值
复制代码 参考链接:
http://www.360doc.com/content/14/0221/16/10724725_354517498.shtml
http://blog.sina.com.cn/s/blog_662c785901018cax.html
https://wenku.baidu.com/view/e47 ... 0bf78a64293a57.html
http://blog.sina.com.cn/s/blog_61cc743001017sz0.html
https://wenku.baidu.com/view/9b0 ... 43.html?from=search
https://wenku.baidu.com/view/e47 ... 57.html?from=search
|
|