分享

三.HALCON标定后的二维测量

 行走在理想边缘 2017-05-13
calibrate_cameras (CalibDataID, Errors)
get_calib_data (CalibDataID, 'camera', 0, 'params', CamParam)
NumImage := 11
get_calib_data (CalibDataID, 'calib_obj_pose', [0, NumImage], 'pose', Pose)
* To take the thickness of the calibration plate into account, the z-value
* of the origin given by the camera pose has to be translated by the
* thickness of the calibration plate.
* Deactivate the following line if you do not want to add the correction.
set_origin_pose (Pose, 0, 0, 0.00075, Pose)
* measure the distance between the pitch lines
gen_measure_rectangle2 (195, 226, -0.526627271434, 174, 3, 652, 494, 'bilinear', MeasureHandle)
measure_pairs (Image, MeasureHandle, 0.5, 5, 'all', 'all', RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance)
Row := (RowEdgeFirst+RowEdgeSecond)/2.0
Col := (ColumnEdgeFirst+ColumnEdgeSecond)/2.0
disp_cross (WindowHandle, Row, Col, 6, 0)
image_points_to_world_plane (CamParam, Pose, Row, Col, 'mm', X1, Y1)
distance_pp (X1[0:4], Y1[0:4], X1[1:5], Y1[1:5], Distance)
tuple_mean (Distance, MeanDistance)
tuple_deviation (Distance, DeviationDistance)
disp_message (WindowHandle, 'Mean distance: '+MeanDistance$'.3f'+'mm +/- '+DeviationDistance$'.3f'+'mm', 'window', 30, 150, 'yellow', 'false')
close_measure (MeasureHandle)
clear_calib_data (CalibDataID)

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多