imagecore 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. data/.gitignore +24 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +2 -0
  4. data/ext/imagecore/analyze_image.cxx +58 -0
  5. data/ext/imagecore/analyze_image.h +6 -0
  6. data/ext/imagecore/extconf.rb +9 -0
  7. data/ext/imagecore/imagecore.cxx +34 -0
  8. data/ext/opencv/core/___.c +3 -0
  9. data/ext/opencv/core/alloc.cpp +697 -0
  10. data/ext/opencv/core/array.cpp +3206 -0
  11. data/ext/opencv/core/datastructs.cpp +4064 -0
  12. data/ext/opencv/core/extconf.rb +22 -0
  13. data/ext/opencv/core/matrix.cpp +3777 -0
  14. data/ext/opencv/core/precomp.hpp +216 -0
  15. data/ext/opencv/core/system.cpp +832 -0
  16. data/ext/opencv/core/tables.cpp +3512 -0
  17. data/ext/opencv/highgui/___.c +3 -0
  18. data/ext/opencv/highgui/bitstrm.cpp +582 -0
  19. data/ext/opencv/highgui/bitstrm.hpp +182 -0
  20. data/ext/opencv/highgui/extconf.rb +28 -0
  21. data/ext/opencv/highgui/grfmt_base.cpp +128 -0
  22. data/ext/opencv/highgui/grfmt_base.hpp +113 -0
  23. data/ext/opencv/highgui/grfmt_bmp.cpp +564 -0
  24. data/ext/opencv/highgui/grfmt_bmp.hpp +99 -0
  25. data/ext/opencv/highgui/grfmt_exr.hpp +113 -0
  26. data/ext/opencv/highgui/grfmt_imageio.hpp +56 -0
  27. data/ext/opencv/highgui/grfmt_jpeg.cpp +622 -0
  28. data/ext/opencv/highgui/grfmt_jpeg.hpp +90 -0
  29. data/ext/opencv/highgui/grfmt_jpeg2000.cpp +529 -0
  30. data/ext/opencv/highgui/grfmt_jpeg2000.hpp +95 -0
  31. data/ext/opencv/highgui/grfmt_png.cpp +406 -0
  32. data/ext/opencv/highgui/grfmt_png.hpp +101 -0
  33. data/ext/opencv/highgui/grfmt_pxm.cpp +513 -0
  34. data/ext/opencv/highgui/grfmt_pxm.hpp +92 -0
  35. data/ext/opencv/highgui/grfmt_sunras.cpp +425 -0
  36. data/ext/opencv/highgui/grfmt_sunras.hpp +105 -0
  37. data/ext/opencv/highgui/grfmt_tiff.cpp +718 -0
  38. data/ext/opencv/highgui/grfmt_tiff.hpp +136 -0
  39. data/ext/opencv/highgui/grfmts.hpp +56 -0
  40. data/ext/opencv/highgui/loadsave.cpp +535 -0
  41. data/ext/opencv/highgui/precomp.hpp +223 -0
  42. data/ext/opencv/highgui/utils.cpp +689 -0
  43. data/ext/opencv/highgui/utils.hpp +128 -0
  44. data/ext/opencv/imgproc/___.c +3 -0
  45. data/ext/opencv/imgproc/_geom.h +72 -0
  46. data/ext/opencv/imgproc/color.cpp +3179 -0
  47. data/ext/opencv/imgproc/contours.cpp +1780 -0
  48. data/ext/opencv/imgproc/extconf.rb +11 -0
  49. data/ext/opencv/imgproc/filter.cpp +3063 -0
  50. data/ext/opencv/imgproc/precomp.hpp +159 -0
  51. data/ext/opencv/imgproc/shapedescr.cpp +1306 -0
  52. data/ext/opencv/imgproc/smooth.cpp +1566 -0
  53. data/ext/opencv/imgproc/tables.cpp +214 -0
  54. data/ext/opencv/imgproc/thresh.cpp +636 -0
  55. data/ext/opencv/imgproc/utils.cpp +242 -0
  56. data/ext/opencv/include/opencv2/core/core.hpp +4344 -0
  57. data/ext/opencv/include/opencv2/core/core_c.h +1885 -0
  58. data/ext/opencv/include/opencv2/core/internal.hpp +710 -0
  59. data/ext/opencv/include/opencv2/core/mat.hpp +2557 -0
  60. data/ext/opencv/include/opencv2/core/operations.hpp +3623 -0
  61. data/ext/opencv/include/opencv2/core/types_c.h +1875 -0
  62. data/ext/opencv/include/opencv2/core/version.hpp +58 -0
  63. data/ext/opencv/include/opencv2/highgui/highgui.hpp +198 -0
  64. data/ext/opencv/include/opencv2/highgui/highgui_c.h +506 -0
  65. data/ext/opencv/include/opencv2/imgproc/imgproc.hpp +1139 -0
  66. data/ext/opencv/include/opencv2/imgproc/imgproc_c.h +783 -0
  67. data/ext/opencv/include/opencv2/imgproc/types_c.h +538 -0
  68. data/imagecore.gemspec +20 -0
  69. data/lib/imagecore.rb +16 -0
  70. data/lib/imagecore/version.rb +3 -0
  71. metadata +119 -0
