00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef __OPENCV_HIGHGUI_HPP__
00044 #define __OPENCV_HIGHGUI_HPP__
00045
00046 #include "opencv2/core/core.hpp"
00047 #include "opencv2/highgui/highgui_c.h"
00048
00049 #ifdef __cplusplus
00050
00051 struct CvCapture;
00052 struct CvVideoWriter;
00053
00054 namespace cv
00055 {
00056
00057 enum { WINDOW_AUTOSIZE=1 };
00058
00059 CV_EXPORTS_W void namedWindow( const string& winname, int flags=WINDOW_AUTOSIZE );
00060 CV_EXPORTS_W void destroyWindow( const string& winname );
00061 CV_EXPORTS_W void destroyAllWindows();
00062 CV_EXPORTS_W int startWindowThread();
00063
00064 CV_EXPORTS_W void setWindowProperty(const string& winname, int prop_id, double prop_value);
00065 CV_EXPORTS_W double getWindowProperty(const string& winname, int prop_id);
00066
00067
00068
00069
00070 CV_EXPORTS CvFont fontQt(const string& nameFont, int pointSize=-1,
00071 Scalar color=Scalar::all(0), int weight=CV_FONT_NORMAL,
00072 int style=CV_STYLE_NORMAL, int spacing=0);
00073 CV_EXPORTS void addText( const Mat& img, const string& text, Point org, CvFont font);
00074
00075 CV_EXPORTS void displayOverlay(const string& winname, const string& text, int delayms);
00076 CV_EXPORTS void displayStatusBar(const string& winname, const string& text, int delayms);
00077
00078 typedef void (CV_CDECL *OpenGLCallback)(void* userdata);
00079 CV_EXPORTS void createOpenGLCallback(const string& winname, CvOpenGLCallback callbackOpenGL, void* userdata=0);
00080
00081 CV_EXPORTS void saveWindowParameters(const string& windowName);
00082 CV_EXPORTS void loadWindowParameters(const string& windowName);
00083 CV_EXPORTS int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
00084 CV_EXPORTS void stopLoop();
00085
00086 typedef void (CV_CDECL *ButtonCallback)(int state, void* userdata);
00087 CV_EXPORTS int createButton( const string& bar_name, ButtonCallback on_change,
00088 void* userdata=NULL, int type=CV_PUSH_BUTTON,
00089 bool initial_button_state=0);
00090
00091
00092 CV_EXPORTS_W void imshow( const string& winname, InputArray mat );
00093
00094 typedef void (CV_CDECL *TrackbarCallback)(int pos, void* userdata);
00095
00096 CV_EXPORTS int createTrackbar( const string& trackbarname, const string& winname,
00097 int* value, int count,
00098 TrackbarCallback onChange=0,
00099 void* userdata=0);
00100
00101 CV_EXPORTS_W int getTrackbarPos( const string& trackbarname, const string& winname );
00102 CV_EXPORTS_W void setTrackbarPos( const string& trackbarname, const string& winname, int pos );
00103
00104 typedef void (*MouseCallback )(int event, int x, int y, int flags, void* param);
00105
00107 CV_EXPORTS void setMouseCallback( const string& windowName, MouseCallback onMouse, void* param=0);
00108
00109 CV_EXPORTS_W Mat imread( const string& filename, int flags=1 );
00110 CV_EXPORTS_W bool imwrite( const string& filename, InputArray img,
00111 const vector<int>& params=vector<int>());
00112 CV_EXPORTS_W Mat imdecode( InputArray buf, int flags );
00113 CV_EXPORTS_W bool imencode( const string& ext, InputArray img,
00114 vector<uchar>& buf,
00115 const vector<int>& params=vector<int>());
00116
00117 CV_EXPORTS_W int waitKey(int delay=0);
00118
00119 #ifndef CV_NO_VIDEO_CAPTURE_CPP_API
00120
00121 template<> void CV_EXPORTS Ptr<CvCapture>::delete_obj();
00122 template<> void CV_EXPORTS Ptr<CvVideoWriter>::delete_obj();
00123
00124 class CV_EXPORTS_W VideoCapture
00125 {
00126 public:
00127 CV_WRAP VideoCapture();
00128 CV_WRAP VideoCapture(const string& filename);
00129 CV_WRAP VideoCapture(int device);
00130
00131 virtual ~VideoCapture();
00132 CV_WRAP virtual bool open(const string& filename);
00133 CV_WRAP virtual bool open(int device);
00134 CV_WRAP virtual bool isOpened() const;
00135 CV_WRAP virtual void release();
00136
00137 CV_WRAP virtual bool grab();
00138 CV_WRAP virtual bool retrieve(CV_OUT Mat& image, int channel=0);
00139 virtual VideoCapture& operator >> (CV_OUT Mat& image);
00140 CV_WRAP virtual bool read(CV_OUT Mat& image);
00141
00142 CV_WRAP virtual bool set(int propId, double value);
00143 CV_WRAP virtual double get(int propId);
00144
00145 protected:
00146 Ptr<CvCapture> cap;
00147 };
00148
00149
00150 class CV_EXPORTS_W VideoWriter
00151 {
00152 public:
00153 CV_WRAP VideoWriter();
00154 CV_WRAP VideoWriter(const string& filename, int fourcc, double fps,
00155 Size frameSize, bool isColor=true);
00156
00157 virtual ~VideoWriter();
00158 CV_WRAP virtual bool open(const string& filename, int fourcc, double fps,
00159 Size frameSize, bool isColor=true);
00160 CV_WRAP virtual bool isOpened() const;
00161 virtual VideoWriter& operator << (const Mat& image);
00162 CV_WRAP virtual void write(const Mat& image);
00163
00164 protected:
00165 Ptr<CvVideoWriter> writer;
00166 };
00167
00168 #endif
00169
00170 }
00171
00172 #endif
00173
00174 #endif