Skip to content
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

View setting of setup_camera function in O3DVisualizer class #7033

Open
3 tasks done
Zhouwudexiazhou opened this issue Oct 28, 2024 · 1 comment
Open
3 tasks done
Labels

Comments

@Zhouwudexiazhou
Copy link

Checklist

My Question

The value of filed_of_view in the _camera function does not change the final render image? I set one to 60 degrees and the other to 10 degrees, but the picture is the same.
This is photo with value in 10 degrees.
photo1
This is photo with value in 60 degrees.
photo2
the code is :
import open3d as o3d
import numpy as np
o3d.visualization.gui.Application.instance.initialize()
pcd = o3d.io.read_point_cloud("D:/MPEG/mpeg-pcc-tmc2/mpeg_datasets/longdress/Ply/longdress_vox10_1051.ply")
box = pcd.get_axis_aligned_bounding_box()
min_box = box.get_min_bound()
max_box = box.get_max_bound()
center = (max_box + min_box) / 2
eye = np.array(center) + np.array([0, 0, 700])
vis = o3d.visualization.O3DVisualizer("3DVis", width=1920, height=1080)
vis.add_geometry(name="point_cloud", geometry=pcd, is_visible=True)
vis.point_size = 2
bg_color = np.array([255.0, 255.0, 255.0, 1.0], dtype=np.float32).reshape(4, 1)
vis.set_background(bg_color, None)
vis.post_redraw()
vis.enable_raw_mode(enable=True)
vis.show_skybox(show=False)
field_of_view = 60.0
center = np.array(center, dtype=np.float32)
eye = np.array(eye, dtype=np.float32)
up = np.array([0.0, 1.0, 0.0], dtype=np.float32)
vis.setup_camera(field_of_view, center, eye, up)
vis.post_redraw()
o3d.visualization.gui.Application.instance.add_window(vis)
path = r"D:\photo\photo2.png"
vis.export_current_image(path)
o3d.visualization.gui.Application.instance.run()

@cwreynolds
Copy link

@Zhouwudexiazhou tracked this down (see #7031) and found that the problem is that open3d::visualization::visualizer::O3DVisualizer::SetupCamera(fov, center, eye, up) simply ignores the fov parameter passed to it.

I assumed a work-around would be to use something like the legacy api open3d.visualization.ViewControl.change_field_of_view() but I do not see anything like that in the O3DVisualizer source.

This seems to be a bug, or perhaps two (SetupCamera ignores fov, and perhaps: missing api to set field-of-view). I think the bug tag should be added this issue. As far as I know, I cannot do that myself. Could someone else (@ssheorey ?) look at this and add the bug tag if needed? If so, perhaps the title should be changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants