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 #ifndef __OPENCV_HIGHGUI_H__
00043 #define __OPENCV_HIGHGUI_H__
00044
00045 #include "opencv2/core/core_c.h"
00046 #if defined WIN32 || defined _WIN32
00047 #include <windows.h>
00048 #undef min
00049 #undef max
00050 #endif
00051
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055
00056
00057
00058
00059
00060
00061
00062 enum { CV_FONT_LIGHT = 25,
00063 CV_FONT_NORMAL = 50,
00064 CV_FONT_DEMIBOLD = 63,
00065 CV_FONT_BOLD = 75,
00066 CV_FONT_BLACK = 87
00067 };
00068
00069 enum { CV_STYLE_NORMAL = 0,
00070 CV_STYLE_ITALIC = 1,
00071 CV_STYLE_OBLIQUE = 2
00072 };
00073
00074
00075
00076
00077 CVAPI(CvFont) cvFontQt(const char* nameFont, int pointSize CV_DEFAULT(-1), CvScalar color CV_DEFAULT(cvScalarAll(0)), int weight CV_DEFAULT(CV_FONT_NORMAL), int style CV_DEFAULT(CV_STYLE_NORMAL), int spacing CV_DEFAULT(0));
00078
00079 CVAPI(void) cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont *arg2);
00080
00081 CVAPI(void) cvDisplayOverlay(const char* name, const char* text, int delayms);
00082 CVAPI(void) cvDisplayStatusBar(const char* name, const char* text, int delayms);
00083
00084 typedef void (CV_CDECL *CvOpenGLCallback)(void* userdata);
00085 CVAPI(void) cvCreateOpenGLCallback( const char* window_name, CvOpenGLCallback callbackOpenGL, void* userdata CV_DEFAULT(NULL), double angle CV_DEFAULT(-1), double zmin CV_DEFAULT(-1), double zmax CV_DEFAULT(-1));
00086
00087 CVAPI(void) cvSaveWindowParameters(const char* name);
00088 CVAPI(void) cvLoadWindowParameters(const char* name);
00089 CVAPI(int) cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
00090 CVAPI(void) cvStopLoop();
00091
00092 typedef void (CV_CDECL *CvButtonCallback)(int state, void* userdata);
00093 enum {CV_PUSH_BUTTON = 0, CV_CHECKBOX = 1, CV_RADIOBOX = 2};
00094 CVAPI(int) cvCreateButton( const char* button_name CV_DEFAULT(NULL),CvButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL) , int button_type CV_DEFAULT(CV_PUSH_BUTTON), int initial_button_state CV_DEFAULT(0));
00095
00096
00097
00098
00099 CVAPI(int) cvInitSystem( int argc, char** argv );
00100
00101 CVAPI(int) cvStartWindowThread();
00102
00103
00104 enum
00105 {
00106
00107 CV_WND_PROP_FULLSCREEN = 0,
00108 CV_WND_PROP_AUTOSIZE = 1,
00109 CV_WND_PROP_ASPECTRATIO= 2,
00110
00111
00112 CV_WINDOW_NORMAL = 0x00000000,
00113 CV_WINDOW_AUTOSIZE = 0x00000001,
00114
00115
00116 CV_GUI_EXPANDED = 0x00000000,
00117 CV_GUI_NORMAL = 0x00000010,
00118
00119
00120 CV_WINDOW_FULLSCREEN = 1,
00121 CV_WINDOW_FREERATIO = 0x00000100,
00122 CV_WINDOW_KEEPRATIO = 0x00000000
00123 };
00124
00125
00126 CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOSIZE) );
00127
00128
00129 CVAPI(void) cvSetWindowProperty(const char* name, int prop_id, double prop_value);
00130 CVAPI(double) cvGetWindowProperty(const char* name, int prop_id);
00131
00132
00133 CVAPI(void) cvShowImage( const char* name, const CvArr* image );
00134
00135
00136 CVAPI(void) cvResizeWindow( const char* name, int width, int height );
00137 CVAPI(void) cvMoveWindow( const char* name, int x, int y );
00138
00139
00140
00141 CVAPI(void) cvDestroyWindow( const char* name );
00142
00143 CVAPI(void) cvDestroyAllWindows(void);
00144
00145
00146 CVAPI(void*) cvGetWindowHandle( const char* name );
00147
00148
00149 CVAPI(const char*) cvGetWindowName( void* window_handle );
00150
00151
00152 typedef void (CV_CDECL *CvTrackbarCallback)(int pos);
00153
00154
00155 CVAPI(int) cvCreateTrackbar( const char* trackbar_name, const char* window_name,
00156 int* value, int count, CvTrackbarCallback on_change CV_DEFAULT(NULL));
00157
00158 typedef void (CV_CDECL *CvTrackbarCallback2)(int pos, void* userdata);
00159
00160 CVAPI(int) cvCreateTrackbar2( const char* trackbar_name, const char* window_name,
00161 int* value, int count, CvTrackbarCallback2 on_change,
00162 void* userdata CV_DEFAULT(0));
00163
00164
00165 CVAPI(int) cvGetTrackbarPos( const char* trackbar_name, const char* window_name );
00166 CVAPI(void) cvSetTrackbarPos( const char* trackbar_name, const char* window_name, int pos );
00167
00168 enum
00169 {
00170 CV_EVENT_MOUSEMOVE =0,
00171 CV_EVENT_LBUTTONDOWN =1,
00172 CV_EVENT_RBUTTONDOWN =2,
00173 CV_EVENT_MBUTTONDOWN =3,
00174 CV_EVENT_LBUTTONUP =4,
00175 CV_EVENT_RBUTTONUP =5,
00176 CV_EVENT_MBUTTONUP =6,
00177 CV_EVENT_LBUTTONDBLCLK =7,
00178 CV_EVENT_RBUTTONDBLCLK =8,
00179 CV_EVENT_MBUTTONDBLCLK =9
00180 };
00181
00182 enum
00183 {
00184 CV_EVENT_FLAG_LBUTTON =1,
00185 CV_EVENT_FLAG_RBUTTON =2,
00186 CV_EVENT_FLAG_MBUTTON =4,
00187 CV_EVENT_FLAG_CTRLKEY =8,
00188 CV_EVENT_FLAG_SHIFTKEY =16,
00189 CV_EVENT_FLAG_ALTKEY =32
00190 };
00191
00192 typedef void (CV_CDECL *CvMouseCallback )(int event, int x, int y, int flags, void* param);
00193
00194
00195 CVAPI(void) cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse,
00196 void* param CV_DEFAULT(NULL));
00197
00198 enum
00199 {
00200
00201 CV_LOAD_IMAGE_UNCHANGED =-1,
00202
00203 CV_LOAD_IMAGE_GRAYSCALE =0,
00204
00205 CV_LOAD_IMAGE_COLOR =1,
00206
00207 CV_LOAD_IMAGE_ANYDEPTH =2,
00208
00209 CV_LOAD_IMAGE_ANYCOLOR =4
00210 };
00211
00212
00213
00214
00215
00216
00217
00218 CVAPI(IplImage*) cvLoadImage( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
00219 CVAPI(CvMat*) cvLoadImageM( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
00220
00221 enum
00222 {
00223 CV_IMWRITE_JPEG_QUALITY =1,
00224 CV_IMWRITE_PNG_COMPRESSION =16,
00225 CV_IMWRITE_PXM_BINARY =32
00226 };
00227
00228
00229 CVAPI(int) cvSaveImage( const char* filename, const CvArr* image,
00230 const int* params CV_DEFAULT(0) );
00231
00232
00233 CVAPI(IplImage*) cvDecodeImage( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
00234 CVAPI(CvMat*) cvDecodeImageM( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
00235
00236
00237 CVAPI(CvMat*) cvEncodeImage( const char* ext, const CvArr* image,
00238 const int* params CV_DEFAULT(0) );
00239
00240 enum
00241 {
00242 CV_CVTIMG_FLIP =1,
00243 CV_CVTIMG_SWAP_RB =2
00244 };
00245
00246
00247 CVAPI(void) cvConvertImage( const CvArr* src, CvArr* dst, int flags CV_DEFAULT(0));
00248
00249
00250 CVAPI(int) cvWaitKey(int delay CV_DEFAULT(0));
00251
00252
00253
00254
00255
00256
00257 typedef struct CvCapture CvCapture;
00258
00259
00260 CVAPI(CvCapture*) cvCreateFileCapture( const char* filename );
00261
00262 enum
00263 {
00264 CV_CAP_ANY =0,
00265
00266 CV_CAP_MIL =100,
00267
00268 CV_CAP_VFW =200,
00269 CV_CAP_V4L =200,
00270 CV_CAP_V4L2 =200,
00271
00272 CV_CAP_FIREWARE =300,
00273 CV_CAP_FIREWIRE =300,
00274 CV_CAP_IEEE1394 =300,
00275 CV_CAP_DC1394 =300,
00276 CV_CAP_CMU1394 =300,
00277
00278 CV_CAP_STEREO =400,
00279 CV_CAP_TYZX =400,
00280 CV_TYZX_LEFT =400,
00281 CV_TYZX_RIGHT =401,
00282 CV_TYZX_COLOR =402,
00283 CV_TYZX_Z =403,
00284
00285 CV_CAP_QT =500,
00286
00287 CV_CAP_UNICAP =600,
00288
00289 CV_CAP_DSHOW =700,
00290
00291 CV_CAP_PVAPI =800
00292 };
00293
00294
00295 CVAPI(CvCapture*) cvCreateCameraCapture( int index );
00296
00297
00298
00299 CVAPI(int) cvGrabFrame( CvCapture* capture );
00300
00301
00302
00303
00304
00305 CVAPI(IplImage*) cvRetrieveFrame( CvCapture* capture, int streamIdx CV_DEFAULT(0) );
00306
00307
00308
00309 CVAPI(IplImage*) cvQueryFrame( CvCapture* capture );
00310
00311
00312 CVAPI(void) cvReleaseCapture( CvCapture** capture );
00313
00314 enum
00315 {
00316 CV_CAP_PROP_POS_MSEC =0,
00317 CV_CAP_PROP_POS_FRAMES =1,
00318 CV_CAP_PROP_POS_AVI_RATIO =2,
00319 CV_CAP_PROP_FRAME_WIDTH =3,
00320 CV_CAP_PROP_FRAME_HEIGHT =4,
00321 CV_CAP_PROP_FPS =5,
00322 CV_CAP_PROP_FOURCC =6,
00323 CV_CAP_PROP_FRAME_COUNT =7,
00324 CV_CAP_PROP_FORMAT =8,
00325 CV_CAP_PROP_MODE =9,
00326 CV_CAP_PROP_BRIGHTNESS =10,
00327 CV_CAP_PROP_CONTRAST =11,
00328 CV_CAP_PROP_SATURATION =12,
00329 CV_CAP_PROP_HUE =13,
00330 CV_CAP_PROP_GAIN =14,
00331 CV_CAP_PROP_EXPOSURE =15,
00332 CV_CAP_PROP_CONVERT_RGB =16,
00333 CV_CAP_PROP_WHITE_BALANCE =17,
00334 CV_CAP_PROP_RECTIFICATION =18,
00335 CV_CAP_PROP_MONOCROME =19
00336 };
00337
00338
00339 CVAPI(double) cvGetCaptureProperty( CvCapture* capture, int property_id );
00340 CVAPI(int) cvSetCaptureProperty( CvCapture* capture, int property_id, double value );
00341
00342
00343 CVAPI(int) cvGetCaptureDomain( CvCapture* capture);
00344
00345
00346 typedef struct CvVideoWriter CvVideoWriter;
00347
00348 CV_INLINE int CV_FOURCC(char c1, char c2, char c3, char c4)
00349 {
00350 return (c1 & 255) + ((c2 & 255) << 8) + ((c3 &255) << 16) + ((c4 & 255) << 24);
00351 }
00352
00353 #define CV_FOURCC_PROMPT -1
00354 #define CV_FOURCC_DEFAULT CV_FOURCC('I', 'Y', 'U', 'V')
00355
00356
00357 CVAPI(CvVideoWriter*) cvCreateVideoWriter( const char* filename, int fourcc,
00358 double fps, CvSize frame_size,
00359 int is_color CV_DEFAULT(1));
00360
00361
00362
00363
00364
00365 CVAPI(int) cvWriteFrame( CvVideoWriter* writer, const IplImage* image );
00366
00367
00368 CVAPI(void) cvReleaseVideoWriter( CvVideoWriter** writer );
00369
00370
00371
00372
00373
00374 #define cvCaptureFromFile cvCreateFileCapture
00375 #define cvCaptureFromCAM cvCreateCameraCapture
00376 #define cvCaptureFromAVI cvCaptureFromFile
00377 #define cvCreateAVIWriter cvCreateVideoWriter
00378 #define cvWriteToAVI cvWriteFrame
00379 #define cvAddSearchPath(path)
00380 #define cvvInitSystem cvInitSystem
00381 #define cvvNamedWindow cvNamedWindow
00382 #define cvvShowImage cvShowImage
00383 #define cvvResizeWindow cvResizeWindow
00384 #define cvvDestroyWindow cvDestroyWindow
00385 #define cvvCreateTrackbar cvCreateTrackbar
00386 #define cvvLoadImage(name) cvLoadImage((name),1)
00387 #define cvvSaveImage cvSaveImage
00388 #define cvvAddSearchPath cvAddSearchPath
00389 #define cvvWaitKey(name) cvWaitKey(0)
00390 #define cvvWaitKeyEx(name,delay) cvWaitKey(delay)
00391 #define cvvConvertImage cvConvertImage
00392 #define HG_AUTOSIZE CV_WINDOW_AUTOSIZE
00393 #define set_preprocess_func cvSetPreprocessFuncWin32
00394 #define set_postprocess_func cvSetPostprocessFuncWin32
00395
00396 #if defined WIN32 || defined _WIN32
00397
00398 typedef int (CV_CDECL * CvWin32WindowCallback)(HWND, UINT, WPARAM, LPARAM, int*);
00399 CVAPI(void) cvSetPreprocessFuncWin32( CvWin32WindowCallback on_preprocess );
00400 CVAPI(void) cvSetPostprocessFuncWin32( CvWin32WindowCallback on_postprocess );
00401
00402 #endif
00403
00404 #ifdef __cplusplus
00405 }
00406 #endif
00407
00408 #endif