opencv: /usr/ports/pobj/OpenCV-2.2.0/OpenCV-2.2.0/modules/highgui/include/opencv2/highgui/highgui_c.h Source File

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

- File List
- File Members

# /usr/ports/pobj/OpenCV-2.2.0/OpenCV-2.2.0/modules/highgui/include/opencv2/highgui/highgui_c.h

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 //                        Intel License Agreement
    00011 //                For Open Source Computer Vision Library
    00012 //
    00013 // Copyright (C) 2000, Intel Corporation, all rights reserved.
    00014 // Third party copyrights are property of their respective owners.
    00015 //
    00016 // Redistribution and use in source and binary forms, with or without modification,
    00017 // are permitted provided that the following conditions are met:
    00018 //
    00019 //   * Redistribution's of source code must retain the above copyright notice,
    00020 //     this list of conditions and the following disclaimer.
    00021 //
    00022 //   * Redistribution's in binary form must reproduce the above copyright notice,
    00023 //     this list of conditions and the following disclaimer in the documentation
    00024 //     and/or other materials provided with the distribution.
    00025 //
    00026 //   * The name of Intel Corporation may not be used to endorse or promote products
    00027 //     derived from this software without specific prior written permission.
    00028 //
    00029 // This software is provided by the copyright holders and contributors "as is" and
    00030 // any express or implied warranties, including, but not limited to, the implied
    00031 // warranties of merchantability and fitness for a particular purpose are disclaimed.
    00032 // In no event shall the Intel Corporation or contributors be liable for any direct,
    00033 // indirect, incidental, special, exemplary, or consequential damages
    00034 // (including, but not limited to, procurement of substitute goods or services;
    00035 // loss of use, data, or profits; or business interruption) however caused
    00036 // and on any theory of liability, whether in contract, strict liability,
    00037 // or tort (including negligence or otherwise) arising in any way out of
    00038 // the use of this software, even if advised of the possibility of such damage.
    00039 //
    00040 //M*/
    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 /* __cplusplus */
    00055
    00056 /****************************************************************************************\
    00057 *                                  Basic GUI functions                                   *
    00058 \****************************************************************************************/
    00059 //YV
    00060 //-----------New for Qt
    00061 /* For font */
    00062 enum {  CV_FONT_LIGHT                   = 25,//QFont::Light,
    00063                 CV_FONT_NORMAL                  = 50,//QFont::Normal,
    00064                 CV_FONT_DEMIBOLD                = 63,//QFont::DemiBold,
    00065                 CV_FONT_BOLD                    = 75,//QFont::Bold,
    00066                 CV_FONT_BLACK                   = 87 //QFont::Black
    00067 };
    00068
    00069 enum {  CV_STYLE_NORMAL                 = 0,//QFont::StyleNormal,
    00070                 CV_STYLE_ITALIC                 = 1,//QFont::StyleItalic,
    00071                 CV_STYLE_OBLIQUE                = 2 //QFont::StyleOblique
    00072 };
    00073 /* ---------*/
    00074
    00075 //for color cvScalar(blue_component, green_component, red\_component[, alpha_component])
    00076 //and alpha= 0 <-> 0xFF (not transparent <-> transparent)
    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 /* this function is used to set some external parameters in case of X Window */
    00099 CVAPI(int) cvInitSystem( int argc, char** argv );
    00100
    00101 CVAPI(int) cvStartWindowThread();
    00102
    00103 // ---------  YV ---------
    00104 enum
    00105 {
    00106         //These 3 flags are used by cvSet/GetWindowProperty
    00107         CV_WND_PROP_FULLSCREEN = 0,//to change/get window's fullscreen property
    00108         CV_WND_PROP_AUTOSIZE   = 1,//to change/get window's autosize property
    00109         CV_WND_PROP_ASPECTRATIO= 2,//to change/get window's aspectratio property
    00110         //
    00111         //These 2 flags are used by cvNamedWindow and cvSet/GetWindowProperty
    00112         CV_WINDOW_NORMAL       = 0x00000000,//the user can resize the window (no constraint)  / also use to switch a fullscreen window to a normal size
    00113         CV_WINDOW_AUTOSIZE         = 0x00000001,//the user cannot resize the window, the size is constrainted by the image displayed
    00114         //
    00115         //Those flags are only for Qt
    00116         CV_GUI_EXPANDED                 = 0x00000000,//status bar and tool bar
    00117         CV_GUI_NORMAL                   = 0x00000010,//old fashious way
    00118         //
    00119         //These 3 flags are used by cvNamedWindow and cvSet/GetWindowProperty
    00120         CV_WINDOW_FULLSCREEN   = 1,//change the window to fullscreen
    00121         CV_WINDOW_FREERATIO        = 0x00000100,//the image expends as much as it can (no ratio constraint)
    00122         CV_WINDOW_KEEPRATIO    = 0x00000000//the ration image is respected.
    00123 };
    00124
    00125 /* create window */
    00126 CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOSIZE) );
    00127
    00128 /* Set and Get Property of the window */
    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 /* display image within window (highgui windows remember their content) */
    00133 CVAPI(void) cvShowImage( const char* name, const CvArr* image );
    00134
    00135 /* resize/move window */
    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 /* destroy window and all the trackers associated with it */
    00141 CVAPI(void) cvDestroyWindow( const char* name );
    00142
    00143 CVAPI(void) cvDestroyAllWindows(void);
    00144
    00145 /* get native window handle (HWND in case of Win32 and Widget in case of X Window) */
    00146 CVAPI(void*) cvGetWindowHandle( const char* name );
    00147
    00148 /* get name of highgui window given its native handle */
    00149 CVAPI(const char*) cvGetWindowName( void* window_handle );
    00150
    00151
    00152 typedef void (CV_CDECL *CvTrackbarCallback)(int pos);
    00153
    00154 /* create trackbar and display it on top of given window, set callback */
    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 /* retrieve or set trackbar position */
    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 /* assign callback for mouse events */
    00195 CVAPI(void) cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse,
    00196                                 void* param CV_DEFAULT(NULL));
    00197
    00198 enum
    00199 {
    00200 /* 8bit, color or not */
    00201         CV_LOAD_IMAGE_UNCHANGED  =-1,
    00202 /* 8bit, gray */
    00203         CV_LOAD_IMAGE_GRAYSCALE  =0,
    00204 /* ?, color */
    00205         CV_LOAD_IMAGE_COLOR      =1,
    00206 /* any depth, ? */
    00207         CV_LOAD_IMAGE_ANYDEPTH   =2,
    00208 /* ?, any color */
    00209         CV_LOAD_IMAGE_ANYCOLOR   =4
    00210 };
    00211
    00212 /* load image from file
    00213   iscolor can be a combination of above flags where CV_LOAD_IMAGE_UNCHANGED
    00214   overrides the other flags
    00215   using CV_LOAD_IMAGE_ANYCOLOR alone is equivalent to CV_LOAD_IMAGE_UNCHANGED
    00216   unless CV_LOAD_IMAGE_ANYDEPTH is specified images are converted to 8bit
    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 /* save image to file */
    00229 CVAPI(int) cvSaveImage( const char* filename, const CvArr* image,
    00230                         const int* params CV_DEFAULT(0) );
    00231
    00232 /* decode image stored in the buffer */
    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 /* encode image and store the result as a byte vector (single-row 8uC1 matrix) */
    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 /* utility function: convert one image to another with optional vertical flip */
    00247 CVAPI(void) cvConvertImage( const CvArr* src, CvArr* dst, int flags CV_DEFAULT(0));
    00248
    00249 /* wait for key event infinitely (delay<=0) or for "delay" milliseconds */
    00250 CVAPI(int) cvWaitKey(int delay CV_DEFAULT(0));
    00251
    00252 /****************************************************************************************\
    00253 *                         Working with Video Files and Cameras                           *
    00254 \****************************************************************************************/
    00255
    00256 /* "black box" capture structure */
    00257 typedef struct CvCapture CvCapture;
    00258
    00259 /* start capturing frames from video file */
    00260 CVAPI(CvCapture*) cvCreateFileCapture( const char* filename );
    00261
    00262 enum
    00263 {
    00264         CV_CAP_ANY      =0,     // autodetect
    00265
    00266         CV_CAP_MIL      =100,   // MIL proprietary drivers
    00267
    00268         CV_CAP_VFW      =200,   // platform native
    00269         CV_CAP_V4L      =200,
    00270         CV_CAP_V4L2     =200,
    00271
    00272         CV_CAP_FIREWARE =300,   // IEEE 1394 drivers
    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,   // TYZX proprietary drivers
    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,   // QuickTime
    00286
    00287         CV_CAP_UNICAP   =600,   // Unicap drivers
    00288
    00289         CV_CAP_DSHOW    =700,   // DirectShow (via videoInput)
    00290
    00291         CV_CAP_PVAPI    =800   // PvAPI, Prosilica GigE SDK
    00292 };
    00293
    00294 /* start capturing frames from camera: index = camera_index + domain_offset (CV_CAP_*) */
    00295 CVAPI(CvCapture*) cvCreateCameraCapture( int index );
    00296
    00297 /* grab a frame, return 1 on success, 0 on fail.
    00298   this function is thought to be fast               */
    00299 CVAPI(int) cvGrabFrame( CvCapture* capture );
    00300
    00301 /* get the frame grabbed with cvGrabFrame(..)
    00302   This function may apply some frame processing like
    00303   frame decompression, flipping etc.
    00304   !!!DO NOT RELEASE or MODIFY the retrieved frame!!! */
    00305 CVAPI(IplImage*) cvRetrieveFrame( CvCapture* capture, int streamIdx CV_DEFAULT(0) );
    00306
    00307 /* Just a combination of cvGrabFrame and cvRetrieveFrame
    00308    !!!DO NOT RELEASE or MODIFY the retrieved frame!!!      */
    00309 CVAPI(IplImage*) cvQueryFrame( CvCapture* capture );
    00310
    00311 /* stop capturing/reading and free resources */
    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 /* retrieve or set capture properties */
    00339 CVAPI(double) cvGetCaptureProperty( CvCapture* capture, int property_id );
    00340 CVAPI(int)    cvSetCaptureProperty( CvCapture* capture, int property_id, double value );
    00341
    00342 // Return the type of the capturer (eg, CV_CAP_V4W, CV_CAP_UNICAP), which is unknown if created with CV_CAP_ANY
    00343 CVAPI(int)    cvGetCaptureDomain( CvCapture* capture);
    00344
    00345 /* "black box" video file writer structure */
    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  /* Open Codec Selection Dialog (Windows only) */
    00354 #define CV_FOURCC_DEFAULT CV_FOURCC('I', 'Y', 'U', 'V') /* Use default codec for specified filename (Linux only) */
    00355
    00356 /* initialize video file writer */
    00357 CVAPI(CvVideoWriter*) cvCreateVideoWriter( const char* filename, int fourcc,
    00358                                            double fps, CvSize frame_size,
    00359                                            int is_color CV_DEFAULT(1));
    00360
    00361 //CVAPI(CvVideoWriter*) cvCreateImageSequenceWriter( const char* filename,
    00362 //                                                   int is_color CV_DEFAULT(1));
    00363
    00364 /* write frame to video file */
    00365 CVAPI(int) cvWriteFrame( CvVideoWriter* writer, const IplImage* image );
    00366
    00367 /* close video file writer */
    00368 CVAPI(void) cvReleaseVideoWriter( CvVideoWriter** writer );
    00369
    00370 /****************************************************************************************\
    00371 *                              Obsolete functions/synonyms                               *
    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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines