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

i think this is a bug,hope you can help me #727

Closed
ChenDRAG opened this issue Dec 5, 2018 · 6 comments
Closed

i think this is a bug,hope you can help me #727

ChenDRAG opened this issue Dec 5, 2018 · 6 comments

Comments

@ChenDRAG
Copy link

ChenDRAG commented Dec 5, 2018

i use
vis.get_view_control().convert_from_pinhole_camera_parameters(intrinsic, extrinsic)
to try to change the vis's intrinsic , but get the error message
[ViewControl] ConvertFromPinholeCameraParameters() failed because window height and width do not match.
however,i specificly set window size but still get the error message .
it seems that the vis do not allow others to change its intrinsic?

here is the code

m = load.Obj("../ori/live_smpl/frame_1536_live_smpl.obj")
m=m.data
mesh=dict_to_open3dmesh(m)
root=np.array([
[  0.998829 , 0.0333804 ,-0.0346933,    1.01455],
[0.0347492  , -0.99859 , 0.0396284  ,  1.30343],
[-0.0333237 ,-0.0407875  ,-0.998584 ,  0.862265],
[0     ,     0   ,       0    ,      1]
])
mesh.transform(root)
mesh.compute_vertex_normals()
#custom_draw_geometry_with_key_callback(mesh)
vis = open3d.Visualizer()
intrinsic=open3d.PinholeCameraIntrinsic()
intrinsic.set_intrinsics(640,480,365.4020,365.6674,316.4944,235.7411)
extrinsic=np.array([
[    0.9981 ,-0.0160041,  0.0593907 ,   -1.0298],
[0.0123974 ,  0.998087 , 0.0605806  , -1.59618],
[-0.060248, -0.0597236 ,  0.996391  ,  1.32826],
[       0.  ,        0. ,       0.     ,     1.]
],dtype='float64')
print(vis)
print(vis.get_window_name())
print(vis.get_view_control())
vis.create_window(width=640, height=480, left=50, right=50)
vis.get_view_control().convert_from_pinhole_camera_parameters(intrinsic, extrinsic)
vis.add_geometry(mesh)
vis.run()
vis.destroy_window()

in a hurry ,really need your help

@yxlao
Copy link
Collaborator

yxlao commented Dec 5, 2018

One possible reason is that convert_from_pinhole_camera_parameters function signature has been changed in #597. It now takes the camera parameter instead if intrinsic and extrinsic.

@ChenDRAG
Copy link
Author

ChenDRAG commented Dec 6, 2018

i read #597,but don't really get it?
does that mean i for now cannot change the intrinsics by myself of is there annother way to do it? can you please show me(a function or an example would be enough) ?
also , it seems that i cannot use the clase newly merged in #597

help(PinholeCameraParameters)
Traceback (most recent call last):
File "", line 1, in
NameError: name 'PinholeCameraParameters' is not defined
help(open3d.PinholeCameraParameters)
Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'open3d.open3d' has no attribute 'PinholeCameraParameters'
help(read_pinhole_camera_parameters)
Traceback (most recent call last):
File "", line 1, in
NameError: name 'read_pinhole_camera_parameters' is not defined

thanks again

@ChenDRAG
Copy link
Author

ChenDRAG commented Dec 6, 2018

is that because i pip3 install a wrong version of open3d?

but for the intrinsic,if i use the intrinsic from the " convert_from_pinhole_camera_parameters " function,
and use self defined extrinsic,it rebturned true .but when i changed the intrinsic to self-defined intrinsic(like the code above),it gives me the error.
i'm confused.

@yxlao
Copy link
Collaborator

yxlao commented Dec 6, 2018

Oh I see, that was a separate issue.

Now, regarding the original question, according to here, we need to change the cx = width / 2 - 0.5 = 319.5 and cy = height / 2 - 0.5 = 239.5.

E.g. change this line:

intrinsic.set_intrinsics(640, 480, 365.4020, 365.6674, 319.5, 239.5)

@ChenDRAG
Copy link
Author

ChenDRAG commented Dec 6, 2018

got it , problem solved.thanks a lot .
really appreciate your help.

@ChenDRAG ChenDRAG closed this as completed Dec 6, 2018
@simon-donne
Copy link

simon-donne commented Aug 26, 2019

I'd like to reopen this. Why is the check w.r.t. the optical center there?
If this is the general assumption with Open3D, then why pass the optical center at all ? (i.e. I have pre-calibrated cameras which I'd like to replicate but which isn't directly possible like this).
The warning message at least could be more descriptive in case the optical center doesn't match what open3d is expecting/restricting to.

second edit: this restriction is explained in #834 .
As of now I guess the complaint is not really relevant, except updating the warning message.

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

3 participants