请选择 进入手机版 | 继续访问电脑版

Hello Mat

 找回密码
 立即注册
查看: 6376|回复: 0

单目相机标定

[复制链接]

1100

主题

1276

帖子

19

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
21555
发表于 2017-3-27 21:26:26 | 显示全部楼层 |阅读模式
  1. dev_update_off ()
  2. dev_close_window ()
  3. dev_open_window (0, 0, 652, 494, 'white', WindowHandle)
  4. dev_set_draw ('margin')
  5. dev_set_line_width (3)
  6. dev_get_preferences ('suppress_handled_exceptions_dlg', SuppressExceptionSetting)
  7. dev_set_preferences ('suppress_handled_exceptions_dlg', 'true')
  8. set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
  9. * Perform the standard camera calibration using the calibration plate.
  10. create_calib_data ('calibration_object', 1, 1, CalibDataID)
  11. set_calib_data_cam_param (CalibDataID, 0, 'area_scan_division', [0.0125,0,0.0000075,0.0000075,325.5,246.5,652,494])
  12. set_calib_data_calib_object (CalibDataID, 0, 'caltab_800mm.descr')
  13. for I := 1 to 10 by 1
  14.     read_image (Image, 'self_calib/calib_' + I $ '02d')
  15.     dev_display (Image)
  16.     Message := 'Find calibration plate in all calibration images (' + I + '/10)'
  17.     disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')
  18.     * Find the calibration table
  19.     find_calib_object (Image, CalibDataID, 0, 0, I, [], [])
  20.     get_calib_data_observ_contours (Caltab, CalibDataID, 'caltab', 0, 0, I)
  21.     get_calib_data_observ_points (CalibDataID, 0, 0, I, Row, Column, Index, Pose)
  22.     gen_circle (Circles, Row, Column, gen_tuple_const(|Row|,2.0))
  23.     dev_set_color ('green')
  24.     dev_display (Caltab)
  25.     dev_set_color ('red')
  26.     dev_display (Circles)
  27. endfor
  28. disp_continue_message (WindowHandle, 'black', 'true')
  29. stop ()
  30. calibrate_cameras (CalibDataID, Errors)
  31. get_calib_data (CalibDataID, 'camera', 0, 'params', CamParam)
  32. clear_calib_data (CalibDataID)
复制代码
  1. S := CamParam[3]
  2. dev_open_window (0, 0, 652, 494, 'white', WindowHandle)
  3. Message[1] := 'From calibration:\n '
  4. Message[2] := 'Focal length: ' + (CamParam[0] * 1000) $ '5.2f' + ' mm'
  5. Message[3] := 'Kappa: ' + CamParam[1] $ '12.2f'
  6. Message[4] := 'Cx: ' + CamParam[4] $ '15.2f'
  7. Message[5] := 'Cy: ' + CamParam[5] $ '15.2f'
  8. Message[6] := 'Sx: ' + (CamParam[2] * 1e6) $ '15.2f' + ' μm'
  9. Message[7] := 'Sy: ' + (CamParam[3] * 1e6) $ '15.2f' + ' μm'
  10. disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'false')
复制代码

输出结果解释如下:
  1. 标定时个参数值的确定技巧
  2.       Focus f:镜头的标称焦距, e.g., 0.016 m.; 对于远心镜头为0.
  3.       κ: 一般去0.0
  4.       Or:
  5.       K1, K2, K3,P1, P2:可全部初始化为0
  6.       Sx: 由CCD\CMOS确定建议取值如下:
  7.            Full image (640*480) Subsampling (320*240)
  8.            1/3"-Chip 0.0000055 m 0.0000110 m
  9.            1/2"-Chip 0.0000086 m 0.0000172 m
  10.            2/3"-Chip 0.0000110 m 0.0000220 m
  11.       Sy: 由CCD\CMOS确定建议取值如下:
  12.           for example:
  13.            Full image (640*480) Subsampling (320*240)
  14.            1/3"-Chip 0.0000055 m 0.0000110 m
  15.            1/2"-Chip 0.0000086 m 0.0000172 m
  16.            2/3"-Chip 0.0000110 m 0.0000220 m
  17.       Cx and Cy: 光心坐标初始值,建议取值如下:
  18.          for example:
  19.           Full image (640*480) Subsampling (320*240)
  20.           Cx 320.0 160.0
  21.           Cy 240.0 120.0
  22.       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





算法QQ  3283892722
群智能算法链接http://halcom.cn/forum.php?mod=forumdisplay&fid=73
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn

GMT+8, 2022-8-16 15:05 , Processed in 0.176056 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表