opencv 2.2.0
/usr/src/RPM/BUILD/libopencv2.2-2.2.0/modules/highgui/include/opencv2/highgui/highgui.hpp
Go to the documentation of this file.
00001 /*M///////////////////////////////////////////////////////////////////////////////////////
00002 //
00003 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
00004 //
00005 //  By downloading, copying, installing or using the software you agree to this license.
00006 //  If you do not agree to this license, do not download, install,
00007 //  copy or use the software.
00008 //
00009 //
00010 //                          License Agreement
00011 //                For Open Source Computer Vision Library
00012 //
00013 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
00014 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
00015 // Third party copyrights are property of their respective owners.
00016 //
00017 // Redistribution and use in source and binary forms, with or without modification,
00018 // are permitted provided that the following conditions are met:
00019 //
00020 //   * Redistribution's of source code must retain the above copyright notice,
00021 //     this list of conditions and the following disclaimer.
00022 //
00023 //   * Redistribution's in binary form must reproduce the above copyright notice,
00024 //     this list of conditions and the following disclaimer in the documentation
00025 //     and/or other materials provided with the distribution.
00026 //
00027 //   * The name of the copyright holders may not be used to endorse or promote products
00028 //     derived from this software without specific prior written permission.
00029 //
00030 // This software is provided by the copyright holders and contributors "as is" and
00031 // any express or implied warranties, including, but not limited to, the implied
00032 // warranties of merchantability and fitness for a particular purpose are disclaimed.
00033 // In no event shall the Intel Corporation or contributors be liable for any direct,
00034 // indirect, incidental, special, exemplary, or consequential damages
00035 // (including, but not limited to, procurement of substitute goods or services;
00036 // loss of use, data, or profits; or business interruption) however caused
00037 // and on any theory of liability, whether in contract, strict liability,
00038 // or tort (including negligence or otherwise) arising in any way out of
00039 // the use of this software, even if advised of the possibility of such damage.
00040 //
00041 //M*/
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 CV_DEFAULT(WINDOW_AUTOSIZE) );
00060 CV_EXPORTS_W void destroyWindow( const string& winname );
00061 CV_EXPORTS_W int startWindowThread();
00062 
00063 CV_EXPORTS_W void setWindowProperty(const string& winname, int prop_id, double prop_value);//YV
00064 CV_EXPORTS_W double getWindowProperty(const string& winname, int prop_id);//YV
00065 
00066 
00067 //Only for Qt
00068 //------------------------
00069 CV_EXPORTS CvFont fontQt(const string& nameFont, int pointSize CV_DEFAULT(-1), Scalar color CV_DEFAULT(Scalar::all(0)), int weight CV_DEFAULT(CV_FONT_NORMAL),  int style CV_DEFAULT(CV_STYLE_NORMAL), int spacing CV_DEFAULT(0));
00070 CV_EXPORTS void addText( const Mat& img, const string& text, Point org, CvFont font);
00071 
00072 CV_EXPORTS void displayOverlay(const string& winname, const string& text, int delayms);
00073 CV_EXPORTS void displayStatusBar(const string& winname, const string& text, int delayms);
00074 
00075 typedef void (CV_CDECL *OpenGLCallback)(void* userdata);
00076 CV_EXPORTS void createOpenGLCallback(const string& winname, CvOpenGLCallback callbackOpenGL, void* userdata CV_DEFAULT(0));
00077 
00078 CV_EXPORTS void saveWindowParameters(const string& windowName);
00079 CV_EXPORTS void loadWindowParameters(const string& windowName);
00080 CV_EXPORTS  int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
00081 CV_EXPORTS  void stopLoop();
00082 
00083 typedef void (CV_CDECL *ButtonCallback)(int state, void* userdata);
00084 CV_EXPORTS int createButton( const string& bar_name, ButtonCallback on_change , void* userdata CV_DEFAULT(NULL), int type CV_DEFAULT(CV_PUSH_BUTTON), bool initial_button_state CV_DEFAULT(0));
00085 //-------------------------
00086 
00087 CV_EXPORTS_W void imshow( const string& winname, const Mat& mat );
00088 
00089 typedef void (CV_CDECL *TrackbarCallback)(int pos, void* userdata);
00090 
00091 CV_EXPORTS int createTrackbar( const string& trackbarname, const string& winname,
00092                                int* value, int count,
00093                                TrackbarCallback onChange CV_DEFAULT(0),
00094                                void* userdata CV_DEFAULT(0));
00095 
00096 CV_EXPORTS_W int getTrackbarPos( const string& trackbarname, const string& winname );
00097 CV_EXPORTS_W void setTrackbarPos( const string& trackbarname, const string& winname, int pos );
00098 
00099 typedef void (*MouseCallback )(int event, int x, int y, int flags, void* param);
00100 
00102 CV_EXPORTS void setMouseCallback( const string& windowName, MouseCallback onMouse, void* param=0);
00103     
00104 CV_EXPORTS_W Mat imread( const string& filename, int flags=1 );
00105 CV_EXPORTS_W bool imwrite( const string& filename, const Mat& img,
00106               const vector<int>& params=vector<int>());
00107 CV_EXPORTS_W Mat imdecode( const Mat& buf, int flags );
00108 CV_EXPORTS_W bool imencode( const string& ext, const Mat& img,
00109                           CV_OUT vector<uchar>& buf,
00110                           const vector<int>& params=vector<int>());
00111 
00112 CV_EXPORTS_W int waitKey(int delay=0);
00113 
00114 #ifndef CV_NO_VIDEO_CAPTURE_CPP_API
00115 
00116 template<> void CV_EXPORTS Ptr<CvCapture>::delete_obj();
00117 template<> void CV_EXPORTS Ptr<CvVideoWriter>::delete_obj();
00118 
00119 class CV_EXPORTS_W VideoCapture
00120 {
00121 public:
00122     CV_WRAP VideoCapture();
00123     CV_WRAP VideoCapture(const string& filename);
00124     CV_WRAP VideoCapture(int device);
00125     
00126     virtual ~VideoCapture();
00127     CV_WRAP virtual bool open(const string& filename);
00128     CV_WRAP virtual bool open(int device);
00129     CV_WRAP virtual bool isOpened() const;
00130     CV_WRAP virtual void release();
00131     
00132     CV_WRAP virtual bool grab();
00133     CV_WRAP virtual bool retrieve(CV_OUT Mat& image, int channel=0);
00134     virtual VideoCapture& operator >> (CV_OUT Mat& image);
00135     CV_WRAP virtual bool read(CV_OUT Mat& image);
00136     
00137     CV_WRAP virtual bool set(int propId, double value);
00138     CV_WRAP virtual double get(int propId);
00139     
00140 protected:
00141     Ptr<CvCapture> cap;
00142 };
00143 
00144     
00145 class CV_EXPORTS_W VideoWriter
00146 {
00147 public:    
00148     CV_WRAP VideoWriter();
00149     CV_WRAP VideoWriter(const string& filename, int fourcc, double fps,
00150                 Size frameSize, bool isColor=true);
00151     
00152     virtual ~VideoWriter();
00153     CV_WRAP virtual bool open(const string& filename, int fourcc, double fps,
00154                       Size frameSize, bool isColor=true);
00155     CV_WRAP virtual bool isOpened() const;
00156     virtual VideoWriter& operator << (const Mat& image);
00157     CV_WRAP virtual void write(const Mat& image);
00158     
00159 protected:
00160     Ptr<CvVideoWriter> writer;
00161 };
00162 
00163 #endif
00164 
00165 }
00166 
00167 #endif
00168 
00169 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines