0

When slicing a objectModel3D into horizontal layers using select_points_object_model_3d and rendering these layers using render_object_model_3d(), I noticed that smaller parts of the bigger pointcloud get centered and scaled up to fit the graphics window.

Instead I would like these rendered parts to be te same size and location as when they were part of the bigger objectModel3D.

I have a workaround where I make four small objects at certain distance to each other that I rendered in the image together with the part, this made sure the area to render was always the same and prevented the scaling. But this method is a bit hacky and far from perfect so I was wondering if there is a better way.

How can I render parts of a pointcloud from the same perspective?

EDIT:

Here is the source I use:

for j := 0 to |ROI_slice_zFrom|-1 by 1
  select_points_object_model_3d (scene, 'point_coord_z', ROI_slice_zFrom[j], ROI_slice_zTo[j], slice)
  render_object_model_3d (rendered_image, [borderObjects, slice], CameraParam, [], colorParam, colorValues)
endfor

I expected this to generate images of horizontal layers that would be correctly aligned (with each other) over the x- and y-axis, unfortunately this is not the case. I thought maybe I am supposed insert a pose into the render procedure, but I wouldn't know what pose to use as the camera pose has been invalidated by many transformations.

The borderobjects are just 4 small blocks that create an area bigger than and overlapping the ROI:

*borderobjects
lenUnit                  := 3500
distLen                  := 1500

* borderobject poses
create_pose (distLen, 0, 0, 0, 0, 0, 'Rp+T', 'gba', 'point', pose0)
create_pose (0, distLen, 0, 0, 0, 0, 'Rp+T', 'gba', 'point', pose1)
create_pose (-distLen, 0, 0, 0, 0, 0, 'Rp+T', 'gba', 'point', pose2)
create_pose (0, -distLen, 0, 0, 0, 0, 'Rp+T', 'gba', 'point', pose3)
* offset
create_pose (-3000, -3000, 0, 0, 0, 0, 'Rp+T', 'gba', 'point', borderObjects_XYoffset)

* composed poses
pose_compose (pose0, borderObjects_XYoffset, pose0)
pose_compose (pose1, borderObjects_XYoffset, pose1)
pose_compose (pose2, borderObjects_XYoffset, pose2)
pose_compose (pose3, borderObjects_XYoffset, pose3)

* borderobject   
gen_object_model_3d_from_points (lenUnit, lenUnit, lenUnit, borderObject)

* borderobjects        
rigid_trans_object_model_3d (borderObject, pose0, borderObject_trans0)
rigid_trans_object_model_3d (borderObject, pose1, borderObject_trans1)
rigid_trans_object_model_3d (borderObject, pose2, borderObject_trans2)
rigid_trans_object_model_3d (borderObject, pose3, borderObject_trans3)
borderObjects := [borderObject_trans0, borderObject_trans1, borderObject_trans2, borderObject_trans3]
Malinko
  • 124
  • 11

2 Answers2

1

Perceived auto-scaling may be some sort of coincidence.

You should be able to control the size of scene objects in the rendered image by manipulating Camera Parameter and pose arguments just as you would zoom (focal length) and point (pose) a real camera.

render_object_model_3d(imgBunny, 'bunny', CamParam, CamPose, [], [])

We rely heavily on the 3D display and render operators to perform deterministically. It would be very odd for an adaptive behavior / bug to have escaped attention.

Jim
  • 56
  • 4
  • That why I found it weird, why would it scale? But I am certain it did, not a little, A LOT. Could it be that I first used `select_points_object_model_3d ` to select a (smaller) part of the pointcloud? and that the resulting part is rendered smaller because it is a smaller pointcloud? – Malinko Oct 10 '22 at 06:53
  • 1
    That could explain it. You could look at the bounding sphere of the object_model_3d before and after the select_points operation. Here's the operator. smallest_sphere_object_model_3d(myOm3d, center, radius) – Jim Oct 10 '22 at 13:13
0

If you want to render horizontal layers of a pointcloud to images and you don't want things to center of scale then you must use a pose AND in/decrement the trans-Z value of the pose to coincide with de in/decrementation of the trans-Z value used to slice the pointcloud. Doing this will keep the distance between the viewpoint/camera and the rendered part the same and also prevent the centering.

Malinko
  • 124
  • 11