Halcon - 相对于标定地平面的垂直测量面。

问题描述 投票:1回答:1

在这个平面上有一个物体,它可以在任何距离(在摄像机的视野范围内),但总是朝摄像机旋转......(而不是朝侧面倾斜......)。(而不是向旁边倾斜...)

我想测量这个物体的高度。我可以检测到下边缘的位置,即它与地面接触的位置。是否可以在一个规定的位置,在垂直于地平面的地方 "竖立一个测量平面",以便进行垂直测量?如果可以,如何做到这一点?

enter image description here

EDIT:

到目前为止,我想出了这个办法:

 newpose := Pose
 newpose[3] := newpose[3]-90
 gen_plane_object_model_3d (newpose, [-0.5,-0.5,0.5,0.5], [-0.5,0.5,0.5,-0.5], ObjectModel3D)
 disp_object_model_3d (3600, ObjectModel3D, CamParam, [], [], [])

这将创建一个以我的地平面为X轴旋转90°的平面。到目前为止一切都很好......但我无法弄清楚现在的坐标在哪里......00在哪里,以及如何将其沿地面平面移动,如上图所示。

measure plane halcon
1个回答
0
投票

这样解决了。

*shift pose to desired zero on ground plane…
set_origin_pose (Pose, -0.0134, 0.221343, 0.000, Pose)

grab_image (Image, AcqHandle)

*make a copy of the original pose and rotate it 90 degrees along the x axis.. New pose is with 0/0 in same location as ground pose, but perpendicular to it.
  newpose := Pose
  newpose[3] := newpose[3]-90
*move the vertical plane along the Y axis of the ground plane (Z axis of the vertical plane). In this case 15 cm…
  set_origin_pose (newpose, -0, -0, -0.15, newpose)

*klick on the image to measure coordinates in mm relative to the zero point of the vertical plane.
    while (1)
    disp_message (3600, 'Measure one point: left mouse button', 'window', 12, 12, 'red', 'false')
    disp_message (3600, 'Exit measure mode: right mouse button', 'window', 36, 12, 'red', 'false')
    get_mbutton (3600, Row, Column, Button)
   if (Button == 4)
        break
    endif
    dev_display (Image)
    dev_set_color ('green')
    disp_cross (3600, Row, Column, 6, 0)
    image_points_to_world_plane (CamParam, newpose, Row, Column, 1, X1, Y1)
    disp_message (3600, 'X = ' + X1, 'window', 320, 400, 'red', 'false')
    disp_message (3600, 'Y = ' + Y1, 'window', 340, 400, 'red', 'false')
endwhile
© www.soinside.com 2019 - 2024. All rights reserved.