HALCON从像素坐标得到世界坐标

 首先肯定要标定了,下面是标定结果,直接把参数写成一个数组,后面算子直接调用

*下面是标定结果,直接生成内外参矩阵
* Calibration 01: Code generated by Calibration 01
CameraParameters := ['area_scan_division',0.0260747,-96.9022,2.40016e-006,2.4e-006,2580.78,1799.58,5472,3648]
CameraPose := [-0.0232082,-0.011688,0.51574,1.3039,358.374,180.642,0]

 下面是核心的代码,image_points_to_world_plan用内参和外参把像素坐标转为世界坐标,然后显示出来

        dev_set_color ('green')
        dev_get_window(WindowHandle)
        set_display_font(WindowHandle,16,'mono','true','false')
        color :=[255,0,255]
        
        *dev_display (TransContours)
         image_points_to_world_plane (CameraParameters, CameraPose, Row, Column, 'mm', X, Y)
         disp_message(WindowHandle,['center point:'+'('+X$'5.2f'+','+Y$'5.2f'+')'+'mm'],'window',12,120,'red',['green','false'])

 参考坐标系:

 

HALCON从像素坐标得到世界坐标_第1张图片

 结果:

 

 HALCON从像素坐标得到世界坐标_第2张图片

你可能感兴趣的:(机器视觉,c++)