MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / saveCameraParameters

Method saveCameraParameters

visualization/src/interactor_style.cpp:137–163  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

135
136//////////////////////////////////////////////////////////////////////////////////////////////
137bool
138pcl::visualization::PCLVisualizerInteractorStyle::saveCameraParameters (const std::string &file)
139{
140 FindPokedRenderer (Interactor->GetEventPosition ()[0], Interactor->GetEventPosition ()[1]);
141
142 std::ofstream ofs_cam (file.c_str ());
143 if (!ofs_cam.is_open ())
144 {
145 return (false);
146 }
147
148 vtkSmartPointer<vtkCamera> cam = Interactor->GetRenderWindow ()->GetRenderers ()->GetFirstRenderer ()->GetActiveCamera ();
149 double clip[2], focal[3], pos[3], view[3];
150 cam->GetClippingRange (clip);
151 cam->GetFocalPoint (focal);
152 cam->GetPosition (pos);
153 cam->GetViewUp (view);
154 int *win_pos = Interactor->GetRenderWindow ()->GetPosition ();
155 int *win_size = Interactor->GetRenderWindow ()->GetSize ();
156 ofs_cam << clip[0] << "," << clip[1] << "/" << focal[0] << "," << focal[1] << "," << focal[2] << "/" <<
157 pos[0] << "," << pos[1] << "," << pos[2] << "/" << view[0] << "," << view[1] << "," << view[2] << "/" <<
158 cam->GetViewAngle () / 180.0 * M_PI << "/" << win_size[0] << "," << win_size[1] << "/" << win_pos[0] << "," << win_pos[1]
159 << std::endl;
160 ofs_cam.close ();
161
162 return (true);
163}
164
165//////////////////////////////////////////////////////////////////////////////////////////////
166void

Callers

nothing calls this directly

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected