开启左侧

Halcon标定测量有误差,求原因

[复制链接]
CJ5035 发表于 2018-12-27 16:21:17 | 显示全部楼层 |阅读模式
用100mm标定文件进行标定,标定完成后,实际测量7.1cm,相机测量结果为7.5cm,误差0.4cm,求原因。。。以下为标定步骤,求大神指点

微信截图_20181227161730.png 微信截图_20181227161808.png 微信截图_20181227161821.png 微信截图_20181227161836.png 微信截图_20181227161407.png
标定程序:
  1. * Image Acquisition 01: Code generated by Image Acquisition 01
  2. open_framegrabber ('DirectShow', 1, 1, 0, 0, 0, 0, 'default', 8, 'rgb', -1, 'false', '[1] RGB24 (2048x1536)', '[1]', 0, -1, AcqHandle)
  3. grab_image_start (AcqHandle, -1)
  4. grab_image_async (Image, AcqHandle, -1)

  5. * Calibration 01: Code generated by Calibration 01
  6. read_cam_par ('G:/halcon/halcon例程/标定测量/图片及参数(新)/12-27-02/参数.cal', CameraParameters)
  7. read_pose ('G:/halcon/halcon例程/标定测量/图片及参数(新)/12-27-02/位姿.dat', CameraPose)
  8. stop ()

  9. * Calibration 01: Sample code generated by Calibration 01
  10. * Calibration 01: For demonstration purposes, we use the calibration
  11. * Calibration 01: plate itself as sample object.
  12. * Calibration 01: Therefore, please take another calibration plate image
  13. stop ()
  14. grab_image_async (Image, AcqHandle, -1)
  15. close_framegrabber (AcqHandle)
  16. * Calibration 01: Extract plate data from the image
  17. TmpCtrl_PlateDescription := 'G:/halcon/halcon例程/制作标定板/caltab.descr'
  18. TmpCtrl_FindCalObjParNames := ['gap_tolerance','alpha','skip_find_caltab']
  19. TmpCtrl_FindCalObjParValues := [1,1,'false']
  20. * Calibration 01: Create calibration model for managing calibration data
  21. create_calib_data ('calibration_object', 1, 1, CalibHandle)
  22. set_calib_data_cam_param (CalibHandle, 0, [], CameraParameters)
  23. set_calib_data_calib_object (CalibHandle, 0, TmpCtrl_PlateDescription)
  24. find_calib_object (Image, CalibHandle, 0, 0, 0, TmpCtrl_FindCalObjParNames, TmpCtrl_FindCalObjParValues)
  25. get_calib_data_observ_points (CalibHandle, 0, 0, 0, TmpCtrl_MarkRows, TmpCtrl_MarkColumns, TmpCtrl_Ind, CameraPose)
  26. * Calibration 01: Using the calibration plate as test object, the marks actually
  27. * Calibration 01: lie above the corrected measurement plane. Therefore, we 'uncorrect'
  28. * Calibration 01: the plane of measurement by the plate thickness here.
  29. set_origin_pose (CameraPose, 0.0, 0.0, 0.001, CameraPose)
  30. * Calibration 01: **********************************************************
  31. * Calibration 01: Sample Task: Transform measurements into world coordinates
  32. * Calibration 01: **********************************************************
  33. * Calibration 01: First, obtain the image coordinates of some points of interest
  34. * Calibration 01: lying in the reference plane. Here, we simply take the first
  35. * Calibration 01: two mark center points of the plate
  36. TmpCtrl_ImageRows := [TmpCtrl_MarkRows[0], TmpCtrl_MarkRows[6]]
  37. TmpCtrl_ImageColumns := [TmpCtrl_MarkColumns[0], TmpCtrl_MarkColumns[6]]
  38. * Calibration 01: A line between the two points, just for visualization
  39. gen_contour_polygon_xld (TmpObj_ImageContour, TmpCtrl_ImageRows, TmpCtrl_ImageColumns)
  40. * Calibration 01: Convert image coordinate to world coordinates (using [mm])
  41. * Calibration 01: The Z coordinates will be 0 by definition (on reference plane)
  42. image_points_to_world_plane (CameraParameters, CameraPose, TmpCtrl_ImageRows, TmpCtrl_ImageColumns, 'mm', TmpCtrl_WorldX, TmpCtrl_WorldY)
  43. * Calibration 01: Determine the distance in world coordinate [mm]
  44. distance_pp (TmpCtrl_WorldY[0], TmpCtrl_WorldX[0], TmpCtrl_WorldY[1], TmpCtrl_WorldX[1], TmpCtrl_Distance)
  45. stop ()

复制代码

amnoone 发表于 2018-12-27 21:21:29 | 显示全部楼层
厚度  ?
绝地武士 发表于 2018-12-28 08:11:21 | 显示全部楼层
你这个标定虽然单个像元基本准确,但是你的颈向畸变系数kappa 太大,你的宽度和高度对应的中心距离有4个和146像素偏差,你看看你的距离是多少像素,按照标定后3.2um算!感觉你的图像畸变有点明显,没有矫正?
完美世界 发表于 2018-12-30 21:30:32 | 显示全部楼层

图像畸变是不是在使用image_to_world_palne的时候就已经矫正了,因为这个算子需要输入相机的内外参呀,自己的理解不知道对不对
Jo_Kang 发表于 2019-1-3 11:39:10 | 显示全部楼层
焦距你填写参数的4mm,标定完是7.5mm,如果参数没问题,看看标定后计算的像素当量值,再计算实际尺寸,误差大肯定是标定有问题
丶初吻给了奶嘴 发表于 2019-3-4 10:01:37 | 显示全部楼层
我猜测这焦距参数填错了,你再确认下
血色旭阳 发表于 2020-10-22 12:30:58 | 显示全部楼层
请问楼主这个解决了吗?怎么解决的,遇到同问题
adabyron 发表于 2020-11-14 11:55:27 | 显示全部楼层
你的KAP出来的数据太大,还有镜头的焦距可能填写不对,标定后不会变化如此大;
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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