opencv 2.2.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
highgui.hpp
Go to the documentation of this file.
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
8 //
9 //
10 // License Agreement
11 // For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15 // Third party copyrights are property of their respective owners.
16 //
17 // Redistribution and use in source and binary forms, with or without modification,
18 // are permitted provided that the following conditions are met:
19 //
20 // * Redistribution's of source code must retain the above copyright notice,
21 // this list of conditions and the following disclaimer.
22 //
23 // * Redistribution's in binary form must reproduce the above copyright notice,
24 // this list of conditions and the following disclaimer in the documentation
25 // and/or other materials provided with the distribution.
26 //
27 // * The name of the copyright holders may not be used to endorse or promote products
28 // derived from this software without specific prior written permission.
29 //
30 // This software is provided by the copyright holders and contributors "as is" and
31 // any express or implied warranties, including, but not limited to, the implied
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
34 // indirect, incidental, special, exemplary, or consequential damages
35 // (including, but not limited to, procurement of substitute goods or services;
36 // loss of use, data, or profits; or business interruption) however caused
37 // and on any theory of liability, whether in contract, strict liability,
38 // or tort (including negligence or otherwise) arising in any way out of
39 // the use of this software, even if advised of the possibility of such damage.
40 //
41 //M*/
42
43 #ifndef __OPENCV_HIGHGUI_HPP__
44 #define __OPENCV_HIGHGUI_HPP__
45
46 #include "opencv2/core/core.hpp"
47 #include "opencv2/highgui/highgui_c.h"
48
49 #ifdef __cplusplus
50
51 struct CvCapture;
52 struct CvVideoWriter;
53
54 namespace cv
55 {
56
57 enum { WINDOW_AUTOSIZE=1 };
58
59 CV_EXPORTS_W void namedWindow( const string& winname, int flags CV_DEFAULT(WINDOW_AUTOSIZE) );
60 CV_EXPORTS_W void destroyWindow( const string& winname );
61 CV_EXPORTS_W int startWindowThread();
62
63 CV_EXPORTS_W void setWindowProperty(const string& winname, int prop_id, double prop_value);//YV
64 CV_EXPORTS_W double getWindowProperty(const string& winname, int prop_id);//YV
65
66
67 //Only for Qt
68 //------------------------
69 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));
70 CV_EXPORTS void addText( const Mat& img, const string& text, Point org, CvFont font);
71
72 CV_EXPORTS void displayOverlay(const string& winname, const string& text, int delayms);
73 CV_EXPORTS void displayStatusBar(const string& winname, const string& text, int delayms);
74
75 typedef void (CV_CDECL *OpenGLCallback)(void* userdata);
76 CV_EXPORTS void createOpenGLCallback(const string& winname, CvOpenGLCallback callbackOpenGL, void* userdata CV_DEFAULT(0));
77
78 CV_EXPORTS void saveWindowParameters(const string& windowName);
79 CV_EXPORTS void loadWindowParameters(const string& windowName);
80 CV_EXPORTS int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
81 CV_EXPORTS void stopLoop();
82
83 typedef void (CV_CDECL *ButtonCallback)(int state, void* userdata);
84 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));
85 //-------------------------
86
87 CV_EXPORTS_W void imshow( const string& winname, const Mat& mat );
88
89 typedef void (CV_CDECL *TrackbarCallback)(int pos, void* userdata);
90
91 CV_EXPORTS int createTrackbar( const string& trackbarname, const string& winname,
92 int* value, int count,
93 TrackbarCallback onChange CV_DEFAULT(0),
94 void* userdata CV_DEFAULT(0));
95
96 CV_EXPORTS_W int getTrackbarPos( const string& trackbarname, const string& winname );
97 CV_EXPORTS_W void setTrackbarPos( const string& trackbarname, const string& winname, int pos );
98
99 typedef void (*MouseCallback )(int event, int x, int y, int flags, void* param);
100
102 CV_EXPORTS void setMouseCallback( const string& windowName, MouseCallback onMouse, void* param=0);
103
104 CV_EXPORTS_W Mat imread( const string& filename, int flags=1 );
105 CV_EXPORTS_W bool imwrite( const string& filename, const Mat& img,
106 const vector<int>& params=vector<int>());
107 CV_EXPORTS_W Mat imdecode( const Mat& buf, int flags );
108 CV_EXPORTS_W bool imencode( const string& ext, const Mat& img,
109 CV_OUT vector<uchar>& buf,
110 const vector<int>& params=vector<int>());
111
112 CV_EXPORTS_W int waitKey(int delay=0);
113
114 #ifndef CV_NO_VIDEO_CAPTURE_CPP_API
115
116 template<> void CV_EXPORTS Ptr<CvCapture>::delete_obj();
117 template<> void CV_EXPORTS Ptr<CvVideoWriter>::delete_obj();
118
119 class CV_EXPORTS_W VideoCapture
120 {
121 public:
122 CV_WRAP VideoCapture();
123 CV_WRAP VideoCapture(const string& filename);
124 CV_WRAP VideoCapture(int device);
125
126 virtual ~VideoCapture();
127 CV_WRAP virtual bool open(const string& filename);
128 CV_WRAP virtual bool open(int device);
129 CV_WRAP virtual bool isOpened() const;
130 CV_WRAP virtual void release();
131
132 CV_WRAP virtual bool grab();
133 CV_WRAP virtual bool retrieve(CV_OUT Mat& image, int channel=0);
134 virtual VideoCapture& operator >> (CV_OUT Mat& image);
135 CV_WRAP virtual bool read(CV_OUT Mat& image);
136
137 CV_WRAP virtual bool set(int propId, double value);
138 CV_WRAP virtual double get(int propId);
139
140 protected:
141 Ptr<CvCapture> cap;
142 };
143
144
145 class CV_EXPORTS_W VideoWriter
146 {
147 public:
148 CV_WRAP VideoWriter();
149 CV_WRAP VideoWriter(const string& filename, int fourcc, double fps,
150 Size frameSize, bool isColor=true);
151
152 virtual ~VideoWriter();
153 CV_WRAP virtual bool open(const string& filename, int fourcc, double fps,
154 Size frameSize, bool isColor=true);
155 CV_WRAP virtual bool isOpened() const;
156 virtual VideoWriter& operator << (const Mat& image);
157 CV_WRAP virtual void write(const Mat& image);
158
159 protected:
160 Ptr<CvVideoWriter> writer;
161 };
162
163 #endif
164
165 }
166
167 #endif
168
169 #endif