Commit 21be9796 authored by Ozan Tonkal's avatar Ozan Tonkal

comments on widgets where constructors might be confusing

parent 2705113b
...@@ -65,9 +65,10 @@ namespace cv ...@@ -65,9 +65,10 @@ namespace cv
//! takes coordiante frame data and builds transfrom to global coordinate frame //! takes coordiante frame data and builds transfrom to global coordinate frame
CV_EXPORTS Affine3f makeTransformToGlobal(const Vec3f& axis_x, const Vec3f& axis_y, const Vec3f& axis_z, const Vec3f& origin = Vec3f::all(0)); CV_EXPORTS Affine3f makeTransformToGlobal(const Vec3f& axis_x, const Vec3f& axis_y, const Vec3f& axis_z, const Vec3f& origin = Vec3f::all(0));
//! constructs camera pose from position, focal_point and up_vector (see gluLookAt() for more infromation //! constructs camera pose from position, focal_point and up_vector (see gluLookAt() for more infromation)
CV_EXPORTS Affine3f makeCameraPose(const Vec3f& position, const Vec3f& focal_point, const Vec3f& y_dir); CV_EXPORTS Affine3f makeCameraPose(const Vec3f& position, const Vec3f& focal_point, const Vec3f& y_dir);
//! retrieves a window by its name
CV_EXPORTS Viz3d get(const String &window_name); CV_EXPORTS Viz3d get(const String &window_name);
//! checks float value for Nan //! checks float value for Nan
...@@ -92,6 +93,7 @@ namespace cv ...@@ -92,6 +93,7 @@ namespace cv
template<typename _Tp> inline bool isNan(const Point3_<_Tp>& p) template<typename _Tp> inline bool isNan(const Point3_<_Tp>& p)
{ return isNan(p.x) || isNan(p.y) || isNan(p.z); } { return isNan(p.x) || isNan(p.y) || isNan(p.z); }
//! helper class that provides access by name infrastructure
class CV_EXPORTS VizAccessor class CV_EXPORTS VizAccessor
{ {
public: public:
...@@ -102,6 +104,7 @@ namespace cv ...@@ -102,6 +104,7 @@ namespace cv
void add(Viz3d window); void add(Viz3d window);
void remove(const String &window_name); void remove(const String &window_name);
//! window names automatically have Viz - prefix even though not provided by the users
static void generateWindowName(const String &window_name, String &output); static void generateWindowName(const String &window_name, String &output);
private: private:
...@@ -112,8 +115,8 @@ namespace cv ...@@ -112,8 +115,8 @@ namespace cv
static bool is_instantiated_; static bool is_instantiated_;
static VizMap viz_map_; static VizMap viz_map_;
}; };
} } /* namespace viz */
} } /* namespace cv */
#endif /* __OPENCV_VIZ_HPP__ */ #endif /* __OPENCV_VIZ_HPP__ */
......
...@@ -39,6 +39,7 @@ namespace cv ...@@ -39,6 +39,7 @@ namespace cv
Mat cloud, colors; Mat cloud, colors;
Mat polygons; Mat polygons;
//! Loads mesh from a given ply file
static cv::viz::Mesh3d loadMesh(const String& file); static cv::viz::Mesh3d loadMesh(const String& file);
private: private:
...@@ -52,14 +53,8 @@ namespace cv ...@@ -52,14 +53,8 @@ namespace cv
static const unsigned int Ctrl = 2; static const unsigned int Ctrl = 2;
static const unsigned int Shift = 4; static const unsigned int Shift = 4;
/** \brief Constructor //! Create a keyboard event
* \param[in] action true for key was pressed, false for released //! - Note that action is true if key is pressed, false if released
* \param[in] key_sym the key-name that caused the action
* \param[in] key the key code that caused the action
* \param[in] alt whether the alt key was pressed at the time where this event was triggered
* \param[in] ctrl whether the ctrl was pressed at the time where this event was triggered
* \param[in] shift whether the shift was pressed at the time where this event was triggered
*/
KeyboardEvent (bool action, const std::string& key_sym, unsigned char key, bool alt, bool ctrl, bool shift); KeyboardEvent (bool action, const std::string& key_sym, unsigned char key, bool alt, bool ctrl, bool shift);
bool isAltPressed () const; bool isAltPressed () const;
......
...@@ -18,11 +18,14 @@ namespace cv ...@@ -18,11 +18,14 @@ namespace cv
Widget& operator=(const Widget& other); Widget& operator=(const Widget& other);
~Widget(); ~Widget();
//! Create a widget directly from ply file
static Widget fromPlyFile(const String &file_name); static Widget fromPlyFile(const String &file_name);
//! Rendering properties of this particular widget
void setRenderingProperty(int property, double value); void setRenderingProperty(int property, double value);
double getRenderingProperty(int property) const; double getRenderingProperty(int property) const;
//! Casting between widgets
template<typename _W> _W cast(); template<typename _W> _W cast();
private: private:
class Impl; class Impl;
...@@ -120,7 +123,9 @@ namespace cv ...@@ -120,7 +123,9 @@ namespace cv
class CV_EXPORTS GridWidget : public Widget3D class CV_EXPORTS GridWidget : public Widget3D
{ {
public: public:
//! Creates grid at the origin
GridWidget(const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white()); GridWidget(const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
//! Creates grid based on the plane equation
GridWidget(const Vec4f &coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white()); GridWidget(const Vec4f &coeffs, const Vec2i &dimensions, const Vec2d &spacing, const Color &color = Color::white());
private: private:
...@@ -157,7 +162,9 @@ namespace cv ...@@ -157,7 +162,9 @@ namespace cv
class CV_EXPORTS Image3DWidget : public Widget3D class CV_EXPORTS Image3DWidget : public Widget3D
{ {
public: public:
//! Creates 3D image at the origin
Image3DWidget(const Mat &image, const Size &size); Image3DWidget(const Mat &image, const Size &size);
//! Creates 3D image at a given position, pointing in the direction of the normal, and having the up_vector orientation
Image3DWidget(const Vec3f &position, const Vec3f &normal, const Vec3f &up_vector, const Mat &image, const Size &size); Image3DWidget(const Vec3f &position, const Vec3f &normal, const Vec3f &up_vector, const Mat &image, const Size &size);
void setImage(const Mat &image); void setImage(const Mat &image);
...@@ -166,11 +173,14 @@ namespace cv ...@@ -166,11 +173,14 @@ namespace cv
class CV_EXPORTS CameraPositionWidget : public Widget3D class CV_EXPORTS CameraPositionWidget : public Widget3D
{ {
public: public:
//! Creates camera coordinate frame (axes) at the origin
CameraPositionWidget(double scale = 1.0); CameraPositionWidget(double scale = 1.0);
//! Creates frustum based on the intrinsic marix K at the origin
CameraPositionWidget(const Matx33f &K, double scale = 1.0, const Color &color = Color::white()); CameraPositionWidget(const Matx33f &K, double scale = 1.0, const Color &color = Color::white());
//! Creates frustum based on the field of view at the origin
CameraPositionWidget(const Vec2f &fov, double scale = 1.0, const Color &color = Color::white()); CameraPositionWidget(const Vec2f &fov, double scale = 1.0, const Color &color = Color::white());
//! Creates frustum and display given image at the far plane
CameraPositionWidget(const Matx33f &K, const Mat &img, double scale = 1.0, const Color &color = Color::white()); CameraPositionWidget(const Matx33f &K, const Mat &img, double scale = 1.0, const Color &color = Color::white());
}; };
class CV_EXPORTS TrajectoryWidget : public Widget3D class CV_EXPORTS TrajectoryWidget : public Widget3D
...@@ -178,9 +188,12 @@ namespace cv ...@@ -178,9 +188,12 @@ namespace cv
public: public:
enum {DISPLAY_FRAMES = 1, DISPLAY_PATH = 2}; enum {DISPLAY_FRAMES = 1, DISPLAY_PATH = 2};
//! Displays trajectory of the given path either by coordinate frames or polyline
TrajectoryWidget(const std::vector<Affine3f> &path, int display_mode = TrajectoryWidget::DISPLAY_PATH, const Color &color = Color::white(), double scale = 1.0); TrajectoryWidget(const std::vector<Affine3f> &path, int display_mode = TrajectoryWidget::DISPLAY_PATH, const Color &color = Color::white(), double scale = 1.0);
TrajectoryWidget(const std::vector<Affine3f> &path, const Matx33f &K, double scale = 1.0, const Color &color = Color::white()); // Camera frustums //! Displays trajectory of the given path by frustums
TrajectoryWidget(const std::vector<Affine3f> &path, const Vec2f &fov, double scale = 1.0, const Color &color = Color::white()); // Camera frustums TrajectoryWidget(const std::vector<Affine3f> &path, const Matx33f &K, double scale = 1.0, const Color &color = Color::white());
//! Displays trajectory of the given path by frustums
TrajectoryWidget(const std::vector<Affine3f> &path, const Vec2f &fov, double scale = 1.0, const Color &color = Color::white());
private: private:
struct ApplyPath; struct ApplyPath;
...@@ -196,7 +209,9 @@ namespace cv ...@@ -196,7 +209,9 @@ namespace cv
class CV_EXPORTS CloudWidget : public Widget3D class CV_EXPORTS CloudWidget : public Widget3D
{ {
public: public:
//! Each point in cloud is mapped to a color in colors
CloudWidget(InputArray cloud, InputArray colors); CloudWidget(InputArray cloud, InputArray colors);
//! All points in cloud have the same color
CloudWidget(InputArray cloud, const Color &color = Color::white()); CloudWidget(InputArray cloud, const Color &color = Color::white());
private: private:
...@@ -208,7 +223,9 @@ namespace cv ...@@ -208,7 +223,9 @@ namespace cv
public: public:
CloudCollectionWidget(); CloudCollectionWidget();
//! Each point in cloud is mapped to a color in colors
void addCloud(InputArray cloud, InputArray colors, const Affine3f &pose = Affine3f::Identity()); void addCloud(InputArray cloud, InputArray colors, const Affine3f &pose = Affine3f::Identity());
//! All points in cloud have the same color
void addCloud(InputArray cloud, const Color &color = Color::white(), const Affine3f &pose = Affine3f::Identity()); void addCloud(InputArray cloud, const Color &color = Color::white(), const Affine3f &pose = Affine3f::Identity());
private: private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment