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

C++'s viewcontrol doesn't work at ver0.8 #2843

Closed
kazu0622 opened this issue Dec 31, 2020 · 1 comment
Closed

C++'s viewcontrol doesn't work at ver0.8 #2843

kazu0622 opened this issue Dec 31, 2020 · 1 comment

Comments

@kazu0622
Copy link

I'm using ver0.8 to build C++ app because my VisualStudio is 2015.
And I tried to use viewControl to change view angle by changing camera extrinsic params.
And it seems it fail to change extrinsics. I'd like to know how to solve this probrem.

My code overview is as follows:
visualization::Visualizer vis;
geometry::LineSet lineset;
Eigen::Vector3d drawcamerapoint[5] = {
Eigen::Vector3d(0, 0, 0),//0
Eigen::Vector3d(-0.2, -0.1, 0.1),//1
Eigen::Vector3d(0.2, -0.1, 0.1),//2
Eigen::Vector3d(0.2, 0.1, 0.1),//3
Eigen::Vector3d(-0.2, 0.1, 0.1)//4
};
Eigen::Vector2i drawcameraline[8] = {
Eigen::Vector2i(0, 1),
Eigen::Vector2i(0, 2)
};
Eigen::Matrix4d view_extrinsic = Eigen::Matrix4d::Identity();
std::shared_ptrgeometry::LineSet lineset_ptr(
new geometry::LineSet);
*lineset_ptr = lineset;
vis.AddGeometry(lineset_ptr);
visualization::ViewControl viewctrl = vis.GetViewControl();
camera::PinholeCameraParameters camparam;
viewctrl.ConvertToPinholeCameraParameters(camparam);
camparam.extrinsic_ = Eigen::Matrix4d_u::Identity();
while(1){
vis.UpdateGeometry();
vis.PollEvents();
vis.UpdateRender();
}

@pablospe
Copy link
Contributor

pablospe commented Jan 4, 2021

With the old viewer, use the allow_arbitrary argument. Related PR: #2564
I would recommend to use the new viewer, if possible.

@theNded theNded closed this as completed Nov 21, 2021
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