-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
configurable zoom max and min #497
Comments
Can you provide an example of it? Would be nice to attach the view status (you can do it by control+C to take a snapshot, and paste it here). |
I am running into the same issue. It seems to be related to this: #803 The basic idea is that the objects in the environment (large) are not being drawn because the far clipping plane is too near: https://github.com/intel-isl/Open3D/blob/fab6441b763b4964ef898cbb3fae8d10ef98442f/src/Visualization/Visualizer/ViewControl.cpp#L69 A simple change to allow this to work would be able to have a parameter to increase the max zoom, which is hard coded to 2.0. https://github.com/intel-isl/Open3D/blob/fab6441b763b4964ef898cbb3fae8d10ef98442f/src/Visualization/Visualizer/ViewControl.cpp#L43 In my case I have point clouds that are translating dynamically through the environment. I need to be able to zoom out for them to be drawn in the window, but I can not because I am limited to how much I can zoom out. |
A not so great workaround that I have implemented. Basically you press the key 'C' to recenter the bounding box of the point cloud. def center_view(vis):
vis.reset_view_point(True)
vis = o3d.visualization.VisualizerWithKeyCallback()
vis.create_window()
vis.register_key_callback(ord("C"), center_view)
# Your Code
# Loop
while True:
# Update your geometries, possibly large translations
vis.update_geometry()
vis.poll_events()
vis.update_renderer()
time.sleep(1/60) |
This is done in the new visualizer. |
any solution to this? I have pointcloud from a small room and I want to be able to visualize it by zooming in |
When using To add some context, the workaround proposed @JeremyBYU has the advantage that, by calling Open3D/cpp/open3d/visualization/visualizer/Visualizer.h Lines 231 to 232 in 47e2c7d
This also allows to avoid the depth-range clipping problem mentioned in #803 without the need of moving to the However, by only calling This is resolved by saving the viewpoint before the reset and loading it afterwards: cam = vis.get_view_control().convert_to_pinhole_camera_parameters()
vis.reset_view_point(True)
vis.get_view_control().convert_from_pinhole_camera_parameters(cam) As suggested by @qianyizh, below I post a (toy) example for each case. [code to reproduce (Open3D version: 0.16)]import open3d as o3d
import numpy as np
import time
if __name__ == "__main__":
vis = o3d.visualization.Visualizer()
vis.create_window(height=480, width=640)
sphere1 = o3d.geometry.TriangleMesh.create_sphere(0.5)
sphere1.paint_uniform_color((0.8, 0.0, 0.0))
vis.add_geometry(sphere1)
sphere2 = o3d.geometry.TriangleMesh.create_sphere(0.5)
sphere2.paint_uniform_color((0.8, 0.0, 0.0))
vis.add_geometry(sphere2)
dt = 0.2
s = time.time()
# run non-blocking visualization.
keep_running = True
while keep_running:
if time.time() - s > dt:
s = time.time()
sphere2.translate(np.array([0.1, 0.0, 0.0]))
vis.update_geometry(sphere2)
# workaround.
# 1) Comment the 3 lines for the original behavior.
# 2) Only comment the 1st and 3rd lines for reset only.
# 3) Uncomment the 3 lines for the complete workaround.
cam = vis.get_view_control().convert_to_pinhole_camera_parameters()
vis.reset_view_point(True)
vis.get_view_control().convert_from_pinhole_camera_parameters(cam)
keep_running = vis.poll_events()
vis.update_renderer()
vis.destroy_window()
|
Great post, but I got this error when using the last line in your code snippet: [Open3D WARNING] [ViewControl] ConvertFromPinholeCameraParameters() failed because window height and width do not match. vis.get_view_control().convert_from_pinhole_camera_parameters(cam) |
Hi @richardrl , I can reproduce the error you are having, and I believe it is caused by the bug mentioned in #6666. This bug has been fixed in #6711. However, the latest pypi release of Open3D (0.18.0) still contains the bug. The reason this error shouldn't occur is that the Open3D/cpp/open3d/visualization/visualizer/ViewControl.cpp Lines 178 to 189 in 525c4e6
These checks ensure that the dimensions (height and width) of the viewer match those of the camera being set. Since we are keeping the dimensions unchanged, there shouldn't be any error. As a workaround to avoid being affected by the bug, you can set the optional argument # change this line:
vis.get_view_control().convert_from_pinhole_camera_parameters(cam)
# to this line:
vis.get_view_control().convert_from_pinhole_camera_parameters(cam, allow_arbitrary=True) |
@javrtg Thanks for your response. However, the allow_arbitrary code seems to do something weird to the camera. I can't really translate it with CTRL + ALT + left drag anymore. |
@richardrl I find that a bit strange because (at least with open3d 0.18.0) I can still translate the camera using either of:
Maybe something else is causing the visualizer to block? |
Currently the visualizer has the max and min zoom. This results in objects vanishing in the view when the object pose is set outside of the max-min zoom range.
Would it be possible to make the zoom range configurable?
The text was updated successfully, but these errors were encountered: