1 /*M///////////////////////////////////////////////////////////////////////////////////////
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
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.
10 // Intel License Agreement
11 // For Open Source Computer Vision Library
13 // Copyright (C) 2000, Intel Corporation, all rights reserved.
14 // Third party copyrights are property of their respective owners.
16 // Redistribution and use in source and binary forms, with or without modification,
17 // are permitted provided that the following conditions are met:
19 // * Redistribution's of source code must retain the above copyright notice,
20 // this list of conditions and the following disclaimer.
22 // * Redistribution's in binary form must reproduce the above copyright notice,
23 // this list of conditions and the following disclaimer in the documentation
24 // and/or other materials provided with the distribution.
26 // * The name of Intel Corporation may not be used to endorse or promote products
27 // derived from this software without specific prior written permission.
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the Intel Corporation or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
47 #include "opencv2/highgui/highgui.hpp"
48 #include "opencv2/highgui/highgui_c.h"
49 #include "opencv2/imgproc/imgproc_c.h"
50 #include "opencv2/core/internal.hpp"
59 #if defined WIN32 || defined WINCE
67 #ifdef HAVE_TEGRA_OPTIMIZATION
68 #include "opencv2/highgui/highgui_tegra.hpp"
72 #define HG_OK 0 /* Don't bet on it! */
73 #define HG_BADNAME -1 /* Bad window or file name */
74 #define HG_INITFAILED -2 /* Can't initialize HigHGUI */
75 #define HG_WCFAILED -3 /* Can't create a window */
76 #define HG_NULLPTR -4 /* The null pointer where it should not appear */
77 #define HG_BADPARAM -5
79 #define __BEGIN__ __CV_BEGIN__
80 #define __END__ __CV_END__
81 #define EXIT __CV_EXIT__
83 #define CV_WINDOW_MAGIC_VAL 0x00420042
84 #define CV_TRACKBAR_MAGIC_VAL 0x00420043
86 /***************************** CvCapture structure ******************************/
90 virtual ~CvCapture() {}
91 virtual double getProperty(int) { return 0; }
92 virtual bool setProperty(int, double) { return 0; }
93 virtual bool grabFrame() { return true; }
94 virtual IplImage* retrieveFrame(int) { return 0; }
95 virtual int getCaptureDomain() { return CV_CAP_ANY; } // Return the type of the capture object: CV_CAP_VFW, etc...
98 /*************************** CvVideoWriter structure ****************************/
102 virtual ~CvVideoWriter() {}
103 virtual bool writeFrame(const IplImage*) { return false; }
106 CvCapture * cvCreateCameraCapture_V4L( int index );
107 CvCapture * cvCreateCameraCapture_DC1394( int index );
108 CvCapture * cvCreateCameraCapture_DC1394_2( int index );
109 CvCapture* cvCreateCameraCapture_MIL( int index );
110 CvCapture* cvCreateCameraCapture_Giganetix( int index );
111 CvCapture * cvCreateCameraCapture_CMU( int index );
112 CV_IMPL CvCapture * cvCreateCameraCapture_TYZX( int index );
113 CvCapture* cvCreateFileCapture_Win32( const char* filename );
114 CvCapture* cvCreateCameraCapture_VFW( int index );
115 CvCapture* cvCreateFileCapture_VFW( const char* filename );
116 CvVideoWriter* cvCreateVideoWriter_Win32( const char* filename, int fourcc,
117 double fps, CvSize frameSize, int is_color );
118 CvVideoWriter* cvCreateVideoWriter_VFW( const char* filename, int fourcc,
119 double fps, CvSize frameSize, int is_color );
120 CvCapture* cvCreateCameraCapture_DShow( int index );
121 CvCapture* cvCreateCameraCapture_MSMF( int index );
122 CvCapture* cvCreateCameraCapture_OpenNI( int index );
123 CvCapture* cvCreateFileCapture_OpenNI( const char* filename );
124 CvCapture* cvCreateCameraCapture_Android( int index );
125 CvCapture* cvCreateCameraCapture_XIMEA( int index );
126 CvCapture* cvCreateCameraCapture_AVFoundation(int index);
129 CVAPI(int) cvHaveImageReader(const char* filename);
130 CVAPI(int) cvHaveImageWriter(const char* filename);
132 CvCapture* cvCreateFileCapture_Images(const char* filename);
133 CvVideoWriter* cvCreateVideoWriter_Images(const char* filename);
135 CvCapture* cvCreateFileCapture_XINE (const char* filename);
140 #define CV_CAP_GSTREAMER_1394 0
141 #define CV_CAP_GSTREAMER_V4L 1
142 #define CV_CAP_GSTREAMER_V4L2 2
143 #define CV_CAP_GSTREAMER_FILE 3
145 CvCapture* cvCreateCapture_GStreamer(int type, const char *filename);
146 CvCapture* cvCreateFileCapture_FFMPEG_proxy(const char* filename);
149 CvVideoWriter* cvCreateVideoWriter_FFMPEG_proxy( const char* filename, int fourcc,
150 double fps, CvSize frameSize, int is_color );
152 CvCapture * cvCreateFileCapture_QT (const char * filename);
153 CvCapture * cvCreateCameraCapture_QT (const int index);
155 CvVideoWriter* cvCreateVideoWriter_QT ( const char* filename, int fourcc,
156 double fps, CvSize frameSize, int is_color );
158 CvCapture* cvCreateFileCapture_AVFoundation (const char * filename);
159 CvVideoWriter* cvCreateVideoWriter_AVFoundation( const char* filename, int fourcc,
160 double fps, CvSize frameSize, int is_color );
163 CvCapture * cvCreateCameraCapture_Unicap (const int index);
164 CvCapture * cvCreateCameraCapture_PvAPI (const int index);
165 CvVideoWriter* cvCreateVideoWriter_GStreamer( const char* filename, int fourcc,
166 double fps, CvSize frameSize, int is_color );
168 //Yannick Verdie 2010
169 void cvSetModeWindow_W32(const char* name, double prop_value);
170 void cvSetModeWindow_GTK(const char* name, double prop_value);
171 void cvSetModeWindow_CARBON(const char* name, double prop_value);
172 void cvSetModeWindow_COCOA(const char* name, double prop_value);
174 double cvGetModeWindow_W32(const char* name);
175 double cvGetModeWindow_GTK(const char* name);
176 double cvGetModeWindow_CARBON(const char* name);
177 double cvGetModeWindow_COCOA(const char* name);
179 double cvGetPropWindowAutoSize_W32(const char* name);
180 double cvGetPropWindowAutoSize_GTK(const char* name);
182 double cvGetRatioWindow_W32(const char* name);
183 double cvGetRatioWindow_GTK(const char* name);
185 double cvGetOpenGlProp_W32(const char* name);
186 double cvGetOpenGlProp_GTK(const char* name);
189 #if defined (HAVE_QT)
190 double cvGetModeWindow_QT(const char* name);
191 void cvSetModeWindow_QT(const char* name, double prop_value);
193 double cvGetPropWindow_QT(const char* name);
194 void cvSetPropWindow_QT(const char* name,double prop_value);
196 double cvGetRatioWindow_QT(const char* name);
197 void cvSetRatioWindow_QT(const char* name,double prop_value);
199 double cvGetOpenGlProp_QT(const char* name);
207 class CV_EXPORTS BaseWindow
210 BaseWindow(const String& name, int flags=0);
211 virtual ~BaseWindow();
212 virtual void close();
213 virtual void show(const Mat& mat);
214 virtual void resize(Size size);
215 virtual void move(Point topleft);
216 virtual Size size() const;
217 virtual Point topLeft() const;
218 virtual void setGeometry(Point topLeft, Size size);
219 virtual void getGeometry(Point& topLeft, Size& size) const;
220 virtual String getTitle() const;
221 virtual void setTitle(const String& str);
222 virtual String getName() const;
223 virtual void setScaleMode(int mode);
224 virtual int getScaleMode();
225 virtual void setScrollPos(double pos);
226 virtual double getScrollPos() const;
227 virtual void setScale(double scale);
228 virtual double getScale() const;
229 virtual Point getImageCoords(Point pos) const;
230 virtual Scalar getPixelValue(Point pos, const String& colorspace=String()) const;
232 virtual void addTrackbar( const String& trackbar, int low, int high, int step );
235 typedef Ptr<BaseWindow> Window;
239 #endif /* __HIGHGUI_H_ */