@@ -0,0 +1,58 @@
1
+ /*M///////////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4
+ //
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.
8
+ //
9
+ //
10
+ // Intel License Agreement
11
+ // For Open Source Computer Vision Library
12
+ //
13
+ // Copyright( C) 2000, Intel Corporation, all rights reserved.
14
+ // Third party copyrights are property of their respective owners.
15
+ //
16
+ // Redistribution and use in source and binary forms, with or without modification,
17
+ // are permitted provided that the following conditions are met:
18
+ //
19
+ // * Redistribution's of source code must retain the above copyright notice,
20
+ // this list of conditions and the following disclaimer.
21
+ //
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.
25
+ //
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.
28
+ //
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.
39
+ //
40
+ //M*/
41
+
42
+ /*
43
+ definition of the current version of OpenCV
44
+ Usefull to test in user programs
45
+ */
46
+
47
+ #ifndef __OPENCV_VERSION_HPP__
48
+ #define __OPENCV_VERSION_HPP__
49
+
50
+ #define CV_MAJOR_VERSION 2
51
+ #define CV_MINOR_VERSION 3
52
+ #define CV_SUBMINOR_VERSION 1
53
+
54
+ #define CVAUX_STR_EXP(__A) #__A
55
+ #define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
56
+ #define CV_VERSION CVAUX_STR(CV_MAJOR_VERSION) "." CVAUX_STR(CV_MINOR_VERSION) "." CVAUX_STR(CV_SUBMINOR_VERSION)
57
+
58
+ #endif
@@ -0,0 +1,198 @@
1
+ /*M///////////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4
+ //
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.
8
+ //
9
+ //
10
+ // License Agreement
11
+ // For Open Source Computer Vision Library
12
+ //
13
+ // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14
+ // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15
+ // Third party copyrights are property of their respective owners.
16
+ //
17
+ // Redistribution and use in source and binary forms, with or without modification,
18
+ // are permitted provided that the following conditions are met:
19
+ //
20
+ // * Redistribution's of source code must retain the above copyright notice,
21
+ // this list of conditions and the following disclaimer.
22
+ //
23
+ // * Redistribution's in binary form must reproduce the above copyright notice,
24
+ // this list of conditions and the following disclaimer in the documentation
25
+ // and/or other materials provided with the distribution.
26
+ //
27
+ // * The name of the copyright holders may not be used to endorse or promote products
28
+ // derived from this software without specific prior written permission.
29
+ //
30
+ // This software is provided by the copyright holders and contributors "as is" and
31
+ // any express or implied warranties, including, but not limited to, the implied
32
+ // warranties of merchantability and fitness for a particular purpose are disclaimed.
33
+ // In no event shall the Intel Corporation or contributors be liable for any direct,
34
+ // indirect, incidental, special, exemplary, or consequential damages
35
+ // (including, but not limited to, procurement of substitute goods or services;
36
+ // loss of use, data, or profits; or business interruption) however caused
37
+ // and on any theory of liability, whether in contract, strict liability,
38
+ // or tort (including negligence or otherwise) arising in any way out of
39
+ // the use of this software, even if advised of the possibility of such damage.
40
+ //
41
+ //M*/
42
+
43
+ #ifndef __OPENCV_HIGHGUI_HPP__
44
+ #define __OPENCV_HIGHGUI_HPP__
45
+
46
+ #include "opencv2/core/core.hpp"
47
+ #include "opencv2/highgui/highgui_c.h"
48
+
49
+ #ifdef __cplusplus
50
+
51
+ struct CvCapture;
52
+ struct CvVideoWriter;
53
+
54
+ namespace cv
55
+ {
56
+
57
+ enum { WINDOW_AUTOSIZE=1 };
58
+
59
+ CV_EXPORTS_W void namedWindow( const string& winname, int flags=WINDOW_AUTOSIZE );
60
+ CV_EXPORTS_W void destroyWindow( const string& winname );
61
+ CV_EXPORTS_W void destroyAllWindows();
62
+ CV_EXPORTS_W int startWindowThread();
63
+
64
+ CV_EXPORTS_W void setWindowProperty(const string& winname, int prop_id, double prop_value);//YV
65
+ CV_EXPORTS_W double getWindowProperty(const string& winname, int prop_id);//YV
66
+
67
+
68
+ //Only for Qt
69
+ //------------------------
70
+ CV_EXPORTS CvFont fontQt(const string& nameFont, int pointSize=-1,
71
+ Scalar color=Scalar::all(0), int weight=CV_FONT_NORMAL,
72
+ int style=CV_STYLE_NORMAL, int spacing=0);
73
+ CV_EXPORTS void addText( const Mat& img, const string& text, Point org, CvFont font);
74
+
75
+ CV_EXPORTS void displayOverlay(const string& winname, const string& text, int delayms);
76
+ CV_EXPORTS void displayStatusBar(const string& winname, const string& text, int delayms);
77
+
78
+ typedef void (CV_CDECL *OpenGLCallback)(void* userdata);
79
+ CV_EXPORTS void createOpenGLCallback(const string& winname, CvOpenGLCallback callbackOpenGL, void* userdata=0);
80
+
81
+ CV_EXPORTS void saveWindowParameters(const string& windowName);
82
+ CV_EXPORTS void loadWindowParameters(const string& windowName);
83
+ CV_EXPORTS int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
84
+ CV_EXPORTS void stopLoop();
85
+
86
+ typedef void (CV_CDECL *ButtonCallback)(int state, void* userdata);
87
+ CV_EXPORTS int createButton( const string& bar_name, ButtonCallback on_change,
88
+ void* userdata=NULL, int type=CV_PUSH_BUTTON,
89
+ bool initial_button_state=0);
90
+ //-------------------------
91
+
92
+ CV_EXPORTS_W void imshow( const string& winname, InputArray mat );
93
+
94
+ typedef void (CV_CDECL *TrackbarCallback)(int pos, void* userdata);
95
+
96
+ CV_EXPORTS int createTrackbar( const string& trackbarname, const string& winname,
97
+ int* value, int count,
98
+ TrackbarCallback onChange=0,
99
+ void* userdata=0);
100
+
101
+ CV_EXPORTS_W int getTrackbarPos( const string& trackbarname, const string& winname );
102
+ CV_EXPORTS_W void setTrackbarPos( const string& trackbarname, const string& winname, int pos );
103
+
104
+ enum
105
+ {
106
+ EVENT_MOUSEMOVE =0,
107
+ EVENT_LBUTTONDOWN =1,
108
+ EVENT_RBUTTONDOWN =2,
109
+ EVENT_MBUTTONDOWN =3,
110
+ EVENT_LBUTTONUP =4,
111
+ EVENT_RBUTTONUP =5,
112
+ EVENT_MBUTTONUP =6,
113
+ EVENT_LBUTTONDBLCLK =7,
114
+ EVENT_RBUTTONDBLCLK =8,
115
+ EVENT_MBUTTONDBLCLK =9
116
+ };
117
+
118
+ enum
119
+ {
120
+ EVENT_FLAG_LBUTTON =1,
121
+ EVENT_FLAG_RBUTTON =2,
122
+ EVENT_FLAG_MBUTTON =4,
123
+ EVENT_FLAG_CTRLKEY =8,
124
+ EVENT_FLAG_SHIFTKEY =16,
125
+ EVENT_FLAG_ALTKEY =32
126
+ };
127
+
128
+ typedef void (*MouseCallback )(int event, int x, int y, int flags, void* param);
129
+
130
+ //! assigns callback for mouse events
131
+ CV_EXPORTS void setMouseCallback( const string& windowName, MouseCallback onMouse, void* param=0);
132
+
133
+ CV_EXPORTS_W Mat imread( const string& filename, int flags=1 );
134
+ CV_EXPORTS_W bool imwrite( const string& filename, InputArray img,
135
+ const vector<int>& params=vector<int>());
136
+ CV_EXPORTS_W Mat imdecode( InputArray buf, int flags );
137
+ CV_EXPORTS_W bool imencode( const string& ext, InputArray img,
138
+ vector<uchar>& buf,
139
+ const vector<int>& params=vector<int>());
140
+
141
+ CV_EXPORTS_W int waitKey(int delay=0);
142
+
143
+ #ifndef CV_NO_VIDEO_CAPTURE_CPP_API
144
+
145
+ template<> void CV_EXPORTS Ptr<CvCapture>::delete_obj();
146
+ template<> void CV_EXPORTS Ptr<CvVideoWriter>::delete_obj();
147
+
148
+ class CV_EXPORTS_W VideoCapture
149
+ {
150
+ public:
151
+ CV_WRAP VideoCapture();
152
+ CV_WRAP VideoCapture(const string& filename);
153
+ CV_WRAP VideoCapture(int device);
154
+
155
+ virtual ~VideoCapture();
156
+ CV_WRAP virtual bool open(const string& filename);
157
+ CV_WRAP virtual bool open(int device);
158
+ CV_WRAP virtual bool isOpened() const;
159
+ CV_WRAP virtual void release();
160
+
161
+ CV_WRAP virtual bool grab();
162
+ CV_WRAP virtual bool retrieve(CV_OUT Mat& image, int channel=0);
163
+ virtual VideoCapture& operator >> (CV_OUT Mat& image);
164
+ CV_WRAP virtual bool read(CV_OUT Mat& image);
165
+
166
+ CV_WRAP virtual bool set(int propId, double value);
167
+ CV_WRAP virtual double get(int propId);
168
+
169
+ protected:
170
+ Ptr<CvCapture> cap;
171
+ };
172
+
173
+
174
+ class CV_EXPORTS_W VideoWriter
175
+ {
176
+ public:
177
+ CV_WRAP VideoWriter();
178
+ CV_WRAP VideoWriter(const string& filename, int fourcc, double fps,
179
+ Size frameSize, bool isColor=true);
180
+
181
+ virtual ~VideoWriter();
182
+ CV_WRAP virtual bool open(const string& filename, int fourcc, double fps,
183
+ Size frameSize, bool isColor=true);
184
+ CV_WRAP virtual bool isOpened() const;
185
+ virtual VideoWriter& operator << (const Mat& image);
186
+ CV_WRAP virtual void write(const Mat& image);
187
+
188
+ protected:
189
+ Ptr<CvVideoWriter> writer;
190
+ };
191
+
192
+ #endif
193
+
194
+ }
195
+
196
+ #endif
197
+
198
+ #endif
@@ -0,0 +1,506 @@
1
+ /*M///////////////////////////////////////////////////////////////////////////////////////
2
+ //
3
+ // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4
+ //
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.
8
+ //
9
+ //
10
+ // Intel License Agreement
11
+ // For Open Source Computer Vision Library
12
+ //
13
+ // Copyright (C) 2000, Intel Corporation, all rights reserved.
14
+ // Third party copyrights are property of their respective owners.
15
+ //
16
+ // Redistribution and use in source and binary forms, with or without modification,
17
+ // are permitted provided that the following conditions are met:
18
+ //
19
+ // * Redistribution's of source code must retain the above copyright notice,
20
+ // this list of conditions and the following disclaimer.
21
+ //
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.
25
+ //
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.
28
+ //
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.
39
+ //
40
+ //M*/
41
+
42
+ #ifndef __OPENCV_HIGHGUI_H__
43
+ #define __OPENCV_HIGHGUI_H__
44
+
45
+ #include "opencv2/core/core_c.h"
46
+
47
+ #ifdef __cplusplus
48
+ extern "C" {
49
+ #endif /* __cplusplus */
50
+
51
+ /****************************************************************************************\
52
+ * Basic GUI functions *
53
+ \****************************************************************************************/
54
+ //YV
55
+ //-----------New for Qt
56
+ /* For font */
57
+ enum { CV_FONT_LIGHT = 25,//QFont::Light,
58
+ CV_FONT_NORMAL = 50,//QFont::Normal,
59
+ CV_FONT_DEMIBOLD = 63,//QFont::DemiBold,
60
+ CV_FONT_BOLD = 75,//QFont::Bold,
61
+ CV_FONT_BLACK = 87 //QFont::Black
62
+ };
63
+
64
+ enum { CV_STYLE_NORMAL = 0,//QFont::StyleNormal,
65
+ CV_STYLE_ITALIC = 1,//QFont::StyleItalic,
66
+ CV_STYLE_OBLIQUE = 2 //QFont::StyleOblique
67
+ };
68
+ /* ---------*/
69
+
70
+ //for color cvScalar(blue_component, green_component, red\_component[, alpha_component])
71
+ //and alpha= 0 <-> 0xFF (not transparent <-> transparent)
72
+ 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));
73
+
74
+ CVAPI(void) cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont *arg2);
75
+
76
+ CVAPI(void) cvDisplayOverlay(const char* name, const char* text, int delayms);
77
+ CVAPI(void) cvDisplayStatusBar(const char* name, const char* text, int delayms);
78
+
79
+ typedef void (CV_CDECL *CvOpenGLCallback)(void* userdata);
80
+ 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));
81
+
82
+ CVAPI(void) cvSaveWindowParameters(const char* name);
83
+ CVAPI(void) cvLoadWindowParameters(const char* name);
84
+ CVAPI(int) cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
85
+ CVAPI(void) cvStopLoop();
86
+
87
+ typedef void (CV_CDECL *CvButtonCallback)(int state, void* userdata);
88
+ enum {CV_PUSH_BUTTON = 0, CV_CHECKBOX = 1, CV_RADIOBOX = 2};
89
+ 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));
90
+ //----------------------
91
+
92
+
93
+ /* this function is used to set some external parameters in case of X Window */
94
+ CVAPI(int) cvInitSystem( int argc, char** argv );
95
+
96
+ CVAPI(int) cvStartWindowThread();
97
+
98
+ // --------- YV ---------
99
+ enum
100
+ {
101
+ //These 3 flags are used by cvSet/GetWindowProperty
102
+ CV_WND_PROP_FULLSCREEN = 0,//to change/get window's fullscreen property
103
+ CV_WND_PROP_AUTOSIZE = 1,//to change/get window's autosize property
104
+ CV_WND_PROP_ASPECTRATIO= 2,//to change/get window's aspectratio property
105
+ //
106
+ //These 2 flags are used by cvNamedWindow and cvSet/GetWindowProperty
107
+ CV_WINDOW_NORMAL = 0x00000000,//the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size
108
+ CV_WINDOW_AUTOSIZE = 0x00000001,//the user cannot resize the window, the size is constrainted by the image displayed
109
+ //
110
+ //Those flags are only for Qt
111
+ CV_GUI_EXPANDED = 0x00000000,//status bar and tool bar
112
+ CV_GUI_NORMAL = 0x00000010,//old fashious way
113
+ //
114
+ //These 3 flags are used by cvNamedWindow and cvSet/GetWindowProperty
115
+ CV_WINDOW_FULLSCREEN = 1,//change the window to fullscreen
116
+ CV_WINDOW_FREERATIO = 0x00000100,//the image expends as much as it can (no ratio constraint)
117
+ CV_WINDOW_KEEPRATIO = 0x00000000//the ration image is respected.
118
+ };
119
+
120
+ /* create window */
121
+ CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOSIZE) );
122
+
123
+ /* Set and Get Property of the window */
124
+ CVAPI(void) cvSetWindowProperty(const char* name, int prop_id, double prop_value);
125
+ CVAPI(double) cvGetWindowProperty(const char* name, int prop_id);
126
+
127
+ /* display image within window (highgui windows remember their content) */
128
+ CVAPI(void) cvShowImage( const char* name, const CvArr* image );
129
+
130
+ /* resize/move window */
131
+ CVAPI(void) cvResizeWindow( const char* name, int width, int height );
132
+ CVAPI(void) cvMoveWindow( const char* name, int x, int y );
133
+
134
+
135
+ /* destroy window and all the trackers associated with it */
136
+ CVAPI(void) cvDestroyWindow( const char* name );
137
+
138
+ CVAPI(void) cvDestroyAllWindows(void);
139
+
140
+ /* get native window handle (HWND in case of Win32 and Widget in case of X Window) */
141
+ CVAPI(void*) cvGetWindowHandle( const char* name );
142
+
143
+ /* get name of highgui window given its native handle */
144
+ CVAPI(const char*) cvGetWindowName( void* window_handle );
145
+
146
+
147
+ typedef void (CV_CDECL *CvTrackbarCallback)(int pos);
148
+
149
+ /* create trackbar and display it on top of given window, set callback */
150
+ CVAPI(int) cvCreateTrackbar( const char* trackbar_name, const char* window_name,
151
+ int* value, int count, CvTrackbarCallback on_change CV_DEFAULT(NULL));
152
+
153
+ typedef void (CV_CDECL *CvTrackbarCallback2)(int pos, void* userdata);
154
+
155
+ CVAPI(int) cvCreateTrackbar2( const char* trackbar_name, const char* window_name,
156
+ int* value, int count, CvTrackbarCallback2 on_change,
157
+ void* userdata CV_DEFAULT(0));
158
+
159
+ /* retrieve or set trackbar position */
160
+ CVAPI(int) cvGetTrackbarPos( const char* trackbar_name, const char* window_name );
161
+ CVAPI(void) cvSetTrackbarPos( const char* trackbar_name, const char* window_name, int pos );
162
+
163
+ enum
164
+ {
165
+ CV_EVENT_MOUSEMOVE =0,
166
+ CV_EVENT_LBUTTONDOWN =1,
167
+ CV_EVENT_RBUTTONDOWN =2,
168
+ CV_EVENT_MBUTTONDOWN =3,
169
+ CV_EVENT_LBUTTONUP =4,
170
+ CV_EVENT_RBUTTONUP =5,
171
+ CV_EVENT_MBUTTONUP =6,
172
+ CV_EVENT_LBUTTONDBLCLK =7,
173
+ CV_EVENT_RBUTTONDBLCLK =8,
174
+ CV_EVENT_MBUTTONDBLCLK =9
175
+ };
176
+
177
+ enum
178
+ {
179
+ CV_EVENT_FLAG_LBUTTON =1,
180
+ CV_EVENT_FLAG_RBUTTON =2,
181
+ CV_EVENT_FLAG_MBUTTON =4,
182
+ CV_EVENT_FLAG_CTRLKEY =8,
183
+ CV_EVENT_FLAG_SHIFTKEY =16,
184
+ CV_EVENT_FLAG_ALTKEY =32
185
+ };
186
+
187
+ typedef void (CV_CDECL *CvMouseCallback )(int event, int x, int y, int flags, void* param);
188
+
189
+ /* assign callback for mouse events */
190
+ CVAPI(void) cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse,
191
+ void* param CV_DEFAULT(NULL));
192
+
193
+ enum
194
+ {
195
+ /* 8bit, color or not */
196
+ CV_LOAD_IMAGE_UNCHANGED =-1,
197
+ /* 8bit, gray */
198
+ CV_LOAD_IMAGE_GRAYSCALE =0,
199
+ /* ?, color */
200
+ CV_LOAD_IMAGE_COLOR =1,
201
+ /* any depth, ? */
202
+ CV_LOAD_IMAGE_ANYDEPTH =2,
203
+ /* ?, any color */
204
+ CV_LOAD_IMAGE_ANYCOLOR =4
205
+ };
206
+
207
+ /* load image from file
208
+ iscolor can be a combination of above flags where CV_LOAD_IMAGE_UNCHANGED
209
+ overrides the other flags
210
+ using CV_LOAD_IMAGE_ANYCOLOR alone is equivalent to CV_LOAD_IMAGE_UNCHANGED
211
+ unless CV_LOAD_IMAGE_ANYDEPTH is specified images are converted to 8bit
212
+ */
213
+ CVAPI(IplImage*) cvLoadImage( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
214
+ CVAPI(CvMat*) cvLoadImageM( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
215
+
216
+ enum
217
+ {
218
+ CV_IMWRITE_JPEG_QUALITY =1,
219
+ CV_IMWRITE_PNG_COMPRESSION =16,
220
+ CV_IMWRITE_PXM_BINARY =32
221
+ };
222
+
223
+ /* save image to file */
224
+ CVAPI(int) cvSaveImage( const char* filename, const CvArr* image,
225
+ const int* params CV_DEFAULT(0) );
226
+
227
+ /* decode image stored in the buffer */
228
+ CVAPI(IplImage*) cvDecodeImage( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
229
+ CVAPI(CvMat*) cvDecodeImageM( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
230
+
231
+ /* encode image and store the result as a byte vector (single-row 8uC1 matrix) */
232
+ CVAPI(CvMat*) cvEncodeImage( const char* ext, const CvArr* image,
233
+ const int* params CV_DEFAULT(0) );
234
+
235
+ enum
236
+ {
237
+ CV_CVTIMG_FLIP =1,
238
+ CV_CVTIMG_SWAP_RB =2
239
+ };
240
+
241
+ /* utility function: convert one image to another with optional vertical flip */
242
+ CVAPI(void) cvConvertImage( const CvArr* src, CvArr* dst, int flags CV_DEFAULT(0));
243
+
244
+ /* wait for key event infinitely (delay<=0) or for "delay" milliseconds */
245
+ CVAPI(int) cvWaitKey(int delay CV_DEFAULT(0));
246
+
247
+ /****************************************************************************************\
248
+ * Working with Video Files and Cameras *
249
+ \****************************************************************************************/
250
+
251
+ /* "black box" capture structure */
252
+ typedef struct CvCapture CvCapture;
253
+
254
+ /* start capturing frames from video file */
255
+ CVAPI(CvCapture*) cvCreateFileCapture( const char* filename );
256
+
257
+ enum
258
+ {
259
+ CV_CAP_ANY =0, // autodetect
260
+
261
+ CV_CAP_MIL =100, // MIL proprietary drivers
262
+
263
+ CV_CAP_VFW =200, // platform native
264
+ CV_CAP_V4L =200,
265
+ CV_CAP_V4L2 =200,
266
+
267
+ CV_CAP_FIREWARE =300, // IEEE 1394 drivers
268
+ CV_CAP_FIREWIRE =300,
269
+ CV_CAP_IEEE1394 =300,
270
+ CV_CAP_DC1394 =300,
271
+ CV_CAP_CMU1394 =300,
272
+
273
+ CV_CAP_STEREO =400, // TYZX proprietary drivers
274
+ CV_CAP_TYZX =400,
275
+ CV_TYZX_LEFT =400,
276
+ CV_TYZX_RIGHT =401,
277
+ CV_TYZX_COLOR =402,
278
+ CV_TYZX_Z =403,
279
+
280
+ CV_CAP_QT =500, // QuickTime
281
+
282
+ CV_CAP_UNICAP =600, // Unicap drivers
283
+
284
+ CV_CAP_DSHOW =700, // DirectShow (via videoInput)
285
+
286
+ CV_CAP_PVAPI =800, // PvAPI, Prosilica GigE SDK
287
+
288
+ CV_CAP_OPENNI =900, // OpenNI (for Kinect)
289
+
290
+ CV_CAP_ANDROID =1000, // Android
291
+
292
+ CV_CAP_XIAPI =1100 // XIMEA Camera API
293
+ };
294
+
295
+ /* start capturing frames from camera: index = camera_index + domain_offset (CV_CAP_*) */
296
+ CVAPI(CvCapture*) cvCreateCameraCapture( int index );
297
+
298
+ /* grab a frame, return 1 on success, 0 on fail.
299
+ this function is thought to be fast */
300
+ CVAPI(int) cvGrabFrame( CvCapture* capture );
301
+
302
+ /* get the frame grabbed with cvGrabFrame(..)
303
+ This function may apply some frame processing like
304
+ frame decompression, flipping etc.
305
+ !!!DO NOT RELEASE or MODIFY the retrieved frame!!! */
306
+ CVAPI(IplImage*) cvRetrieveFrame( CvCapture* capture, int streamIdx CV_DEFAULT(0) );
307
+
308
+ /* Just a combination of cvGrabFrame and cvRetrieveFrame
309
+ !!!DO NOT RELEASE or MODIFY the retrieved frame!!! */
310
+ CVAPI(IplImage*) cvQueryFrame( CvCapture* capture );
311
+
312
+ /* stop capturing/reading and free resources */
313
+ CVAPI(void) cvReleaseCapture( CvCapture** capture );
314
+
315
+ enum
316
+ {
317
+ // modes of the controlling registers (can be: auto, manual, auto single push, absolute Latter allowed with any other mode)
318
+ // every feature can have only one mode turned on at a time
319
+ CV_CAP_PROP_DC1394_OFF = -4, //turn the feature off (not controlled manually nor automatically)
320
+ CV_CAP_PROP_DC1394_MODE_MANUAL = -3, //set automatically when a value of the feature is set by the user
321
+ CV_CAP_PROP_DC1394_MODE_AUTO = -2,
322
+ CV_CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1,
323
+ CV_CAP_PROP_POS_MSEC =0,
324
+ CV_CAP_PROP_POS_FRAMES =1,
325
+ CV_CAP_PROP_POS_AVI_RATIO =2,
326
+ CV_CAP_PROP_FRAME_WIDTH =3,
327
+ CV_CAP_PROP_FRAME_HEIGHT =4,
328
+ CV_CAP_PROP_FPS =5,
329
+ CV_CAP_PROP_FOURCC =6,
330
+ CV_CAP_PROP_FRAME_COUNT =7,
331
+ CV_CAP_PROP_FORMAT =8,
332
+ CV_CAP_PROP_MODE =9,
333
+ CV_CAP_PROP_BRIGHTNESS =10,
334
+ CV_CAP_PROP_CONTRAST =11,
335
+ CV_CAP_PROP_SATURATION =12,
336
+ CV_CAP_PROP_HUE =13,
337
+ CV_CAP_PROP_GAIN =14,
338
+ CV_CAP_PROP_EXPOSURE =15,
339
+ CV_CAP_PROP_CONVERT_RGB =16,
340
+ CV_CAP_PROP_WHITE_BALANCE_BLUE_U =17,
341
+ CV_CAP_PROP_RECTIFICATION =18,
342
+ CV_CAP_PROP_MONOCROME =19,
343
+ CV_CAP_PROP_SHARPNESS =20,
344
+ CV_CAP_PROP_AUTO_EXPOSURE =21, // exposure control done by camera,
345
+ // user can adjust refernce level
346
+ // using this feature
347
+ CV_CAP_PROP_GAMMA =22,
348
+ CV_CAP_PROP_TEMPERATURE =23,
349
+ CV_CAP_PROP_TRIGGER =24,
350
+ CV_CAP_PROP_TRIGGER_DELAY =25,
351
+ CV_CAP_PROP_WHITE_BALANCE_RED_V =26,
352
+ CV_CAP_PROP_MAX_DC1394 =27,
353
+ CV_CAP_PROP_AUTOGRAB =1024, // property for highgui class CvCapture_Android only
354
+ CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING=1025, // readonly, tricky property, returns cpnst char* indeed
355
+ CV_CAP_PROP_PREVIEW_FORMAT=1026, // readonly, tricky property, returns cpnst char* indeed
356
+ // OpenNI map generators
357
+ CV_CAP_OPENNI_DEPTH_GENERATOR = 0,
358
+ CV_CAP_OPENNI_IMAGE_GENERATOR = 1 << 31,
359
+ CV_CAP_OPENNI_GENERATORS_MASK = 1 << 31,
360
+
361
+ // Properties of cameras available through OpenNI interfaces
362
+ CV_CAP_PROP_OPENNI_OUTPUT_MODE = 100,
363
+ CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH = 101, // in mm
364
+ CV_CAP_PROP_OPENNI_BASELINE = 102, // in mm
365
+ CV_CAP_PROP_OPENNI_FOCAL_LENGTH = 103, // in pixels
366
+ CV_CAP_PROP_OPENNI_REGISTRATION_ON = 104, // flag
367
+ CV_CAP_PROP_OPENNI_REGISTRATION = CV_CAP_PROP_OPENNI_REGISTRATION_ON, // flag that synchronizes the remapping depth map to image map
368
+ // by changing depth generator's view point (if the flag is "on") or
369
+ // sets this view point to its normal one (if the flag is "off").
370
+ CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_OUTPUT_MODE,
371
+ CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_BASELINE,
372
+ CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_FOCAL_LENGTH,
373
+ CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_REGISTRATION_ON,
374
+
375
+ // Properties of cameras available through GStreamer interface
376
+ CV_CAP_GSTREAMER_QUEUE_LENGTH = 200, // default is 1
377
+ CV_CAP_PROP_PVAPI_MULTICASTIP = 300, // ip for anable multicast master mode. 0 for disable multicast
378
+
379
+ // Properties of cameras available through XIMEA SDK interface
380
+ CV_CAP_PROP_XI_DOWNSAMPLING = 400, // Change image resolution by binning or skipping.
381
+ CV_CAP_PROP_XI_DATA_FORMAT = 401, // Output data format.
382
+ CV_CAP_PROP_XI_OFFSET_X = 402, // Horizontal offset from the origin to the area of interest (in pixels).
383
+ CV_CAP_PROP_XI_OFFSET_Y = 403, // Vertical offset from the origin to the area of interest (in pixels).
384
+ CV_CAP_PROP_XI_TRG_SOURCE = 404, // Defines source of trigger.
385
+ CV_CAP_PROP_XI_TRG_SOFTWARE = 405, // Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE.
386
+ CV_CAP_PROP_XI_GPI_SELECTOR = 406, // Selects general purpose input
387
+ CV_CAP_PROP_XI_GPI_MODE = 407, // Set general purpose input mode
388
+ CV_CAP_PROP_XI_GPI_LEVEL = 408, // Get general purpose level
389
+ CV_CAP_PROP_XI_GPO_SELECTOR = 409, // Selects general purpose output
390
+ CV_CAP_PROP_XI_GPO_MODE = 410, // Set general purpose output mode
391
+ CV_CAP_PROP_XI_LED_SELECTOR = 411, // Selects camera signalling LED
392
+ CV_CAP_PROP_XI_LED_MODE = 412, // Define camera signalling LED functionality
393
+ CV_CAP_PROP_XI_MANUAL_WB = 413, // Calculates White Balance(must be called during acquisition)
394
+ CV_CAP_PROP_XI_AUTO_WB = 414, // Automatic white balance
395
+ CV_CAP_PROP_XI_AEAG = 415, // Automatic exposure/gain
396
+ CV_CAP_PROP_XI_EXP_PRIORITY = 416, // Exposure priority (0.5 - exposure 50%, gain 50%).
397
+ CV_CAP_PROP_XI_AE_MAX_LIMIT = 417, // Maximum limit of exposure in AEAG procedure
398
+ CV_CAP_PROP_XI_AG_MAX_LIMIT = 418, // Maximum limit of gain in AEAG procedure
399
+ CV_CAP_PROP_XI_AEAG_LEVEL = 419, // Average intensity of output signal AEAG should achieve(in %)
400
+ CV_CAP_PROP_XI_TIMEOUT = 420 // Image capture timeout in milliseconds
401
+ };
402
+
403
+ enum
404
+ {
405
+ // Data given from depth generator.
406
+ CV_CAP_OPENNI_DEPTH_MAP = 0, // Depth values in mm (CV_16UC1)
407
+ CV_CAP_OPENNI_POINT_CLOUD_MAP = 1, // XYZ in meters (CV_32FC3)
408
+ CV_CAP_OPENNI_DISPARITY_MAP = 2, // Disparity in pixels (CV_8UC1)
409
+ CV_CAP_OPENNI_DISPARITY_MAP_32F = 3, // Disparity in pixels (CV_32FC1)
410
+ CV_CAP_OPENNI_VALID_DEPTH_MASK = 4, // CV_8UC1
411
+
412
+ // Data given from RGB image generator.
413
+ CV_CAP_OPENNI_BGR_IMAGE = 5,
414
+ CV_CAP_OPENNI_GRAY_IMAGE = 6
415
+ };
416
+
417
+ // Supported output modes of OpenNI image generator
418
+ enum
419
+ {
420
+ CV_CAP_OPENNI_VGA_30HZ = 0,
421
+ CV_CAP_OPENNI_SXGA_15HZ = 1
422
+ };
423
+
424
+ //supported by Android camera output formats
425
+ enum
426
+ {
427
+ CV_CAP_ANDROID_COLOR_FRAME_BGR = 0, //BGR
428
+ CV_CAP_ANDROID_COLOR_FRAME = CV_CAP_ANDROID_COLOR_FRAME_BGR,
429
+ CV_CAP_ANDROID_GREY_FRAME = 1, //Y
430
+ CV_CAP_ANDROID_COLOR_FRAME_RGB = 2,
431
+ CV_CAP_ANDROID_COLOR_FRAME_BGRA = 3,
432
+ CV_CAP_ANDROID_COLOR_FRAME_RGBA = 4
433
+ };
434
+
435
+ /* retrieve or set capture properties */
436
+ CVAPI(double) cvGetCaptureProperty( CvCapture* capture, int property_id );
437
+ CVAPI(int) cvSetCaptureProperty( CvCapture* capture, int property_id, double value );
438
+
439
+ // Return the type of the capturer (eg, CV_CAP_V4W, CV_CAP_UNICAP), which is unknown if created with CV_CAP_ANY
440
+ CVAPI(int) cvGetCaptureDomain( CvCapture* capture);
441
+
442
+ /* "black box" video file writer structure */
443
+ typedef struct CvVideoWriter CvVideoWriter;
444
+
445
+ CV_INLINE int CV_FOURCC(char c1, char c2, char c3, char c4)
446
+ {
447
+ return (c1 & 255) + ((c2 & 255) << 8) + ((c3 &255) << 16) + ((c4 & 255) << 24);
448
+ }
449
+
450
+ #define CV_FOURCC_PROMPT -1 /* Open Codec Selection Dialog (Windows only) */
451
+ #define CV_FOURCC_DEFAULT CV_FOURCC('I', 'Y', 'U', 'V') /* Use default codec for specified filename (Linux only) */
452
+
453
+ /* initialize video file writer */
454
+ CVAPI(CvVideoWriter*) cvCreateVideoWriter( const char* filename, int fourcc,
455
+ double fps, CvSize frame_size,
456
+ int is_color CV_DEFAULT(1));
457
+
458
+ //CVAPI(CvVideoWriter*) cvCreateImageSequenceWriter( const char* filename,
459
+ // int is_color CV_DEFAULT(1));
460
+
461
+ /* write frame to video file */
462
+ CVAPI(int) cvWriteFrame( CvVideoWriter* writer, const IplImage* image );
463
+
464
+ /* close video file writer */
465
+ CVAPI(void) cvReleaseVideoWriter( CvVideoWriter** writer );
466
+
467
+ /****************************************************************************************\
468
+ * Obsolete functions/synonyms *
469
+ \****************************************************************************************/
470
+
471
+ #define cvCaptureFromFile cvCreateFileCapture
472
+ #define cvCaptureFromCAM cvCreateCameraCapture
473
+ #define cvCaptureFromAVI cvCaptureFromFile
474
+ #define cvCreateAVIWriter cvCreateVideoWriter
475
+ #define cvWriteToAVI cvWriteFrame
476
+ #define cvAddSearchPath(path)
477
+ #define cvvInitSystem cvInitSystem
478
+ #define cvvNamedWindow cvNamedWindow
479
+ #define cvvShowImage cvShowImage
480
+ #define cvvResizeWindow cvResizeWindow
481
+ #define cvvDestroyWindow cvDestroyWindow
482
+ #define cvvCreateTrackbar cvCreateTrackbar
483
+ #define cvvLoadImage(name) cvLoadImage((name),1)
484
+ #define cvvSaveImage cvSaveImage
485
+ #define cvvAddSearchPath cvAddSearchPath
486
+ #define cvvWaitKey(name) cvWaitKey(0)
487
+ #define cvvWaitKeyEx(name,delay) cvWaitKey(delay)
488
+ #define cvvConvertImage cvConvertImage
489
+ #define HG_AUTOSIZE CV_WINDOW_AUTOSIZE
490
+ #define set_preprocess_func cvSetPreprocessFuncWin32
491
+ #define set_postprocess_func cvSetPostprocessFuncWin32
492
+
493
+ #if defined WIN32 || defined _WIN32
494
+
495
+ CVAPI(void) cvSetPreprocessFuncWin32_(const void* callback);
496
+ CVAPI(void) cvSetPostprocessFuncWin32_(const void* callback);
497
+ #define cvSetPreprocessFuncWin32(callback) cvSetPreprocessFuncWin32_((const void*)(callback))
498
+ #define cvSetPostprocessFuncWin32(callback) cvSetPostprocessFuncWin32_((const void*)(callback))
499
+
500
+ #endif
501
+
502
+ #ifdef __cplusplus
503
+ }
504
+ #endif
505
+
506
+ #endif