1

I have a camera that is looking diagonally to a ground plane. this plane is calibrated. there is a object on this plane, that can be at any distance (within the field of view of the camera), but will always be rotated towards the camera.. (not at an angle to the side..)

I want to measure the height of this object. I can detect the location of the lower edge, were it touches the ground plane. Is it possible to sort of "erect a measuring plane" perpendicular to the ground plane in a defined position in order to measure vertically? If yes, how can this be done?

enter image description here

EDIT:

so far I came up with this:

 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, [], [], [])

this create a plane that is 90° rotated on the X axis of my ground plane. So far so good.. but cannot figure out where teh coordinates are now.. where 0/0 is, and how to move it along the ground plane as shown in the picture above.

sharkyenergy
  • 3,842
  • 10
  • 46
  • 97
  • In general, the only meaningful measurements you can extract from this setup will be the ones on the calibrated plane. So you will be able to extract X, Y coordinates on the plane and the Z coordinate will always be equal to 0. – Jake Chittle May 27 '20 at 15:36
  • @JakeChittle I'm not entirely shure about what you wrote. if you have a known plane, you can erect a new plane perpendicular to that one at a known position and be able to measure on that plane, simply by rotating a copy of the ground plane.. My above code is already working, but my lack in knowledge of halcon is stopping me from positioning the plane correctly and setting the zero coordinate of the new plane. so for example id like to have the 0 of the new plane in the center of the image, at the intersection with the ground plane. – sharkyenergy May 28 '20 at 05:34
  • @JakeChittle check your emails please.. just sent you something.. ;) – sharkyenergy May 28 '20 at 14:03

1 Answers1

0

solved it this way:

*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
sharkyenergy
  • 3,842
  • 10
  • 46
  • 97