implement window relevant methods in Viz3d
This commit is contained in:
parent
4f416352e1
commit
f6e1a093cd
@ -24,8 +24,6 @@ namespace cv
|
|||||||
Viz3d& operator=(const Viz3d&);
|
Viz3d& operator=(const Viz3d&);
|
||||||
~Viz3d();
|
~Viz3d();
|
||||||
|
|
||||||
void setBackgroundColor(const Color& color = Color::black());
|
|
||||||
|
|
||||||
void showWidget(const String &id, const Widget &widget, const Affine3f &pose = Affine3f::Identity());
|
void showWidget(const String &id, const Widget &widget, const Affine3f &pose = Affine3f::Identity());
|
||||||
void removeWidget(const String &id);
|
void removeWidget(const String &id);
|
||||||
Widget getWidget(const String &id) const;
|
Widget getWidget(const String &id) const;
|
||||||
@ -45,8 +43,12 @@ namespace cv
|
|||||||
|
|
||||||
Size getWindowSize() const;
|
Size getWindowSize() const;
|
||||||
void setWindowSize(const Size &window_size);
|
void setWindowSize(const Size &window_size);
|
||||||
|
|
||||||
String getWindowName() const;
|
String getWindowName() const;
|
||||||
|
void saveScreenshot (const String &file);
|
||||||
|
void setWindowPosition (int x, int y);
|
||||||
|
void setFullScreen (bool mode);
|
||||||
|
void setWindowName (const String &name);
|
||||||
|
void setBackgroundColor(const Color& color = Color::black());
|
||||||
|
|
||||||
void spin();
|
void spin();
|
||||||
void spinOnce(int time = 1, bool force_redraw = false);
|
void spinOnce(int time = 1, bool force_redraw = false);
|
||||||
|
@ -42,8 +42,6 @@ void cv::viz::Viz3d::release()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::viz::Viz3d::setBackgroundColor(const Color& color) { impl_->setBackgroundColor(color); }
|
|
||||||
|
|
||||||
void cv::viz::Viz3d::spin() { impl_->spin(); }
|
void cv::viz::Viz3d::spin() { impl_->spin(); }
|
||||||
void cv::viz::Viz3d::spinOnce (int time, bool force_redraw) { impl_->spinOnce(time, force_redraw); }
|
void cv::viz::Viz3d::spinOnce (int time, bool force_redraw) { impl_->spinOnce(time, force_redraw); }
|
||||||
bool cv::viz::Viz3d::wasStopped() const { return impl_->wasStopped(); }
|
bool cv::viz::Viz3d::wasStopped() const { return impl_->wasStopped(); }
|
||||||
@ -73,6 +71,11 @@ void cv::viz::Viz3d::converTo3DRay(const Point3d &window_coord, Point3d &origin,
|
|||||||
cv::Size cv::viz::Viz3d::getWindowSize() const { return impl_->getWindowSize(); }
|
cv::Size cv::viz::Viz3d::getWindowSize() const { return impl_->getWindowSize(); }
|
||||||
void cv::viz::Viz3d::setWindowSize(const Size &window_size) { impl_->setWindowSize(window_size.width, window_size.height); }
|
void cv::viz::Viz3d::setWindowSize(const Size &window_size) { impl_->setWindowSize(window_size.width, window_size.height); }
|
||||||
cv::String cv::viz::Viz3d::getWindowName() const { return impl_->getWindowName(); }
|
cv::String cv::viz::Viz3d::getWindowName() const { return impl_->getWindowName(); }
|
||||||
|
void cv::viz::Viz3d::saveScreenshot (const String &file) { impl_->saveScreenshot(file); }
|
||||||
|
void cv::viz::Viz3d::setWindowPosition (int x, int y) { impl_->setWindowPosition(x,y); }
|
||||||
|
void cv::viz::Viz3d::setFullScreen (bool mode) { impl_->setFullScreen(mode); }
|
||||||
|
void cv::viz::Viz3d::setWindowName (const String &name) { impl_->setWindowName(name); }
|
||||||
|
void cv::viz::Viz3d::setBackgroundColor(const Color& color) { impl_->setBackgroundColor(color); }
|
||||||
|
|
||||||
void cv::viz::Viz3d::setRenderingProperty(int property, double value, const String &id) { getWidget(id).setRenderingProperty(property, value); }
|
void cv::viz::Viz3d::setRenderingProperty(int property, double value, const String &id) { getWidget(id).setRenderingProperty(property, value); }
|
||||||
double cv::viz::Viz3d::getRenderingProperty(int property, const String &id) { return getWidget(id).getRenderingProperty(property); }
|
double cv::viz::Viz3d::getRenderingProperty(int property, const String &id) { return getWidget(id).getRenderingProperty(property); }
|
||||||
|
@ -249,30 +249,6 @@ void cv::viz::Viz3d::VizImpl::setBackgroundColor (const Color& color)
|
|||||||
renderer_->SetBackground (c.val);
|
renderer_->SetBackground (c.val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
void cv::viz::Viz3d::VizImpl::initCameraParameters ()
|
|
||||||
{
|
|
||||||
Vec2i window_size(window_->GetScreenSize());
|
|
||||||
window_size /= 2;
|
|
||||||
|
|
||||||
Camera camera_temp(Vec2f(0.0,0.8575), Size(window_size[0], window_size[1]));
|
|
||||||
setCamera(camera_temp);
|
|
||||||
setViewerPose(makeCameraPose(Vec3f(0.0f,0.0f,0.0f), Vec3f(0.0f, 0.0f, 1.0f), Vec3f(0.0f, 1.0f, 0.0f)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
bool cv::viz::Viz3d::VizImpl::cameraParamsSet () const { return (camera_set_); }
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
void cv::viz::Viz3d::VizImpl::updateCamera ()
|
|
||||||
{
|
|
||||||
std::cout << "[cv::viz::PCLVisualizer::updateCamera()] This method was deprecated, just re-rendering all scenes now." << std::endl;
|
|
||||||
//rens_->InitTraversal ();
|
|
||||||
// Update the camera parameters
|
|
||||||
|
|
||||||
renderer_->Render ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
void cv::viz::Viz3d::VizImpl::setCamera(const Camera &camera)
|
void cv::viz::Viz3d::VizImpl::setCamera(const Camera &camera)
|
||||||
{
|
{
|
||||||
@ -379,12 +355,6 @@ void cv::viz::Viz3d::VizImpl::converTo3DRay(const Point3d &window_coord, Point3d
|
|||||||
direction = normalize(Vec3d(world_pt.val) - cam_pos);
|
direction = normalize(Vec3d(world_pt.val) - cam_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
void cv::viz::Viz3d::VizImpl::resetCamera ()
|
|
||||||
{
|
|
||||||
renderer_->ResetCamera ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
void cv::viz::Viz3d::VizImpl::resetCameraViewpoint (const std::string &id)
|
void cv::viz::Viz3d::VizImpl::resetCameraViewpoint (const std::string &id)
|
||||||
{
|
{
|
||||||
|
@ -16,8 +16,15 @@ public:
|
|||||||
|
|
||||||
VizImpl (const String &name);
|
VizImpl (const String &name);
|
||||||
virtual ~VizImpl ();
|
virtual ~VizImpl ();
|
||||||
|
|
||||||
|
void showWidget(const String &id, const Widget &widget, const Affine3f &pose = Affine3f::Identity());
|
||||||
|
void removeWidget(const String &id);
|
||||||
|
Widget getWidget(const String &id) const;
|
||||||
void removeAllWidgets();
|
void removeAllWidgets();
|
||||||
|
|
||||||
|
void setWidgetPose(const String &id, const Affine3f &pose);
|
||||||
|
void updateWidgetPose(const String &id, const Affine3f &pose);
|
||||||
|
Affine3f getWidgetPose(const String &id) const;
|
||||||
|
|
||||||
void setRenderingProperty(int property, double value, const String &id);
|
void setRenderingProperty(int property, double value, const String &id);
|
||||||
double getRenderingProperty(int property, const String &id);
|
double getRenderingProperty(int property, const String &id);
|
||||||
@ -51,29 +58,16 @@ public:
|
|||||||
void setCamera(const Camera &camera);
|
void setCamera(const Camera &camera);
|
||||||
Camera getCamera() const;
|
Camera getCamera() const;
|
||||||
|
|
||||||
void initCameraParameters (); /** \brief Initialize camera parameters with some default values. */
|
|
||||||
bool cameraParamsSet () const; /** \brief Checks whether the camera parameters were manually loaded from file.*/
|
|
||||||
void updateCamera (); /** \brief Update camera parameters and render. */
|
|
||||||
void resetCamera (); /** \brief Reset camera parameters and render. */
|
|
||||||
|
|
||||||
/** \brief Reset the camera direction from {0, 0, 0} to the center_{x, y, z} of a given dataset.
|
/** \brief Reset the camera direction from {0, 0, 0} to the center_{x, y, z} of a given dataset.
|
||||||
* \param[in] id the point cloud object id (default: cloud) */
|
* \param[in] id the point cloud object id (default: cloud) */
|
||||||
void resetCameraViewpoint (const String& id = "cloud");
|
void resetCameraViewpoint (const String& id = "cloud");
|
||||||
|
|
||||||
//to implement Viz3d set/getViewerPose()
|
|
||||||
void setViewerPose(const Affine3f &pose);
|
void setViewerPose(const Affine3f &pose);
|
||||||
Affine3f getViewerPose();
|
Affine3f getViewerPose();
|
||||||
|
|
||||||
void convertToWindowCoordinates(const Point3d &pt, Point3d &window_coord);
|
void convertToWindowCoordinates(const Point3d &pt, Point3d &window_coord);
|
||||||
void converTo3DRay(const Point3d &window_coord, Point3d &origin, Vec3d &direction);
|
void converTo3DRay(const Point3d &window_coord, Point3d &origin, Vec3d &direction);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//to implemnt in Viz3d
|
|
||||||
void saveScreenshot (const String &file);
|
void saveScreenshot (const String &file);
|
||||||
void setWindowPosition (int x, int y);
|
void setWindowPosition (int x, int y);
|
||||||
Size getWindowSize() const;
|
Size getWindowSize() const;
|
||||||
@ -89,22 +83,6 @@ public:
|
|||||||
void registerKeyboardCallback(KeyboardCallback callback, void* cookie = 0);
|
void registerKeyboardCallback(KeyboardCallback callback, void* cookie = 0);
|
||||||
void registerMouseCallback(MouseCallback callback, void* cookie = 0);
|
void registerMouseCallback(MouseCallback callback, void* cookie = 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//declare above (to move to up)
|
|
||||||
void showWidget(const String &id, const Widget &widget, const Affine3f &pose = Affine3f::Identity());
|
|
||||||
void removeWidget(const String &id);
|
|
||||||
Widget getWidget(const String &id) const;
|
|
||||||
|
|
||||||
void setWidgetPose(const String &id, const Affine3f &pose);
|
|
||||||
void updateWidgetPose(const String &id, const Affine3f &pose);
|
|
||||||
Affine3f getWidgetPose(const String &id) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
vtkSmartPointer<vtkRenderWindowInteractor> interactor_;
|
vtkSmartPointer<vtkRenderWindowInteractor> interactor_;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user