initial shared pointer implementation for Viz3d, singleton VizAccessor, cv::viz::get function initial implementation

This commit is contained in:
ozantonkal
2013-08-19 20:09:47 +02:00
parent 52f141a5ba
commit 669abd58bc
6 changed files with 134 additions and 7 deletions

View File

@@ -58,13 +58,17 @@
namespace cv
{
namespace viz
{
{
typedef std::map<String, Viz3d> VizMap;
typedef std::pair<String, Viz3d> VizPair;
//! 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));
//! 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 Viz3d get(const String &window_name);
//! checks float value for Nan
inline bool isNan(float x)
@@ -87,6 +91,24 @@ namespace cv
//! checks point for Nans
template<typename _Tp> inline bool isNan(const Point3_<_Tp>& p)
{ return isNan(p.x) || isNan(p.y) || isNan(p.z); }
class CV_EXPORTS VizAccessor
{
public:
~VizAccessor();
static VizAccessor * getInstance();
Viz3d get(const String &window_name);
void add(Viz3d window);
void remove(const String &window_name);
private:
VizAccessor(); // Singleton
static VizAccessor * instance_;
static bool is_instantiated_;
static VizMap viz_map_;
};
}
}

View File

@@ -21,6 +21,8 @@ namespace cv
typedef void (*MouseCallback)(const MouseEvent&, void*);
Viz3d(const String& window_name = String());
Viz3d(const Viz3d&);
Viz3d& operator=(const Viz3d&);
~Viz3d();
void setBackgroundColor(const Color& color = Color::black());
@@ -50,6 +52,8 @@ namespace cv
Size getWindowSize() const;
void setWindowSize(const Size &window_size);
String getWindowName() const;
void spin();
void spinOnce(int time = 1, bool force_redraw = false);
@@ -58,11 +62,12 @@ namespace cv
void registerKeyboardCallback(KeyboardCallback callback, void* cookie = 0);
void registerMouseCallback(MouseCallback callback, void* cookie = 0);
private:
Viz3d(const Viz3d&);
Viz3d& operator=(const Viz3d&);
struct VizImpl;
VizImpl* impl_;
void create(const String &window_name);
void release();
};
} /* namespace viz */