【问题标题】:Halcon - Vertical measure plane relative to the calibrated groundplaneHalcon - 相对于校准地平面的垂直测量平面
【发布时间】:2020-09-11 21:29:42
【问题描述】:

我有一个相机,它对角地看向地平面。这架飞机已校准。在这个平面上有一个物体,可以在任何距离(在相机的视野内),但总是会朝着相机旋转..(而不是与侧面成一定角度..)

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

编辑:

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

 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° 的平面。到目前为止一切顺利.. 但无法弄清楚坐标现在在哪里.. 0/0 在哪里,以及如何沿地平面移动它,如上图所示。

【问题讨论】:

  • 一般来说,您可以从此设置中提取的唯一有意义的测量值将是校准平面上的测量值。这样就可以提取平面上的X、Y坐标,Z坐标永远等于0。
  • @JakeChittle 我对你写的内容并不完全放心。如果您有一个已知平面,您可以在已知位置竖立一个垂直于该平面的新平面,并能够在该平面上进行测量,只需旋转地平面的副本。我上面的代码已经可以工作了,但是我的缺乏对 halcon 的了解使我无法正确定位飞机并设置新飞机的零坐标。因此,例如 id 喜欢将新平面的 0 放在图像的中心,在与地平面的交点处。
  • @JakeChittle 请检查您的电子邮件..刚刚给您发了一些东西.. ;)

标签: measure plane halcon


【解决方案1】:

这样解决了:

*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

【讨论】:

    猜你喜欢
    • 2016-05-21
    • 1970-01-01
    • 1970-01-01
    • 2018-02-09
    • 2019-04-10
    • 2019-10-08
    • 2012-04-02
    • 2021-10-18
    • 2015-04-28
    相关资源
    最近更新 更多