CvTestbed.h
Go to the documentation of this file.
00001 #ifndef CVTESTBED_H
00002 #define CVTESTBED_H
00003 
00004 #include "Alvar.h"
00005 #include <vector>
00006 #include <string>
00007 #include "cv.h"
00008 #include "highgui.h"
00009 #include "CaptureFactory.h"
00010 
00011 using namespace alvar;
00012 
00066 class CvTestbed {
00067 protected:
00068     Capture *cap;
00070         CvTestbed();
00072         CvTestbed(const CvTestbed&);
00074         CvTestbed& operator=(const CvTestbed&);
00076         ~CvTestbed();
00078         bool running;
00079 
00081         void (*videocallback)(IplImage *image);
00083         int (*keycallback)(int key);
00085         std::string wintitle;
00087         std::string filename;
00089         struct Image {
00090                 IplImage *ipl;
00091                 std::string title;
00092                 bool visible;
00093                 bool release_at_exit;
00094                 Image(IplImage *_ipl, std::string _title, bool _visible, bool _release_at_exit)
00095                         :ipl(_ipl),title(_title),visible(_visible),release_at_exit(_release_at_exit) {}
00096         };
00098         std::vector<Image> images;
00099 
00101         static void default_videocallback(IplImage *image);
00103         void WaitKeys();
00105         void ShowVisibleImages();
00106 public:
00107         //CameraDescription camera_description;
00112         static CvTestbed& Instance();
00117         void SetVideoCallback(void (*_videocallback)(IplImage *image));
00127         void SetKeyCallback(int (*_keycallback)(int key));
00132         bool StartVideo(Capture *_cap, const char *_wintitle=0/*"Capture"*/);
00136         void StopVideo() { running = false; }
00143         size_t SetImage(const char *title, IplImage *ipl, bool release_at_exit=false);
00148         IplImage *CreateImage(const char *title, CvSize size, int depth, int channels);
00153         IplImage *CreateImageWithProto(const char *title, IplImage *proto, int depth=0, int channels=0);
00157         IplImage *GetImage(size_t index);
00161         size_t GetImageIndex(const char *title);
00165         IplImage *GetImage(const char *title);
00169         bool ToggleImageVisible(size_t index, int flags=1);
00170 };
00171 
00172 #endif


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Sat Dec 28 2013 16:46:15