temp_viz removed
This commit is contained in:
@@ -53,12 +53,15 @@
|
||||
#include <opencv2/viz/viz3d.hpp>
|
||||
|
||||
|
||||
namespace temp_viz
|
||||
namespace cv
|
||||
{
|
||||
//! 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));
|
||||
namespace viz
|
||||
{
|
||||
//! 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 makeCameraPose(const Vec3f& position, const Vec3f& focal_point, const Vec3f& up_vector);
|
||||
CV_EXPORTS Affine3f makeCameraPose(const Vec3f& position, const Vec3f& focal_point, const Vec3f& up_vector);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -3,79 +3,82 @@
|
||||
#include <string>
|
||||
#include <opencv2/viz/types.hpp>
|
||||
|
||||
namespace temp_viz
|
||||
namespace cv
|
||||
{
|
||||
class KeyboardEvent
|
||||
namespace viz
|
||||
{
|
||||
public:
|
||||
static const unsigned int Alt = 1;
|
||||
static const unsigned int Ctrl = 2;
|
||||
static const unsigned int Shift = 4;
|
||||
|
||||
/** \brief Constructor
|
||||
* \param[in] action true for key was pressed, false for 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);
|
||||
|
||||
bool isAltPressed () const;
|
||||
bool isCtrlPressed () const;
|
||||
bool isShiftPressed () const;
|
||||
|
||||
unsigned char getKeyCode () const;
|
||||
|
||||
const String& getKeySym () const;
|
||||
bool keyDown () const;
|
||||
bool keyUp () const;
|
||||
|
||||
protected:
|
||||
|
||||
bool action_;
|
||||
unsigned int modifiers_;
|
||||
unsigned char key_code_;
|
||||
String key_sym_;
|
||||
};
|
||||
|
||||
class MouseEvent
|
||||
{
|
||||
public:
|
||||
enum Type
|
||||
class KeyboardEvent
|
||||
{
|
||||
MouseMove = 1,
|
||||
MouseButtonPress,
|
||||
MouseButtonRelease,
|
||||
MouseScrollDown,
|
||||
MouseScrollUp,
|
||||
MouseDblClick
|
||||
} ;
|
||||
public:
|
||||
static const unsigned int Alt = 1;
|
||||
static const unsigned int Ctrl = 2;
|
||||
static const unsigned int Shift = 4;
|
||||
|
||||
enum MouseButton
|
||||
/** \brief Constructor
|
||||
* \param[in] action true for key was pressed, false for 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);
|
||||
|
||||
bool isAltPressed () const;
|
||||
bool isCtrlPressed () const;
|
||||
bool isShiftPressed () const;
|
||||
|
||||
unsigned char getKeyCode () const;
|
||||
|
||||
const String& getKeySym () const;
|
||||
bool keyDown () const;
|
||||
bool keyUp () const;
|
||||
|
||||
protected:
|
||||
|
||||
bool action_;
|
||||
unsigned int modifiers_;
|
||||
unsigned char key_code_;
|
||||
String key_sym_;
|
||||
};
|
||||
|
||||
class MouseEvent
|
||||
{
|
||||
NoButton = 0,
|
||||
LeftButton,
|
||||
MiddleButton,
|
||||
RightButton,
|
||||
VScroll /*other buttons, scroll wheels etc. may follow*/
|
||||
} ;
|
||||
public:
|
||||
enum Type
|
||||
{
|
||||
MouseMove = 1,
|
||||
MouseButtonPress,
|
||||
MouseButtonRelease,
|
||||
MouseScrollDown,
|
||||
MouseScrollUp,
|
||||
MouseDblClick
|
||||
} ;
|
||||
|
||||
MouseEvent (const Type& type, const MouseButton& button, const Point& p, bool alt, bool ctrl, bool shift);
|
||||
enum MouseButton
|
||||
{
|
||||
NoButton = 0,
|
||||
LeftButton,
|
||||
MiddleButton,
|
||||
RightButton,
|
||||
VScroll /*other buttons, scroll wheels etc. may follow*/
|
||||
} ;
|
||||
|
||||
MouseEvent (const Type& type, const MouseButton& button, const Point& p, bool alt, bool ctrl, bool shift);
|
||||
|
||||
|
||||
Type type;
|
||||
MouseButton button;
|
||||
Point pointer;
|
||||
unsigned int key_state;
|
||||
};
|
||||
Type type;
|
||||
MouseButton button;
|
||||
Point pointer;
|
||||
unsigned int key_state;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// Implementation
|
||||
|
||||
inline temp_viz::KeyboardEvent::KeyboardEvent (bool _action, const std::string& _key_sym, unsigned char key, bool alt, bool ctrl, bool shift)
|
||||
inline cv::viz::KeyboardEvent::KeyboardEvent (bool _action, const std::string& _key_sym, unsigned char key, bool alt, bool ctrl, bool shift)
|
||||
: action_ (_action), modifiers_ (0), key_code_(key), key_sym_ (_key_sym)
|
||||
{
|
||||
if (alt)
|
||||
@@ -88,15 +91,15 @@ inline temp_viz::KeyboardEvent::KeyboardEvent (bool _action, const std::string&
|
||||
modifiers_ |= Shift;
|
||||
}
|
||||
|
||||
inline bool temp_viz::KeyboardEvent::isAltPressed () const { return (modifiers_ & Alt) != 0; }
|
||||
inline bool temp_viz::KeyboardEvent::isCtrlPressed () const { return (modifiers_ & Ctrl) != 0; }
|
||||
inline bool temp_viz::KeyboardEvent::isShiftPressed () const { return (modifiers_ & Shift) != 0; }
|
||||
inline unsigned char temp_viz::KeyboardEvent::getKeyCode () const { return key_code_; }
|
||||
inline const temp_viz::String& temp_viz::KeyboardEvent::getKeySym () const { return key_sym_; }
|
||||
inline bool temp_viz::KeyboardEvent::keyDown () const { return action_; }
|
||||
inline bool temp_viz::KeyboardEvent::keyUp () const { return !action_; }
|
||||
inline bool cv::viz::KeyboardEvent::isAltPressed () const { return (modifiers_ & Alt) != 0; }
|
||||
inline bool cv::viz::KeyboardEvent::isCtrlPressed () const { return (modifiers_ & Ctrl) != 0; }
|
||||
inline bool cv::viz::KeyboardEvent::isShiftPressed () const { return (modifiers_ & Shift) != 0; }
|
||||
inline unsigned char cv::viz::KeyboardEvent::getKeyCode () const { return key_code_; }
|
||||
inline const cv::String& cv::viz::KeyboardEvent::getKeySym () const { return key_sym_; }
|
||||
inline bool cv::viz::KeyboardEvent::keyDown () const { return action_; }
|
||||
inline bool cv::viz::KeyboardEvent::keyUp () const { return !action_; }
|
||||
|
||||
inline temp_viz::MouseEvent::MouseEvent (const Type& _type, const MouseButton& _button, const Point& _p, bool alt, bool ctrl, bool shift)
|
||||
inline cv::viz::MouseEvent::MouseEvent (const Type& _type, const MouseButton& _button, const Point& _p, bool alt, bool ctrl, bool shift)
|
||||
: type(_type), button(_button), pointer(_p), key_state(0)
|
||||
{
|
||||
if (alt)
|
||||
|
@@ -5,105 +5,109 @@
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/core/affine.hpp>
|
||||
|
||||
namespace temp_viz
|
||||
namespace cv
|
||||
{
|
||||
//qt creator hack
|
||||
typedef cv::Scalar Scalar;
|
||||
typedef cv::Mat Mat;
|
||||
typedef std::string String;
|
||||
// //qt creator hack
|
||||
// typedef cv::Scalar Scalar;
|
||||
// typedef cv::Mat Mat;
|
||||
// typedef std::string String;
|
||||
|
||||
typedef cv::Vec3d Vec3d;
|
||||
typedef cv::Vec3f Vec3f;
|
||||
typedef cv::Vec4d Vec4d;
|
||||
typedef cv::Vec4f Vec4f;
|
||||
typedef cv::Vec2d Vec2d;
|
||||
typedef cv::Vec2i Vec2i;
|
||||
typedef cv::Vec3b Vec3b;
|
||||
typedef cv::Matx33d Matx33d;
|
||||
typedef cv::Affine3f Affine3f;
|
||||
typedef cv::Affine3d Affine3d;
|
||||
typedef cv::Point2i Point2i;
|
||||
typedef cv::Point3f Point3f;
|
||||
typedef cv::Point3d Point3d;
|
||||
typedef cv::Matx44d Matx44d;
|
||||
typedef cv::Matx44f Matx44f;
|
||||
typedef cv::Size Size;
|
||||
typedef cv::Point Point;
|
||||
typedef cv::InputArray InputArray;
|
||||
using cv::Point3_;
|
||||
using cv::Vec;
|
||||
using cv::Mat_;
|
||||
using cv::DataDepth;
|
||||
using cv::DataType;
|
||||
|
||||
class CV_EXPORTS Color : public Scalar
|
||||
// typedef cv::Vec3d Vec3d;
|
||||
// typedef cv::Vec3f Vec3f;
|
||||
// typedef cv::Vec4d Vec4d;
|
||||
// typedef cv::Vec4f Vec4f;
|
||||
// typedef cv::Vec2d Vec2d;
|
||||
// typedef cv::Vec2i Vec2i;
|
||||
// typedef cv::Vec3b Vec3b;
|
||||
// typedef cv::Matx33d Matx33d;
|
||||
// typedef cv::Affine3f Affine3f;
|
||||
// typedef cv::Affine3d Affine3d;
|
||||
// typedef cv::Point2i Point2i;
|
||||
// typedef cv::Point3f Point3f;
|
||||
// typedef cv::Point3d Point3d;
|
||||
// typedef cv::Matx44d Matx44d;
|
||||
// typedef cv::Matx44f Matx44f;
|
||||
// typedef cv::Size Size;
|
||||
// typedef cv::Point Point;
|
||||
// typedef cv::InputArray InputArray;
|
||||
// using cv::Point3_;
|
||||
// using cv::Vec;
|
||||
// using cv::Mat_;
|
||||
// using cv::DataDepth;
|
||||
// using cv::DataType;
|
||||
// using cv::Ptr;
|
||||
namespace viz
|
||||
{
|
||||
public:
|
||||
Color();
|
||||
Color(double gray);
|
||||
Color(double blue, double green, double red);
|
||||
class CV_EXPORTS Color : public Scalar
|
||||
{
|
||||
public:
|
||||
Color();
|
||||
Color(double gray);
|
||||
Color(double blue, double green, double red);
|
||||
|
||||
Color(const Scalar& color);
|
||||
Color(const Scalar& color);
|
||||
|
||||
static Color black();
|
||||
static Color blue();
|
||||
static Color green();
|
||||
static Color cyan();
|
||||
static Color black();
|
||||
static Color blue();
|
||||
static Color green();
|
||||
static Color cyan();
|
||||
|
||||
static Color red();
|
||||
static Color magenta();
|
||||
static Color yellow();
|
||||
static Color white();
|
||||
static Color red();
|
||||
static Color magenta();
|
||||
static Color yellow();
|
||||
static Color white();
|
||||
|
||||
static Color gray();
|
||||
};
|
||||
static Color gray();
|
||||
};
|
||||
|
||||
|
||||
struct CV_EXPORTS Vertices
|
||||
{
|
||||
std::vector<unsigned int> vertices;
|
||||
};
|
||||
struct CV_EXPORTS Vertices
|
||||
{
|
||||
std::vector<unsigned int> vertices;
|
||||
};
|
||||
|
||||
class CV_EXPORTS Mesh3d
|
||||
{
|
||||
public:
|
||||
typedef Ptr<Mesh3d> Ptr;
|
||||
class CV_EXPORTS Mesh3d
|
||||
{
|
||||
public:
|
||||
typedef Ptr<Mesh3d> Ptr;
|
||||
|
||||
Mat cloud, colors;
|
||||
std::vector<Vertices> polygons;
|
||||
Mat cloud, colors;
|
||||
std::vector<Vertices> polygons;
|
||||
|
||||
static Mesh3d::Ptr mesh_load(const String& file);
|
||||
static Mesh3d::Ptr mesh_load(const String& file);
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/// Utility functions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/// Utility functions
|
||||
|
||||
inline Color vtkcolor(const Color& color)
|
||||
{
|
||||
Color scaled_color = color * (1.0/255.0);
|
||||
std::swap(scaled_color[0], scaled_color[2]);
|
||||
return scaled_color;
|
||||
inline Color vtkcolor(const Color& color)
|
||||
{
|
||||
Color scaled_color = color * (1.0/255.0);
|
||||
std::swap(scaled_color[0], scaled_color[2]);
|
||||
return scaled_color;
|
||||
}
|
||||
|
||||
inline Vec3d vtkpoint(const Point3f& point) { return Vec3d(point.x, point.y, point.z); }
|
||||
template<typename _Tp> inline _Tp normalized(const _Tp& v) { return v * 1/cv::norm(v); }
|
||||
|
||||
inline bool isNan(float x)
|
||||
{
|
||||
unsigned int *u = reinterpret_cast<unsigned int *>(&x);
|
||||
return ((u[0] & 0x7f800000) == 0x7f800000) && (u[0] & 0x007fffff);
|
||||
}
|
||||
|
||||
inline bool isNan(double x)
|
||||
{
|
||||
unsigned int *u = reinterpret_cast<unsigned int *>(&x);
|
||||
return (u[1] & 0x7ff00000) == 0x7ff00000 && (u[0] != 0 || (u[1] & 0x000fffff) != 0);
|
||||
}
|
||||
|
||||
template<typename _Tp, int cn> inline bool isNan(const Vec<_Tp, cn>& v)
|
||||
{ return isNan(v.val[0]) || isNan(v.val[1]) || isNan(v.val[2]); }
|
||||
|
||||
template<typename _Tp> inline bool isNan(const Point3_<_Tp>& p)
|
||||
{ return isNan(p.x) || isNan(p.y) || isNan(p.z); }
|
||||
}
|
||||
|
||||
inline Vec3d vtkpoint(const Point3f& point) { return Vec3d(point.x, point.y, point.z); }
|
||||
template<typename _Tp> inline _Tp normalized(const _Tp& v) { return v * 1/cv::norm(v); }
|
||||
|
||||
inline bool isNan(float x)
|
||||
{
|
||||
unsigned int *u = reinterpret_cast<unsigned int *>(&x);
|
||||
return ((u[0] & 0x7f800000) == 0x7f800000) && (u[0] & 0x007fffff);
|
||||
}
|
||||
|
||||
inline bool isNan(double x)
|
||||
{
|
||||
unsigned int *u = reinterpret_cast<unsigned int *>(&x);
|
||||
return (u[1] & 0x7ff00000) == 0x7ff00000 && (u[0] != 0 || (u[1] & 0x000fffff) != 0);
|
||||
}
|
||||
|
||||
template<typename _Tp, int cn> inline bool isNan(const Vec<_Tp, cn>& v)
|
||||
{ return isNan(v.val[0]) || isNan(v.val[1]) || isNan(v.val[2]); }
|
||||
|
||||
template<typename _Tp> inline bool isNan(const Point3_<_Tp>& p)
|
||||
{ return isNan(p.x) || isNan(p.y) || isNan(p.z); }
|
||||
}
|
||||
|
@@ -13,48 +13,51 @@
|
||||
#include <opencv2/viz/widgets.hpp>
|
||||
#include <opencv2/viz/events.hpp>
|
||||
|
||||
namespace temp_viz
|
||||
namespace cv
|
||||
{
|
||||
class CV_EXPORTS Viz3d
|
||||
namespace viz
|
||||
{
|
||||
public:
|
||||
class CV_EXPORTS Viz3d
|
||||
{
|
||||
public:
|
||||
|
||||
typedef cv::Ptr<Viz3d> Ptr;
|
||||
typedef cv::Ptr<Viz3d> Ptr;
|
||||
|
||||
Viz3d(const String& window_name = String());
|
||||
~Viz3d();
|
||||
Viz3d(const String& window_name = String());
|
||||
~Viz3d();
|
||||
|
||||
void setBackgroundColor(const Color& color = Color::black());
|
||||
void setBackgroundColor(const Color& color = Color::black());
|
||||
|
||||
bool addPolygonMesh (const Mesh3d& mesh, const String& id = "polygon");
|
||||
bool updatePolygonMesh (const Mesh3d& mesh, const String& id = "polygon");
|
||||
bool addPolygonMesh (const Mesh3d& mesh, const String& id = "polygon");
|
||||
bool updatePolygonMesh (const Mesh3d& mesh, const String& id = "polygon");
|
||||
|
||||
bool addPolylineFromPolygonMesh (const Mesh3d& mesh, const String& id = "polyline");
|
||||
bool addPolylineFromPolygonMesh (const Mesh3d& mesh, const String& id = "polyline");
|
||||
|
||||
bool addPolygon(const Mat& cloud, const Color& color, const String& id = "polygon");
|
||||
bool addPolygon(const Mat& cloud, const Color& color, const String& id = "polygon");
|
||||
|
||||
void spin ();
|
||||
void spinOnce (int time = 1, bool force_redraw = false);
|
||||
void spin ();
|
||||
void spinOnce (int time = 1, bool force_redraw = false);
|
||||
|
||||
void registerKeyboardCallback(void (*callback)(const KeyboardEvent&, void*), void* cookie = 0);
|
||||
void registerMouseCallback(void (*callback)(const MouseEvent&, void*), void* cookie = 0);
|
||||
void registerKeyboardCallback(void (*callback)(const KeyboardEvent&, void*), void* cookie = 0);
|
||||
void registerMouseCallback(void (*callback)(const MouseEvent&, void*), void* cookie = 0);
|
||||
|
||||
bool wasStopped() const;
|
||||
|
||||
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:
|
||||
Viz3d(const Viz3d&);
|
||||
Viz3d& operator=(const Viz3d&);
|
||||
bool wasStopped() const;
|
||||
|
||||
struct VizImpl;
|
||||
VizImpl* impl_;
|
||||
};
|
||||
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:
|
||||
Viz3d(const Viz3d&);
|
||||
Viz3d& operator=(const Viz3d&);
|
||||
|
||||
struct VizImpl;
|
||||
VizImpl* impl_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -4,15 +4,18 @@
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkProp.h>
|
||||
|
||||
namespace temp_viz
|
||||
namespace cv
|
||||
{
|
||||
class Widget;
|
||||
|
||||
//The class is only that depends on VTK in its interface.
|
||||
//It is indended for those users who want to develop own widgets system using VTK library API.
|
||||
struct CV_EXPORTS WidgetAccessor
|
||||
namespace viz
|
||||
{
|
||||
static vtkSmartPointer<vtkProp> getProp(const Widget &widget);
|
||||
static void setProp(Widget &widget, vtkSmartPointer<vtkProp> prop);
|
||||
};
|
||||
class Widget;
|
||||
|
||||
//The class is only that depends on VTK in its interface.
|
||||
//It is indended for those users who want to develop own widgets system using VTK library API.
|
||||
struct CV_EXPORTS WidgetAccessor
|
||||
{
|
||||
static vtkSmartPointer<vtkProp> getProp(const Widget &widget);
|
||||
static void setProp(Widget &widget, vtkSmartPointer<vtkProp> prop);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -3,178 +3,182 @@
|
||||
#include <opencv2/viz/types.hpp>
|
||||
|
||||
|
||||
namespace temp_viz
|
||||
namespace cv
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/// The base class for all widgets
|
||||
class CV_EXPORTS Widget
|
||||
namespace viz
|
||||
{
|
||||
public:
|
||||
Widget();
|
||||
Widget(const Widget &other);
|
||||
Widget& operator =(const Widget &other);
|
||||
|
||||
~Widget();
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/// The base class for all widgets
|
||||
class CV_EXPORTS Widget
|
||||
{
|
||||
public:
|
||||
Widget();
|
||||
Widget(const Widget &other);
|
||||
Widget& operator =(const Widget &other);
|
||||
|
||||
template<typename _W> _W cast();
|
||||
private:
|
||||
class Impl;
|
||||
Impl *impl_;
|
||||
friend struct WidgetAccessor;
|
||||
|
||||
void create();
|
||||
void release();
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/// The base class for all 3D widgets
|
||||
class CV_EXPORTS Widget3D : public Widget
|
||||
{
|
||||
public:
|
||||
Widget3D() {}
|
||||
|
||||
void setPose(const Affine3f &pose);
|
||||
void updatePose(const Affine3f &pose);
|
||||
Affine3f getPose() const;
|
||||
|
||||
void setColor(const Color &color);
|
||||
|
||||
private:
|
||||
struct MatrixConverter;
|
||||
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/// The base class for all 2D widgets
|
||||
class CV_EXPORTS Widget2D : public Widget
|
||||
{
|
||||
public:
|
||||
Widget2D() {}
|
||||
|
||||
void setColor(const Color &color);
|
||||
};
|
||||
|
||||
class CV_EXPORTS LineWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white());
|
||||
|
||||
void setLineWidth(float line_width);
|
||||
float getLineWidth();
|
||||
};
|
||||
~Widget();
|
||||
|
||||
class CV_EXPORTS PlaneWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
PlaneWidget(const Vec4f& coefs, double size = 1.0, const Color &color = Color::white());
|
||||
PlaneWidget(const Vec4f& coefs, const Point3f& pt, double size = 1.0, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS SphereWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
SphereWidget(const cv::Point3f ¢er, float radius, int sphere_resolution = 10, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS ArrowWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
ArrowWidget(const Point3f& pt1, const Point3f& pt2, const Color &color = Color::white());
|
||||
};
|
||||
template<typename _W> _W cast();
|
||||
private:
|
||||
class Impl;
|
||||
Impl *impl_;
|
||||
friend struct WidgetAccessor;
|
||||
|
||||
class CV_EXPORTS CircleWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
CircleWidget(const Point3f& pt, double radius, double thickness = 0.01, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS CylinderWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
CylinderWidget(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides = 30, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS CubeWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame = true, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS CoordinateSystemWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
CoordinateSystemWidget(double scale = 1.0);
|
||||
};
|
||||
|
||||
class CV_EXPORTS PolyLineWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
PolyLineWidget(InputArray points, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
struct CopyImpl;
|
||||
};
|
||||
|
||||
class CV_EXPORTS GridWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
GridWidget(Vec2i dimensions, Vec2d spacing, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS Text3DWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
Text3DWidget(const String &text, const Point3f &position, double text_scale = 1.0, const Color &color = Color::white());
|
||||
|
||||
void setText(const String &text);
|
||||
String getText() const;
|
||||
};
|
||||
|
||||
class CV_EXPORTS TextWidget : public Widget2D
|
||||
{
|
||||
public:
|
||||
TextWidget(const String &text, const Point2i &pos, int font_size = 10, const Color &color = Color::white());
|
||||
|
||||
void setText(const String &text);
|
||||
String getText() const;
|
||||
};
|
||||
|
||||
class CV_EXPORTS CloudWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
CloudWidget(InputArray cloud, InputArray colors);
|
||||
CloudWidget(InputArray cloud, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
struct CreateCloudWidget;
|
||||
};
|
||||
|
||||
class CV_EXPORTS CloudNormalsWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
CloudNormalsWidget(InputArray cloud, InputArray normals, int level = 100, float scale = 0.02f, const Color &color = Color::white());
|
||||
void create();
|
||||
void release();
|
||||
};
|
||||
|
||||
private:
|
||||
struct ApplyCloudNormals;
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/// The base class for all 3D widgets
|
||||
class CV_EXPORTS Widget3D : public Widget
|
||||
{
|
||||
public:
|
||||
Widget3D() {}
|
||||
|
||||
template<> CV_EXPORTS Widget2D Widget::cast<Widget2D>();
|
||||
template<> CV_EXPORTS Widget3D Widget::cast<Widget3D>();
|
||||
template<> CV_EXPORTS LineWidget Widget::cast<LineWidget>();
|
||||
template<> CV_EXPORTS PlaneWidget Widget::cast<PlaneWidget>();
|
||||
template<> CV_EXPORTS SphereWidget Widget::cast<SphereWidget>();
|
||||
template<> CV_EXPORTS CylinderWidget Widget::cast<CylinderWidget>();
|
||||
template<> CV_EXPORTS ArrowWidget Widget::cast<ArrowWidget>();
|
||||
template<> CV_EXPORTS CircleWidget Widget::cast<CircleWidget>();
|
||||
template<> CV_EXPORTS CubeWidget Widget::cast<CubeWidget>();
|
||||
template<> CV_EXPORTS CoordinateSystemWidget Widget::cast<CoordinateSystemWidget>();
|
||||
template<> CV_EXPORTS PolyLineWidget Widget::cast<PolyLineWidget>();
|
||||
template<> CV_EXPORTS GridWidget Widget::cast<GridWidget>();
|
||||
template<> CV_EXPORTS Text3DWidget Widget::cast<Text3DWidget>();
|
||||
template<> CV_EXPORTS TextWidget Widget::cast<TextWidget>();
|
||||
template<> CV_EXPORTS CloudWidget Widget::cast<CloudWidget>();
|
||||
template<> CV_EXPORTS CloudNormalsWidget Widget::cast<CloudNormalsWidget>();
|
||||
}
|
||||
void setPose(const Affine3f &pose);
|
||||
void updatePose(const Affine3f &pose);
|
||||
Affine3f getPose() const;
|
||||
|
||||
void setColor(const Color &color);
|
||||
|
||||
private:
|
||||
struct MatrixConverter;
|
||||
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/// The base class for all 2D widgets
|
||||
class CV_EXPORTS Widget2D : public Widget
|
||||
{
|
||||
public:
|
||||
Widget2D() {}
|
||||
|
||||
void setColor(const Color &color);
|
||||
};
|
||||
|
||||
class CV_EXPORTS LineWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white());
|
||||
|
||||
void setLineWidth(float line_width);
|
||||
float getLineWidth();
|
||||
};
|
||||
|
||||
class CV_EXPORTS PlaneWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
PlaneWidget(const Vec4f& coefs, double size = 1.0, const Color &color = Color::white());
|
||||
PlaneWidget(const Vec4f& coefs, const Point3f& pt, double size = 1.0, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS SphereWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
SphereWidget(const cv::Point3f ¢er, float radius, int sphere_resolution = 10, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS ArrowWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
ArrowWidget(const Point3f& pt1, const Point3f& pt2, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS CircleWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
CircleWidget(const Point3f& pt, double radius, double thickness = 0.01, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS CylinderWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
CylinderWidget(const Point3f& pt_on_axis, const Point3f& axis_direction, double radius, int numsides = 30, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS CubeWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame = true, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS CoordinateSystemWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
CoordinateSystemWidget(double scale = 1.0);
|
||||
};
|
||||
|
||||
class CV_EXPORTS PolyLineWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
PolyLineWidget(InputArray points, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
struct CopyImpl;
|
||||
};
|
||||
|
||||
class CV_EXPORTS GridWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
GridWidget(Vec2i dimensions, Vec2d spacing, const Color &color = Color::white());
|
||||
};
|
||||
|
||||
class CV_EXPORTS Text3DWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
Text3DWidget(const String &text, const Point3f &position, double text_scale = 1.0, const Color &color = Color::white());
|
||||
|
||||
void setText(const String &text);
|
||||
String getText() const;
|
||||
};
|
||||
|
||||
class CV_EXPORTS TextWidget : public Widget2D
|
||||
{
|
||||
public:
|
||||
TextWidget(const String &text, const Point2i &pos, int font_size = 10, const Color &color = Color::white());
|
||||
|
||||
void setText(const String &text);
|
||||
String getText() const;
|
||||
};
|
||||
|
||||
class CV_EXPORTS CloudWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
CloudWidget(InputArray cloud, InputArray colors);
|
||||
CloudWidget(InputArray cloud, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
struct CreateCloudWidget;
|
||||
};
|
||||
|
||||
class CV_EXPORTS CloudNormalsWidget : public Widget3D
|
||||
{
|
||||
public:
|
||||
CloudNormalsWidget(InputArray cloud, InputArray normals, int level = 100, float scale = 0.02f, const Color &color = Color::white());
|
||||
|
||||
private:
|
||||
struct ApplyCloudNormals;
|
||||
};
|
||||
|
||||
template<> CV_EXPORTS Widget2D Widget::cast<Widget2D>();
|
||||
template<> CV_EXPORTS Widget3D Widget::cast<Widget3D>();
|
||||
template<> CV_EXPORTS LineWidget Widget::cast<LineWidget>();
|
||||
template<> CV_EXPORTS PlaneWidget Widget::cast<PlaneWidget>();
|
||||
template<> CV_EXPORTS SphereWidget Widget::cast<SphereWidget>();
|
||||
template<> CV_EXPORTS CylinderWidget Widget::cast<CylinderWidget>();
|
||||
template<> CV_EXPORTS ArrowWidget Widget::cast<ArrowWidget>();
|
||||
template<> CV_EXPORTS CircleWidget Widget::cast<CircleWidget>();
|
||||
template<> CV_EXPORTS CubeWidget Widget::cast<CubeWidget>();
|
||||
template<> CV_EXPORTS CoordinateSystemWidget Widget::cast<CoordinateSystemWidget>();
|
||||
template<> CV_EXPORTS PolyLineWidget Widget::cast<PolyLineWidget>();
|
||||
template<> CV_EXPORTS GridWidget Widget::cast<GridWidget>();
|
||||
template<> CV_EXPORTS Text3DWidget Widget::cast<Text3DWidget>();
|
||||
template<> CV_EXPORTS TextWidget Widget::cast<TextWidget>();
|
||||
template<> CV_EXPORTS CloudWidget Widget::cast<CloudWidget>();
|
||||
template<> CV_EXPORTS CloudNormalsWidget Widget::cast<CloudNormalsWidget>();
|
||||
|
||||
} /* namespace viz */
|
||||
} /* namespace cv */
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user