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

Viewer and camera height and width issue #1164

Closed
arunmallya opened this issue Sep 5, 2019 · 11 comments
Closed

Viewer and camera height and width issue #1164

arunmallya opened this issue Sep 5, 2019 · 11 comments
Assignees

Comments

@arunmallya
Copy link

Describe the bug
[ViewControl] ConvertFromPinholeCameraParameters() failed because window height and width do not match.
Setting the view to a specified camera fails even when the window height and width of the viewer and the camera match.

To Reproduce
https://gist.github.com/arunmallya/41374d7eed6a52923b6ca2eb864b420a
Data file: https://uofi.box.com/s/spqlqx6c6tggpedv6ehs6muz0deyogy0

Environment (please complete the following information):

  • OS: Ubuntu 16.04
  • Python version: 3.5.2
  • Open3D version: 0.7.0.0
  • Is this remote workstation?: no
  • How did you install Open3D?: pip
@arunmallya arunmallya added the bug label Sep 5, 2019
@syncle
Copy link
Contributor

syncle commented Oct 5, 2019

Could you check these lines? You may need to replace

K = [[focal * width, 0, width / 2],
     [0, focal * width, height / 2],
     [0, 0, 1]]

as

K = [[focal * width, 0, width / 2 - 0.5],
     [0, focal * width, height / 2 - 0.5],
     [0, 0, 1]]

@germanros1987
Copy link
Contributor

@errissa we will take care of this after the 0.11 release...

@eriksandstroem
Copy link

eriksandstroem commented Aug 17, 2020

@germanros1987 So there is still no solution to this problem? Adding -0.5 as suggested above did not work for me. I am trying to run the example script customized_visualization.py

Edit: After lots of gruesome pain I was able to get it to work. The key is to look at the code in ViewControl.cpp located at Open3D/cpp/visualization/visualizer/ViewControl.cpp.
image

All conditions need to be fulfilled in order to make it work.

@Zumbalamambo
Copy link

@germanros1987 so curious... Stuck with this issue for a week

@gonultasbu
Copy link

@tfy14esa thank you for your effort!

Adding -0.5 as suggested above did not solve the problem for me either. Turns out the window size also has to match with the intrinsic parameters and resolution. As follows:

viewer.create_window(width=width, height=height)

@hanjiangrui
Copy link

@tfy14esa thank you for your effort!

Adding -0.5 as suggested above did not solve the problem for me either. Turns out the window size also has to match with the intrinsic parameters and resolution. As follows:

viewer.create_window(width=width, height=height)
it's right

@YuDongSir
Copy link

YuDongSir commented Oct 19, 2021

I got the final solution:
just search
"
ctr.convert_from_pinhole_camera_parameters(
glb.trajectory.parameters[glb.index])
"
and add an argument
"
ctr.convert_from_pinhole_camera_parameters(
glb.trajectory.parameters[glb.index], True)
"
it will allow an arbitrary windows size, which can be seen easily in the source code.

@theNded
Copy link
Contributor

theNded commented Nov 23, 2021

Should have been supported in #2564.

@theNded theNded closed this as completed Nov 23, 2021
@RuipingL
Copy link

in current version, you should set the parameter allow_arbitrary=True, i.e.,
view_control.convert_from_pinhole_camera_parameters(cam_params, allow_arbitrary=True)

@Paullfx
Copy link

Paullfx commented Jan 2, 2025

in current version, you should set the parameter allow_arbitrary=True, i.e., view_control.convert_from_pinhole_camera_parameters(cam_params, allow_arbitrary=True)

This works! Saves my day :)

@zhaoruifeng1211
Copy link

in current version, you should set the parameter allow_arbitrary=True, i.e., view_control.convert_from_pinhole_camera_parameters(cam_params, allow_arbitrary=True)

Thank you, this is the best solution!

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

No branches or pull requests