opencv on mbed

Dependencies:   mbed

Committer:
joeverbout
Date:
Thu Mar 31 21:16:38 2016 +0000
Revision:
0:ea44dc9ed014
OpenCV on mbed attempt

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joeverbout 0:ea44dc9ed014 1 /*M///////////////////////////////////////////////////////////////////////////////////////
joeverbout 0:ea44dc9ed014 2 //
joeverbout 0:ea44dc9ed014 3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
joeverbout 0:ea44dc9ed014 4 //
joeverbout 0:ea44dc9ed014 5 // By downloading, copying, installing or using the software you agree to this license.
joeverbout 0:ea44dc9ed014 6 // If you do not agree to this license, do not download, install,
joeverbout 0:ea44dc9ed014 7 // copy or use the software.
joeverbout 0:ea44dc9ed014 8 //
joeverbout 0:ea44dc9ed014 9 //
joeverbout 0:ea44dc9ed014 10 // Intel License Agreement
joeverbout 0:ea44dc9ed014 11 // For Open Source Computer Vision Library
joeverbout 0:ea44dc9ed014 12 //
joeverbout 0:ea44dc9ed014 13 // Copyright (C) 2000, Intel Corporation, all rights reserved.
joeverbout 0:ea44dc9ed014 14 // Third party copyrights are property of their respective owners.
joeverbout 0:ea44dc9ed014 15 //
joeverbout 0:ea44dc9ed014 16 // Redistribution and use in source and binary forms, with or without modification,
joeverbout 0:ea44dc9ed014 17 // are permitted provided that the following conditions are met:
joeverbout 0:ea44dc9ed014 18 //
joeverbout 0:ea44dc9ed014 19 // * Redistribution's of source code must retain the above copyright notice,
joeverbout 0:ea44dc9ed014 20 // this list of conditions and the following disclaimer.
joeverbout 0:ea44dc9ed014 21 //
joeverbout 0:ea44dc9ed014 22 // * Redistribution's in binary form must reproduce the above copyright notice,
joeverbout 0:ea44dc9ed014 23 // this list of conditions and the following disclaimer in the documentation
joeverbout 0:ea44dc9ed014 24 // and/or other materials provided with the distribution.
joeverbout 0:ea44dc9ed014 25 //
joeverbout 0:ea44dc9ed014 26 // * The name of Intel Corporation may not be used to endorse or promote products
joeverbout 0:ea44dc9ed014 27 // derived from this software without specific prior written permission.
joeverbout 0:ea44dc9ed014 28 //
joeverbout 0:ea44dc9ed014 29 // This software is provided by the copyright holders and contributors "as is" and
joeverbout 0:ea44dc9ed014 30 // any express or implied warranties, including, but not limited to, the implied
joeverbout 0:ea44dc9ed014 31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
joeverbout 0:ea44dc9ed014 32 // In no event shall the Intel Corporation or contributors be liable for any direct,
joeverbout 0:ea44dc9ed014 33 // indirect, incidental, special, exemplary, or consequential damages
joeverbout 0:ea44dc9ed014 34 // (including, but not limited to, procurement of substitute goods or services;
joeverbout 0:ea44dc9ed014 35 // loss of use, data, or profits; or business interruption) however caused
joeverbout 0:ea44dc9ed014 36 // and on any theory of liability, whether in contract, strict liability,
joeverbout 0:ea44dc9ed014 37 // or tort (including negligence or otherwise) arising in any way out of
joeverbout 0:ea44dc9ed014 38 // the use of this software, even if advised of the possibility of such damage.
joeverbout 0:ea44dc9ed014 39 //
joeverbout 0:ea44dc9ed014 40 //M*/
joeverbout 0:ea44dc9ed014 41
joeverbout 0:ea44dc9ed014 42 #ifndef __OPENCV_HIGHGUI_H__
joeverbout 0:ea44dc9ed014 43 #define __OPENCV_HIGHGUI_H__
joeverbout 0:ea44dc9ed014 44
joeverbout 0:ea44dc9ed014 45 #include "opencv2/core/core_c.h"
joeverbout 0:ea44dc9ed014 46 #include "opencv2/imgproc/imgproc_c.h"
joeverbout 0:ea44dc9ed014 47 #include "opencv2/imgcodecs/imgcodecs_c.h"
joeverbout 0:ea44dc9ed014 48 #include "opencv2/videoio/videoio_c.h"
joeverbout 0:ea44dc9ed014 49
joeverbout 0:ea44dc9ed014 50 #ifdef __cplusplus
joeverbout 0:ea44dc9ed014 51 extern "C" {
joeverbout 0:ea44dc9ed014 52 #endif /* __cplusplus */
joeverbout 0:ea44dc9ed014 53
joeverbout 0:ea44dc9ed014 54 /** @addtogroup highgui_c
joeverbout 0:ea44dc9ed014 55 @{
joeverbout 0:ea44dc9ed014 56 */
joeverbout 0:ea44dc9ed014 57
joeverbout 0:ea44dc9ed014 58 /****************************************************************************************\
joeverbout 0:ea44dc9ed014 59 * Basic GUI functions *
joeverbout 0:ea44dc9ed014 60 \****************************************************************************************/
joeverbout 0:ea44dc9ed014 61 //YV
joeverbout 0:ea44dc9ed014 62 //-----------New for Qt
joeverbout 0:ea44dc9ed014 63 /* For font */
joeverbout 0:ea44dc9ed014 64 enum { CV_FONT_LIGHT = 25,//QFont::Light,
joeverbout 0:ea44dc9ed014 65 CV_FONT_NORMAL = 50,//QFont::Normal,
joeverbout 0:ea44dc9ed014 66 CV_FONT_DEMIBOLD = 63,//QFont::DemiBold,
joeverbout 0:ea44dc9ed014 67 CV_FONT_BOLD = 75,//QFont::Bold,
joeverbout 0:ea44dc9ed014 68 CV_FONT_BLACK = 87 //QFont::Black
joeverbout 0:ea44dc9ed014 69 };
joeverbout 0:ea44dc9ed014 70
joeverbout 0:ea44dc9ed014 71 enum { CV_STYLE_NORMAL = 0,//QFont::StyleNormal,
joeverbout 0:ea44dc9ed014 72 CV_STYLE_ITALIC = 1,//QFont::StyleItalic,
joeverbout 0:ea44dc9ed014 73 CV_STYLE_OBLIQUE = 2 //QFont::StyleOblique
joeverbout 0:ea44dc9ed014 74 };
joeverbout 0:ea44dc9ed014 75 /* ---------*/
joeverbout 0:ea44dc9ed014 76
joeverbout 0:ea44dc9ed014 77 //for color cvScalar(blue_component, green_component, red_component[, alpha_component])
joeverbout 0:ea44dc9ed014 78 //and alpha= 0 <-> 0xFF (not transparent <-> transparent)
joeverbout 0:ea44dc9ed014 79 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));
joeverbout 0:ea44dc9ed014 80
joeverbout 0:ea44dc9ed014 81 CVAPI(void) cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont *arg2);
joeverbout 0:ea44dc9ed014 82
joeverbout 0:ea44dc9ed014 83 CVAPI(void) cvDisplayOverlay(const char* name, const char* text, int delayms CV_DEFAULT(0));
joeverbout 0:ea44dc9ed014 84 CVAPI(void) cvDisplayStatusBar(const char* name, const char* text, int delayms CV_DEFAULT(0));
joeverbout 0:ea44dc9ed014 85
joeverbout 0:ea44dc9ed014 86 CVAPI(void) cvSaveWindowParameters(const char* name);
joeverbout 0:ea44dc9ed014 87 CVAPI(void) cvLoadWindowParameters(const char* name);
joeverbout 0:ea44dc9ed014 88 CVAPI(int) cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
joeverbout 0:ea44dc9ed014 89 CVAPI(void) cvStopLoop( void );
joeverbout 0:ea44dc9ed014 90
joeverbout 0:ea44dc9ed014 91 typedef void (CV_CDECL *CvButtonCallback)(int state, void* userdata);
joeverbout 0:ea44dc9ed014 92 enum {CV_PUSH_BUTTON = 0, CV_CHECKBOX = 1, CV_RADIOBOX = 2};
joeverbout 0:ea44dc9ed014 93 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));
joeverbout 0:ea44dc9ed014 94 //----------------------
joeverbout 0:ea44dc9ed014 95
joeverbout 0:ea44dc9ed014 96
joeverbout 0:ea44dc9ed014 97 /* this function is used to set some external parameters in case of X Window */
joeverbout 0:ea44dc9ed014 98 CVAPI(int) cvInitSystem( int argc, char** argv );
joeverbout 0:ea44dc9ed014 99
joeverbout 0:ea44dc9ed014 100 CVAPI(int) cvStartWindowThread( void );
joeverbout 0:ea44dc9ed014 101
joeverbout 0:ea44dc9ed014 102 // --------- YV ---------
joeverbout 0:ea44dc9ed014 103 enum
joeverbout 0:ea44dc9ed014 104 {
joeverbout 0:ea44dc9ed014 105 //These 3 flags are used by cvSet/GetWindowProperty
joeverbout 0:ea44dc9ed014 106 CV_WND_PROP_FULLSCREEN = 0, //to change/get window's fullscreen property
joeverbout 0:ea44dc9ed014 107 CV_WND_PROP_AUTOSIZE = 1, //to change/get window's autosize property
joeverbout 0:ea44dc9ed014 108 CV_WND_PROP_ASPECTRATIO= 2, //to change/get window's aspectratio property
joeverbout 0:ea44dc9ed014 109 CV_WND_PROP_OPENGL = 3, //to change/get window's opengl support
joeverbout 0:ea44dc9ed014 110
joeverbout 0:ea44dc9ed014 111 //These 2 flags are used by cvNamedWindow and cvSet/GetWindowProperty
joeverbout 0:ea44dc9ed014 112 CV_WINDOW_NORMAL = 0x00000000, //the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size
joeverbout 0:ea44dc9ed014 113 CV_WINDOW_AUTOSIZE = 0x00000001, //the user cannot resize the window, the size is constrainted by the image displayed
joeverbout 0:ea44dc9ed014 114 CV_WINDOW_OPENGL = 0x00001000, //window with opengl support
joeverbout 0:ea44dc9ed014 115
joeverbout 0:ea44dc9ed014 116 //Those flags are only for Qt
joeverbout 0:ea44dc9ed014 117 CV_GUI_EXPANDED = 0x00000000, //status bar and tool bar
joeverbout 0:ea44dc9ed014 118 CV_GUI_NORMAL = 0x00000010, //old fashious way
joeverbout 0:ea44dc9ed014 119
joeverbout 0:ea44dc9ed014 120 //These 3 flags are used by cvNamedWindow and cvSet/GetWindowProperty
joeverbout 0:ea44dc9ed014 121 CV_WINDOW_FULLSCREEN = 1,//change the window to fullscreen
joeverbout 0:ea44dc9ed014 122 CV_WINDOW_FREERATIO = 0x00000100,//the image expends as much as it can (no ratio constraint)
joeverbout 0:ea44dc9ed014 123 CV_WINDOW_KEEPRATIO = 0x00000000//the ration image is respected.
joeverbout 0:ea44dc9ed014 124 };
joeverbout 0:ea44dc9ed014 125
joeverbout 0:ea44dc9ed014 126 /* create window */
joeverbout 0:ea44dc9ed014 127 CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOSIZE) );
joeverbout 0:ea44dc9ed014 128
joeverbout 0:ea44dc9ed014 129 /* Set and Get Property of the window */
joeverbout 0:ea44dc9ed014 130 CVAPI(void) cvSetWindowProperty(const char* name, int prop_id, double prop_value);
joeverbout 0:ea44dc9ed014 131 CVAPI(double) cvGetWindowProperty(const char* name, int prop_id);
joeverbout 0:ea44dc9ed014 132
joeverbout 0:ea44dc9ed014 133 /* display image within window (highgui windows remember their content) */
joeverbout 0:ea44dc9ed014 134 CVAPI(void) cvShowImage( const char* name, const CvArr* image );
joeverbout 0:ea44dc9ed014 135
joeverbout 0:ea44dc9ed014 136 /* resize/move window */
joeverbout 0:ea44dc9ed014 137 CVAPI(void) cvResizeWindow( const char* name, int width, int height );
joeverbout 0:ea44dc9ed014 138 CVAPI(void) cvMoveWindow( const char* name, int x, int y );
joeverbout 0:ea44dc9ed014 139
joeverbout 0:ea44dc9ed014 140
joeverbout 0:ea44dc9ed014 141 /* destroy window and all the trackers associated with it */
joeverbout 0:ea44dc9ed014 142 CVAPI(void) cvDestroyWindow( const char* name );
joeverbout 0:ea44dc9ed014 143
joeverbout 0:ea44dc9ed014 144 CVAPI(void) cvDestroyAllWindows(void);
joeverbout 0:ea44dc9ed014 145
joeverbout 0:ea44dc9ed014 146 /* get native window handle (HWND in case of Win32 and Widget in case of X Window) */
joeverbout 0:ea44dc9ed014 147 CVAPI(void*) cvGetWindowHandle( const char* name );
joeverbout 0:ea44dc9ed014 148
joeverbout 0:ea44dc9ed014 149 /* get name of highgui window given its native handle */
joeverbout 0:ea44dc9ed014 150 CVAPI(const char*) cvGetWindowName( void* window_handle );
joeverbout 0:ea44dc9ed014 151
joeverbout 0:ea44dc9ed014 152
joeverbout 0:ea44dc9ed014 153 typedef void (CV_CDECL *CvTrackbarCallback)(int pos);
joeverbout 0:ea44dc9ed014 154
joeverbout 0:ea44dc9ed014 155 /* create trackbar and display it on top of given window, set callback */
joeverbout 0:ea44dc9ed014 156 CVAPI(int) cvCreateTrackbar( const char* trackbar_name, const char* window_name,
joeverbout 0:ea44dc9ed014 157 int* value, int count, CvTrackbarCallback on_change CV_DEFAULT(NULL));
joeverbout 0:ea44dc9ed014 158
joeverbout 0:ea44dc9ed014 159 typedef void (CV_CDECL *CvTrackbarCallback2)(int pos, void* userdata);
joeverbout 0:ea44dc9ed014 160
joeverbout 0:ea44dc9ed014 161 CVAPI(int) cvCreateTrackbar2( const char* trackbar_name, const char* window_name,
joeverbout 0:ea44dc9ed014 162 int* value, int count, CvTrackbarCallback2 on_change,
joeverbout 0:ea44dc9ed014 163 void* userdata CV_DEFAULT(0));
joeverbout 0:ea44dc9ed014 164
joeverbout 0:ea44dc9ed014 165 /* retrieve or set trackbar position */
joeverbout 0:ea44dc9ed014 166 CVAPI(int) cvGetTrackbarPos( const char* trackbar_name, const char* window_name );
joeverbout 0:ea44dc9ed014 167 CVAPI(void) cvSetTrackbarPos( const char* trackbar_name, const char* window_name, int pos );
joeverbout 0:ea44dc9ed014 168 CVAPI(void) cvSetTrackbarMax(const char* trackbar_name, const char* window_name, int maxval);
joeverbout 0:ea44dc9ed014 169 CVAPI(void) cvSetTrackbarMin(const char* trackbar_name, const char* window_name, int minval);
joeverbout 0:ea44dc9ed014 170
joeverbout 0:ea44dc9ed014 171 enum
joeverbout 0:ea44dc9ed014 172 {
joeverbout 0:ea44dc9ed014 173 CV_EVENT_MOUSEMOVE =0,
joeverbout 0:ea44dc9ed014 174 CV_EVENT_LBUTTONDOWN =1,
joeverbout 0:ea44dc9ed014 175 CV_EVENT_RBUTTONDOWN =2,
joeverbout 0:ea44dc9ed014 176 CV_EVENT_MBUTTONDOWN =3,
joeverbout 0:ea44dc9ed014 177 CV_EVENT_LBUTTONUP =4,
joeverbout 0:ea44dc9ed014 178 CV_EVENT_RBUTTONUP =5,
joeverbout 0:ea44dc9ed014 179 CV_EVENT_MBUTTONUP =6,
joeverbout 0:ea44dc9ed014 180 CV_EVENT_LBUTTONDBLCLK =7,
joeverbout 0:ea44dc9ed014 181 CV_EVENT_RBUTTONDBLCLK =8,
joeverbout 0:ea44dc9ed014 182 CV_EVENT_MBUTTONDBLCLK =9,
joeverbout 0:ea44dc9ed014 183 CV_EVENT_MOUSEWHEEL =10,
joeverbout 0:ea44dc9ed014 184 CV_EVENT_MOUSEHWHEEL =11
joeverbout 0:ea44dc9ed014 185 };
joeverbout 0:ea44dc9ed014 186
joeverbout 0:ea44dc9ed014 187 enum
joeverbout 0:ea44dc9ed014 188 {
joeverbout 0:ea44dc9ed014 189 CV_EVENT_FLAG_LBUTTON =1,
joeverbout 0:ea44dc9ed014 190 CV_EVENT_FLAG_RBUTTON =2,
joeverbout 0:ea44dc9ed014 191 CV_EVENT_FLAG_MBUTTON =4,
joeverbout 0:ea44dc9ed014 192 CV_EVENT_FLAG_CTRLKEY =8,
joeverbout 0:ea44dc9ed014 193 CV_EVENT_FLAG_SHIFTKEY =16,
joeverbout 0:ea44dc9ed014 194 CV_EVENT_FLAG_ALTKEY =32
joeverbout 0:ea44dc9ed014 195 };
joeverbout 0:ea44dc9ed014 196
joeverbout 0:ea44dc9ed014 197
joeverbout 0:ea44dc9ed014 198 #define CV_GET_WHEEL_DELTA(flags) ((short)((flags >> 16) & 0xffff)) // upper 16 bits
joeverbout 0:ea44dc9ed014 199
joeverbout 0:ea44dc9ed014 200 typedef void (CV_CDECL *CvMouseCallback )(int event, int x, int y, int flags, void* param);
joeverbout 0:ea44dc9ed014 201
joeverbout 0:ea44dc9ed014 202 /* assign callback for mouse events */
joeverbout 0:ea44dc9ed014 203 CVAPI(void) cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse,
joeverbout 0:ea44dc9ed014 204 void* param CV_DEFAULT(NULL));
joeverbout 0:ea44dc9ed014 205
joeverbout 0:ea44dc9ed014 206 /* wait for key event infinitely (delay<=0) or for "delay" milliseconds */
joeverbout 0:ea44dc9ed014 207 CVAPI(int) cvWaitKey(int delay CV_DEFAULT(0));
joeverbout 0:ea44dc9ed014 208
joeverbout 0:ea44dc9ed014 209 // OpenGL support
joeverbout 0:ea44dc9ed014 210
joeverbout 0:ea44dc9ed014 211 typedef void (CV_CDECL *CvOpenGlDrawCallback)(void* userdata);
joeverbout 0:ea44dc9ed014 212 CVAPI(void) cvSetOpenGlDrawCallback(const char* window_name, CvOpenGlDrawCallback callback, void* userdata CV_DEFAULT(NULL));
joeverbout 0:ea44dc9ed014 213
joeverbout 0:ea44dc9ed014 214 CVAPI(void) cvSetOpenGlContext(const char* window_name);
joeverbout 0:ea44dc9ed014 215 CVAPI(void) cvUpdateWindow(const char* window_name);
joeverbout 0:ea44dc9ed014 216
joeverbout 0:ea44dc9ed014 217
joeverbout 0:ea44dc9ed014 218 /****************************************************************************************\
joeverbout 0:ea44dc9ed014 219
joeverbout 0:ea44dc9ed014 220 * Obsolete functions/synonyms *
joeverbout 0:ea44dc9ed014 221 \****************************************************************************************/
joeverbout 0:ea44dc9ed014 222
joeverbout 0:ea44dc9ed014 223 #define cvAddSearchPath(path)
joeverbout 0:ea44dc9ed014 224 #define cvvInitSystem cvInitSystem
joeverbout 0:ea44dc9ed014 225 #define cvvNamedWindow cvNamedWindow
joeverbout 0:ea44dc9ed014 226 #define cvvShowImage cvShowImage
joeverbout 0:ea44dc9ed014 227 #define cvvResizeWindow cvResizeWindow
joeverbout 0:ea44dc9ed014 228 #define cvvDestroyWindow cvDestroyWindow
joeverbout 0:ea44dc9ed014 229 #define cvvCreateTrackbar cvCreateTrackbar
joeverbout 0:ea44dc9ed014 230 #define cvvAddSearchPath cvAddSearchPath
joeverbout 0:ea44dc9ed014 231 #define cvvWaitKey(name) cvWaitKey(0)
joeverbout 0:ea44dc9ed014 232 #define cvvWaitKeyEx(name,delay) cvWaitKey(delay)
joeverbout 0:ea44dc9ed014 233 #define HG_AUTOSIZE CV_WINDOW_AUTOSIZE
joeverbout 0:ea44dc9ed014 234 #define set_preprocess_func cvSetPreprocessFuncWin32
joeverbout 0:ea44dc9ed014 235 #define set_postprocess_func cvSetPostprocessFuncWin32
joeverbout 0:ea44dc9ed014 236
joeverbout 0:ea44dc9ed014 237 #if defined WIN32 || defined _WIN32
joeverbout 0:ea44dc9ed014 238
joeverbout 0:ea44dc9ed014 239 CVAPI(void) cvSetPreprocessFuncWin32_(const void* callback);
joeverbout 0:ea44dc9ed014 240 CVAPI(void) cvSetPostprocessFuncWin32_(const void* callback);
joeverbout 0:ea44dc9ed014 241 #define cvSetPreprocessFuncWin32(callback) cvSetPreprocessFuncWin32_((const void*)(callback))
joeverbout 0:ea44dc9ed014 242 #define cvSetPostprocessFuncWin32(callback) cvSetPostprocessFuncWin32_((const void*)(callback))
joeverbout 0:ea44dc9ed014 243
joeverbout 0:ea44dc9ed014 244 #endif
joeverbout 0:ea44dc9ed014 245
joeverbout 0:ea44dc9ed014 246 /** @} highgui_c */
joeverbout 0:ea44dc9ed014 247
joeverbout 0:ea44dc9ed014 248 #ifdef __cplusplus
joeverbout 0:ea44dc9ed014 249 }
joeverbout 0:ea44dc9ed014 250 #endif
joeverbout 0:ea44dc9ed014 251
joeverbout 0:ea44dc9ed014 252 #endif
joeverbout 0:ea44dc9ed014 253