opencv on mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers highgui_c.h Source File

highgui_c.h

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 #include "opencv2/imgproc/imgproc_c.h"
00047 #include "opencv2/imgcodecs/imgcodecs_c.h"
00048 #include "opencv2/videoio/videoio_c.h"
00049 
00050 #ifdef __cplusplus
00051 extern "C" {
00052 #endif /* __cplusplus */
00053 
00054 /** @addtogroup highgui_c
00055   @{
00056   */
00057 
00058 /****************************************************************************************\
00059 *                                  Basic GUI functions                                   *
00060 \****************************************************************************************/
00061 //YV
00062 //-----------New for Qt
00063 /* For font */
00064 enum {  CV_FONT_LIGHT           = 25,//QFont::Light,
00065         CV_FONT_NORMAL          = 50,//QFont::Normal,
00066         CV_FONT_DEMIBOLD        = 63,//QFont::DemiBold,
00067         CV_FONT_BOLD            = 75,//QFont::Bold,
00068         CV_FONT_BLACK           = 87 //QFont::Black
00069 };
00070 
00071 enum {  CV_STYLE_NORMAL         = 0,//QFont::StyleNormal,
00072         CV_STYLE_ITALIC         = 1,//QFont::StyleItalic,
00073         CV_STYLE_OBLIQUE        = 2 //QFont::StyleOblique
00074 };
00075 /* ---------*/
00076 
00077 //for color cvScalar(blue_component, green_component, red_component[, alpha_component])
00078 //and alpha= 0 <-> 0xFF (not transparent <-> transparent)
00079 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));
00080 
00081 CVAPI(void) cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont *arg2);
00082 
00083 CVAPI(void) cvDisplayOverlay(const char* name, const char* text, int delayms CV_DEFAULT(0));
00084 CVAPI(void) cvDisplayStatusBar(const char* name, const char* text, int delayms CV_DEFAULT(0));
00085 
00086 CVAPI(void) cvSaveWindowParameters(const char* name);
00087 CVAPI(void) cvLoadWindowParameters(const char* name);
00088 CVAPI(int) cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
00089 CVAPI(void) cvStopLoop( void );
00090 
00091 typedef void (CV_CDECL *CvButtonCallback)(int state, void* userdata);
00092 enum {CV_PUSH_BUTTON = 0, CV_CHECKBOX = 1, CV_RADIOBOX = 2};
00093 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));
00094 //----------------------
00095 
00096 
00097 /* this function is used to set some external parameters in case of X Window */
00098 CVAPI(int) cvInitSystem( int argc, char** argv );
00099 
00100 CVAPI(int) cvStartWindowThread( void );
00101 
00102 // ---------  YV ---------
00103 enum
00104 {
00105     //These 3 flags are used by cvSet/GetWindowProperty
00106     CV_WND_PROP_FULLSCREEN = 0, //to change/get window's fullscreen property
00107     CV_WND_PROP_AUTOSIZE   = 1, //to change/get window's autosize property
00108     CV_WND_PROP_ASPECTRATIO= 2, //to change/get window's aspectratio property
00109     CV_WND_PROP_OPENGL     = 3, //to change/get window's opengl support
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     CV_WINDOW_OPENGL       = 0x00001000, //window with opengl support
00115 
00116     //Those flags are only for Qt
00117     CV_GUI_EXPANDED         = 0x00000000, //status bar and tool bar
00118     CV_GUI_NORMAL           = 0x00000010, //old fashious way
00119 
00120     //These 3 flags are used by cvNamedWindow and cvSet/GetWindowProperty
00121     CV_WINDOW_FULLSCREEN   = 1,//change the window to fullscreen
00122     CV_WINDOW_FREERATIO    = 0x00000100,//the image expends as much as it can (no ratio constraint)
00123     CV_WINDOW_KEEPRATIO    = 0x00000000//the ration image is respected.
00124 };
00125 
00126 /* create window */
00127 CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOSIZE) );
00128 
00129 /* Set and Get Property of the window */
00130 CVAPI(void) cvSetWindowProperty(const char* name, int prop_id, double prop_value);
00131 CVAPI(double) cvGetWindowProperty(const char* name, int prop_id);
00132 
00133 /* display image within window (highgui windows remember their content) */
00134 CVAPI(void) cvShowImage( const char* name, const CvArr* image );
00135 
00136 /* resize/move window */
00137 CVAPI(void) cvResizeWindow( const char* name, int width, int height );
00138 CVAPI(void) cvMoveWindow( const char* name, int x, int y );
00139 
00140 
00141 /* destroy window and all the trackers associated with it */
00142 CVAPI(void) cvDestroyWindow( const char* name );
00143 
00144 CVAPI(void) cvDestroyAllWindows(void);
00145 
00146 /* get native window handle (HWND in case of Win32 and Widget in case of X Window) */
00147 CVAPI(void*) cvGetWindowHandle( const char* name );
00148 
00149 /* get name of highgui window given its native handle */
00150 CVAPI(const char*) cvGetWindowName( void* window_handle );
00151 
00152 
00153 typedef void (CV_CDECL *CvTrackbarCallback)(int pos);
00154 
00155 /* create trackbar and display it on top of given window, set callback */
00156 CVAPI(int) cvCreateTrackbar( const char* trackbar_name, const char* window_name,
00157                              int* value, int count, CvTrackbarCallback on_change CV_DEFAULT(NULL));
00158 
00159 typedef void (CV_CDECL *CvTrackbarCallback2)(int pos, void* userdata);
00160 
00161 CVAPI(int) cvCreateTrackbar2( const char* trackbar_name, const char* window_name,
00162                               int* value, int count, CvTrackbarCallback2 on_change,
00163                               void* userdata CV_DEFAULT(0));
00164 
00165 /* retrieve or set trackbar position */
00166 CVAPI(int) cvGetTrackbarPos( const char* trackbar_name, const char* window_name );
00167 CVAPI(void) cvSetTrackbarPos( const char* trackbar_name, const char* window_name, int pos );
00168 CVAPI(void) cvSetTrackbarMax(const char* trackbar_name, const char* window_name, int maxval);
00169 CVAPI(void) cvSetTrackbarMin(const char* trackbar_name, const char* window_name, int minval);
00170 
00171 enum
00172 {
00173     CV_EVENT_MOUSEMOVE      =0,
00174     CV_EVENT_LBUTTONDOWN    =1,
00175     CV_EVENT_RBUTTONDOWN    =2,
00176     CV_EVENT_MBUTTONDOWN    =3,
00177     CV_EVENT_LBUTTONUP      =4,
00178     CV_EVENT_RBUTTONUP      =5,
00179     CV_EVENT_MBUTTONUP      =6,
00180     CV_EVENT_LBUTTONDBLCLK  =7,
00181     CV_EVENT_RBUTTONDBLCLK  =8,
00182     CV_EVENT_MBUTTONDBLCLK  =9,
00183     CV_EVENT_MOUSEWHEEL     =10,
00184     CV_EVENT_MOUSEHWHEEL    =11
00185 };
00186 
00187 enum
00188 {
00189     CV_EVENT_FLAG_LBUTTON   =1,
00190     CV_EVENT_FLAG_RBUTTON   =2,
00191     CV_EVENT_FLAG_MBUTTON   =4,
00192     CV_EVENT_FLAG_CTRLKEY   =8,
00193     CV_EVENT_FLAG_SHIFTKEY  =16,
00194     CV_EVENT_FLAG_ALTKEY    =32
00195 };
00196 
00197 
00198 #define CV_GET_WHEEL_DELTA(flags) ((short)((flags >> 16) & 0xffff)) // upper 16 bits
00199 
00200 typedef void (CV_CDECL *CvMouseCallback )(int event, int x, int y, int flags, void* param);
00201 
00202 /* assign callback for mouse events */
00203 CVAPI(void) cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse,
00204                                 void* param CV_DEFAULT(NULL));
00205 
00206 /* wait for key event infinitely (delay<=0) or for "delay" milliseconds */
00207 CVAPI(int) cvWaitKey(int delay CV_DEFAULT(0));
00208 
00209 // OpenGL support
00210 
00211 typedef void (CV_CDECL *CvOpenGlDrawCallback)(void* userdata);
00212 CVAPI(void) cvSetOpenGlDrawCallback(const char* window_name, CvOpenGlDrawCallback callback, void* userdata CV_DEFAULT(NULL));
00213 
00214 CVAPI(void) cvSetOpenGlContext(const char* window_name);
00215 CVAPI(void) cvUpdateWindow(const char* window_name);
00216 
00217 
00218 /****************************************************************************************\
00219 
00220 *                              Obsolete functions/synonyms                               *
00221 \****************************************************************************************/
00222 
00223 #define cvAddSearchPath(path)
00224 #define cvvInitSystem cvInitSystem
00225 #define cvvNamedWindow cvNamedWindow
00226 #define cvvShowImage cvShowImage
00227 #define cvvResizeWindow cvResizeWindow
00228 #define cvvDestroyWindow cvDestroyWindow
00229 #define cvvCreateTrackbar cvCreateTrackbar
00230 #define cvvAddSearchPath cvAddSearchPath
00231 #define cvvWaitKey(name) cvWaitKey(0)
00232 #define cvvWaitKeyEx(name,delay) cvWaitKey(delay)
00233 #define HG_AUTOSIZE CV_WINDOW_AUTOSIZE
00234 #define set_preprocess_func cvSetPreprocessFuncWin32
00235 #define set_postprocess_func cvSetPostprocessFuncWin32
00236 
00237 #if defined WIN32 || defined _WIN32
00238 
00239 CVAPI(void) cvSetPreprocessFuncWin32_(const void* callback);
00240 CVAPI(void) cvSetPostprocessFuncWin32_(const void* callback);
00241 #define cvSetPreprocessFuncWin32(callback) cvSetPreprocessFuncWin32_((const void*)(callback))
00242 #define cvSetPostprocessFuncWin32(callback) cvSetPostprocessFuncWin32_((const void*)(callback))
00243 
00244 #endif
00245 
00246 /** @} highgui_c */
00247 
00248 #ifdef __cplusplus
00249 }
00250 #endif
00251 
00252 #endif
00253