1 | |
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 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | #include "precomp.hpp"
|
51 | #include "opencv2/core/opengl_interop.hpp"
|
52 |
|
53 |
|
54 |
|
55 | CV_IMPL void cvSetWindowProperty(const char* name, int prop_id, double prop_value)
|
56 | {
|
57 | switch(prop_id)
|
58 | {
|
59 |
|
60 | case CV_WND_PROP_FULLSCREEN:
|
61 |
|
62 | if (!name || (prop_value!=CV_WINDOW_NORMAL && prop_value!=CV_WINDOW_FULLSCREEN))
|
63 | break;
|
64 |
|
65 | #if defined (HAVE_QT)
|
66 | cvSetModeWindow_QT(name,prop_value);
|
67 | #elif defined WIN32 || defined _WIN32
|
68 | cvSetModeWindow_W32(name,prop_value);
|
69 | #elif defined (HAVE_GTK)
|
70 | cvSetModeWindow_GTK(name,prop_value);
|
71 | #elif defined (HAVE_CARBON)
|
72 | cvSetModeWindow_CARBON(name,prop_value);
|
73 | #elif defined (HAVE_COCOA)
|
74 | cvSetModeWindow_COCOA(name,prop_value);
|
75 | #endif
|
76 | break;
|
77 |
|
78 | case CV_WND_PROP_AUTOSIZE:
|
79 | #if defined (HAVE_QT)
|
80 | cvSetPropWindow_QT(name,prop_value);
|
81 | #endif
|
82 | break;
|
83 |
|
84 | case CV_WND_PROP_ASPECTRATIO:
|
85 | #if defined (HAVE_QT)
|
86 | cvSetRatioWindow_QT(name,prop_value);
|
87 | #endif
|
88 | break;
|
89 |
|
90 | default:;
|
91 | }
|
92 | }
|
93 |
|
94 |
|
95 | CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
|
96 | {
|
97 | if (!name)
|
98 | return -1;
|
99 |
|
100 | switch(prop_id)
|
101 | {
|
102 | case CV_WND_PROP_FULLSCREEN:
|
103 |
|
104 | #if defined (HAVE_QT)
|
105 | return cvGetModeWindow_QT(name);
|
106 | #elif defined WIN32 || defined _WIN32
|
107 | return cvGetModeWindow_W32(name);
|
108 | #elif defined (HAVE_GTK)
|
109 | return cvGetModeWindow_GTK(name);
|
110 | #elif defined (HAVE_CARBON)
|
111 | return cvGetModeWindow_CARBON(name);
|
112 | #elif defined (HAVE_COCOA)
|
113 | return cvGetModeWindow_COCOA(name);
|
114 | #else
|
115 | return -1;
|
116 | #endif
|
117 | break;
|
118 |
|
119 | case CV_WND_PROP_AUTOSIZE:
|
120 |
|
121 | #if defined (HAVE_QT)
|
122 | return cvGetPropWindow_QT(name);
|
123 | #elif defined WIN32 || defined _WIN32
|
124 | return cvGetPropWindowAutoSize_W32(name);
|
125 | #elif defined (HAVE_GTK)
|
126 | return cvGetPropWindowAutoSize_GTK(name);
|
127 | #else
|
128 | return -1;
|
129 | #endif
|
130 | break;
|
131 |
|
132 | case CV_WND_PROP_ASPECTRATIO:
|
133 |
|
134 | #if defined (HAVE_QT)
|
135 | return cvGetRatioWindow_QT(name);
|
136 | #elif defined WIN32 || defined _WIN32
|
137 | return cvGetRatioWindow_W32(name);
|
138 | #elif defined (HAVE_GTK)
|
139 | return cvGetRatioWindow_GTK(name);
|
140 | #else
|
141 | return -1;
|
142 | #endif
|
143 | break;
|
144 |
|
145 | case CV_WND_PROP_OPENGL:
|
146 |
|
147 | #if defined (HAVE_QT)
|
148 | return cvGetOpenGlProp_QT(name);
|
149 | #elif defined WIN32 || defined _WIN32
|
150 | return cvGetOpenGlProp_W32(name);
|
151 | #elif defined (HAVE_GTK)
|
152 | return cvGetOpenGlProp_GTK(name);
|
153 | #else
|
154 | return -1;
|
155 | #endif
|
156 | break;
|
157 |
|
158 | default:
|
159 | return -1;
|
160 | }
|
161 | }
|
162 |
|
163 | void cv::namedWindow( const string& winname, int flags )
|
164 | {
|
165 | cvNamedWindow( winname.c_str(), flags );
|
166 | }
|
167 |
|
168 | void cv::destroyWindow( const string& winname )
|
169 | {
|
170 | cvDestroyWindow( winname.c_str() );
|
171 | }
|
172 |
|
173 | void cv::destroyAllWindows()
|
174 | {
|
175 | cvDestroyAllWindows();
|
176 | }
|
177 |
|
178 | void cv::resizeWindow( const string& winname, int width, int height )
|
179 | {
|
180 | cvResizeWindow( winname.c_str(), width, height );
|
181 | }
|
182 |
|
183 | void cv::moveWindow( const string& winname, int x, int y )
|
184 | {
|
185 | cvMoveWindow( winname.c_str(), x, y );
|
186 | }
|
187 |
|
188 |
|
189 |
|
190 | void cv::adjustWindowPos( const string& winname, int xp, int xwp, int yp, int yhp )
|
191 | {
|
192 | #ifdef _WIN32
|
193 | int cx,cy;
|
194 | cx = GetSystemMetrics(SM_CXSCREEN);
|
195 | cy = GetSystemMetrics(SM_CYSCREEN);
|
196 | int x = 0.01 * ( xp * cx );
|
197 | int y = 0.01 * ( yp * cy );
|
198 | int neww = 0.01 * (xwp * cx );
|
199 | int newh = 0.01 * (yhp * cy );
|
200 | cvMoveWindow( winname.c_str(), x, y );
|
201 | cvResizeWindow( winname.c_str(),neww, newh );
|
202 | #else
|
203 | #if defined(HAVE_QT)
|
204 | cvAdjustWindowPos_Qt( winname.c_str(), xp, xwp, yp, yhp );
|
205 | #endif
|
206 | #if defined(HAVE_GTK)
|
207 |
|
208 | #endif
|
209 | #endif
|
210 | }
|
211 |
|
212 | void cv::dispInfoBox( const string& winname, char* caption, const string& text )
|
213 | {
|
214 | #if defined(HAVE_QT)
|
215 | cvDispInfoBox_Qt( winname.c_str(), caption, text.c_str() );
|
216 | #endif
|
217 | }
|
218 |
|
219 | int cv::getButtonBarContent(const string& winname, int idx, char * txt )
|
220 | {
|
221 | #if defined(HAVE_QT)
|
222 | return cvGetButtonBarContent( winname.c_str(), idx, txt );
|
223 | #endif
|
224 | return 0;
|
225 | }
|
226 |
|
227 | int cv::setButtonBarContent(const string& winname, int etype, int idx, char * txt )
|
228 | {
|
229 | #if defined(HAVE_QT)
|
230 | return cvSetButtonBarContent( winname.c_str(), etype, idx, txt );
|
231 | #endif
|
232 | return 0;
|
233 | }
|
234 |
|
235 |
|
236 |
|
237 |
|
238 | void cv::setWindowProperty(const string& winname, int prop_id, double prop_value)
|
239 | {
|
240 | cvSetWindowProperty( winname.c_str(), prop_id, prop_value);
|
241 | }
|
242 |
|
243 | double cv::getWindowProperty(const string& winname, int prop_id)
|
244 | {
|
245 | return cvGetWindowProperty(winname.c_str(), prop_id);
|
246 | }
|
247 |
|
248 | int cv::waitKey(int delay)
|
249 | {
|
250 | return cvWaitKey(delay);
|
251 | }
|
252 |
|
253 | int cv::createTrackbar(const string& trackbarName, const string& winName,
|
254 | int* value, int count, TrackbarCallback callback,
|
255 | void* userdata)
|
256 | {
|
257 | return cvCreateTrackbar2(trackbarName.c_str(), winName.c_str(),
|
258 | value, count, callback, userdata);
|
259 | }
|
260 |
|
261 | void cv::setTrackbarPos( const string& trackbarName, const string& winName, int value )
|
262 | {
|
263 | cvSetTrackbarPos(trackbarName.c_str(), winName.c_str(), value );
|
264 | }
|
265 |
|
266 | int cv::getTrackbarPos( const string& trackbarName, const string& winName )
|
267 | {
|
268 | return cvGetTrackbarPos(trackbarName.c_str(), winName.c_str());
|
269 | }
|
270 |
|
271 | void cv::setMouseCallback( const string& windowName, MouseCallback onMouse, void* param)
|
272 | {
|
273 | cvSetMouseCallback(windowName.c_str(), onMouse, param);
|
274 | }
|
275 |
|
276 | int cv::startWindowThread()
|
277 | {
|
278 | return cvStartWindowThread();
|
279 | }
|
280 |
|
281 |
|
282 |
|
283 | void cv::setOpenGlDrawCallback(const string& name, OpenGlDrawCallback callback, void* userdata)
|
284 | {
|
285 | cvSetOpenGlDrawCallback(name.c_str(), callback, userdata);
|
286 | }
|
287 |
|
288 | void cv::setOpenGlContext(const string& windowName)
|
289 | {
|
290 | cvSetOpenGlContext(windowName.c_str());
|
291 | }
|
292 |
|
293 | void cv::updateWindow(const string& windowName)
|
294 | {
|
295 | cvUpdateWindow(windowName.c_str());
|
296 | }
|
297 |
|
298 | #ifdef HAVE_OPENGL
|
299 | namespace
|
300 | {
|
301 | const int CV_TEXTURE_MAGIC_VAL = 0x00287653;
|
302 | const int CV_POINT_CLOUD_MAGIC_VAL = 0x00287654;
|
303 |
|
304 | struct GlObjBase
|
305 | {
|
306 | int flag;
|
307 | GlObjBase* next;
|
308 | GlObjBase* prev;
|
309 | std::string winname;
|
310 |
|
311 | virtual ~GlObjBase() {}
|
312 | };
|
313 |
|
314 | GlObjBase* g_glObjs = 0;
|
315 |
|
316 | GlObjBase* findGlObjByName(const std::string& winname)
|
317 | {
|
318 | GlObjBase* obj = g_glObjs;
|
319 |
|
320 | while(obj && obj->winname != winname)
|
321 | obj = obj->next;
|
322 |
|
323 | return obj;
|
324 | }
|
325 |
|
326 | void addGlObj(GlObjBase* glObj)
|
327 | {
|
328 | glObj->next = g_glObjs;
|
329 | glObj->prev = 0;
|
330 | if (g_glObjs)
|
331 | g_glObjs->prev = glObj;
|
332 | g_glObjs = glObj;
|
333 | }
|
334 |
|
335 | void removeGlObj(GlObjBase* glObj)
|
336 | {
|
337 | if (glObj->prev)
|
338 | glObj->prev->next = glObj->next;
|
339 | else
|
340 | g_glObjs = glObj->next;
|
341 |
|
342 | if (glObj->next)
|
343 | glObj->next->prev = glObj->prev;
|
344 |
|
345 | delete glObj;
|
346 | }
|
347 |
|
348 | struct GlObjTex : GlObjBase
|
349 | {
|
350 | cv::GlTexture tex;
|
351 | };
|
352 |
|
353 | void CV_CDECL glDrawTextureCallback(void* userdata)
|
354 | {
|
355 | GlObjTex* texObj = static_cast<GlObjTex*>(userdata);
|
356 |
|
357 | CV_DbgAssert(texObj->flag == CV_TEXTURE_MAGIC_VAL);
|
358 |
|
359 | static cv::GlCamera glCamera;
|
360 |
|
361 | glCamera.setupProjectionMatrix();
|
362 |
|
363 | cv::render(texObj->tex);
|
364 | }
|
365 |
|
366 | struct GlObjPointCloud : GlObjBase
|
367 | {
|
368 | cv::GlArrays arr;
|
369 | cv::GlCamera camera;
|
370 | };
|
371 |
|
372 | void CV_CDECL glDrawPointCloudCallback(void* userdata)
|
373 | {
|
374 | GlObjPointCloud* pointCloudObj = static_cast<GlObjPointCloud*>(userdata);
|
375 |
|
376 | CV_DbgAssert(pointCloudObj->flag == CV_POINT_CLOUD_MAGIC_VAL);
|
377 |
|
378 | pointCloudObj->camera.setupProjectionMatrix();
|
379 | pointCloudObj->camera.setupModelViewMatrix();
|
380 |
|
381 | cv::render(pointCloudObj->arr);
|
382 | }
|
383 |
|
384 | void CV_CDECL glCleanCallback(void* userdata)
|
385 | {
|
386 | GlObjBase* glObj = static_cast<GlObjBase*>(userdata);
|
387 |
|
388 | removeGlObj(glObj);
|
389 | }
|
390 | }
|
391 | #endif
|
392 |
|
393 | void cv::imshow( const string& winname, InputArray _img )
|
394 | {
|
395 | #ifndef HAVE_OPENGL
|
396 | Mat img = _img.getMat();
|
397 | CvMat c_img = img;
|
398 | cvShowImage(winname.c_str(), &c_img);
|
399 | #else
|
400 | double useGl = getWindowProperty(winname, WND_PROP_OPENGL);
|
401 | if (useGl <= 0)
|
402 | {
|
403 | Mat img = _img.getMat();
|
404 | CvMat c_img = img;
|
405 | cvShowImage(winname.c_str(), &c_img);
|
406 | }
|
407 | else
|
408 | {
|
409 | double autoSize = getWindowProperty(winname, WND_PROP_AUTOSIZE);
|
410 |
|
411 | if (autoSize > 0)
|
412 | {
|
413 | Size size = _img.size();
|
414 | resizeWindow(winname, size.width, size.height);
|
415 | }
|
416 |
|
417 | setOpenGlContext(winname);
|
418 |
|
419 | GlObjBase* glObj = findGlObjByName(winname);
|
420 |
|
421 | if (glObj && glObj->flag != CV_TEXTURE_MAGIC_VAL)
|
422 | {
|
423 | icvSetOpenGlCleanCallback(winname.c_str(), 0, 0);
|
424 | glObj = 0;
|
425 | }
|
426 |
|
427 | if (glObj)
|
428 | {
|
429 | GlObjTex* texObj = static_cast<GlObjTex*>(glObj);
|
430 | texObj->tex.copyFrom(_img);
|
431 | }
|
432 | else
|
433 | {
|
434 | GlObjTex* texObj = new GlObjTex;
|
435 | texObj->tex.copyFrom(_img);
|
436 |
|
437 | glObj = texObj;
|
438 | glObj->flag = CV_TEXTURE_MAGIC_VAL;
|
439 | glObj->winname = winname;
|
440 |
|
441 | addGlObj(glObj);
|
442 |
|
443 | icvSetOpenGlCleanCallback(winname.c_str(), glCleanCallback, glObj);
|
444 | }
|
445 |
|
446 | setOpenGlDrawCallback(winname, glDrawTextureCallback, glObj);
|
447 |
|
448 | updateWindow(winname);
|
449 | }
|
450 | #endif
|
451 | }
|
452 |
|
453 | void cv::pointCloudShow(const string& winname, const GlCamera& camera, const GlArrays& arr)
|
454 | {
|
455 | #ifndef HAVE_OPENGL
|
456 | CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support");
|
457 | (void)winname;
|
458 | (void)camera;
|
459 | (void)arr;
|
460 | #else
|
461 | namedWindow(winname, WINDOW_OPENGL);
|
462 |
|
463 | setOpenGlContext(winname);
|
464 |
|
465 | GlObjBase* glObj = findGlObjByName(winname);
|
466 |
|
467 | if (glObj && glObj->flag != CV_POINT_CLOUD_MAGIC_VAL)
|
468 | {
|
469 | icvSetOpenGlCleanCallback(winname.c_str(), 0, 0);
|
470 | glObj = 0;
|
471 | }
|
472 |
|
473 | if (glObj)
|
474 | {
|
475 | GlObjPointCloud* pointCloudObj = static_cast<GlObjPointCloud*>(glObj);
|
476 | pointCloudObj->arr = arr;
|
477 | pointCloudObj->camera = camera;
|
478 | }
|
479 | else
|
480 | {
|
481 | GlObjPointCloud* pointCloudObj = new GlObjPointCloud;
|
482 | pointCloudObj->arr = arr;
|
483 | pointCloudObj->camera = camera;
|
484 |
|
485 | glObj = pointCloudObj;
|
486 | glObj->flag = CV_POINT_CLOUD_MAGIC_VAL;
|
487 | glObj->winname = winname;
|
488 |
|
489 | addGlObj(glObj);
|
490 |
|
491 | icvSetOpenGlCleanCallback(winname.c_str(), glCleanCallback, glObj);
|
492 | }
|
493 |
|
494 | setOpenGlDrawCallback(winname, glDrawPointCloudCallback, glObj);
|
495 |
|
496 | updateWindow(winname);
|
497 | #endif
|
498 | }
|
499 |
|
500 | void cv::pointCloudShow(const std::string& winname, const cv::GlCamera& camera, InputArray points, InputArray colors)
|
501 | {
|
502 | #ifndef HAVE_OPENGL
|
503 | (void)winname;
|
504 | (void)camera;
|
505 | (void)points;
|
506 | (void)colors;
|
507 | CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support");
|
508 | #else
|
509 | namedWindow(winname, WINDOW_OPENGL);
|
510 |
|
511 | setOpenGlContext(winname);
|
512 |
|
513 | GlObjBase* glObj = findGlObjByName(winname);
|
514 |
|
515 | if (glObj && glObj->flag != CV_POINT_CLOUD_MAGIC_VAL)
|
516 | {
|
517 | icvSetOpenGlCleanCallback(winname.c_str(), 0, 0);
|
518 | glObj = 0;
|
519 | }
|
520 |
|
521 | if (glObj)
|
522 | {
|
523 | GlObjPointCloud* pointCloudObj = static_cast<GlObjPointCloud*>(glObj);
|
524 |
|
525 | pointCloudObj->arr.setVertexArray(points);
|
526 | if (colors.empty())
|
527 | pointCloudObj->arr.resetColorArray();
|
528 | else
|
529 | pointCloudObj->arr.setColorArray(colors);
|
530 |
|
531 | pointCloudObj->camera = camera;
|
532 | }
|
533 | else
|
534 | {
|
535 | GlObjPointCloud* pointCloudObj = new GlObjPointCloud;
|
536 |
|
537 | pointCloudObj->arr.setVertexArray(points);
|
538 | if (!colors.empty())
|
539 | pointCloudObj->arr.setColorArray(colors);
|
540 |
|
541 | pointCloudObj->camera = camera;
|
542 |
|
543 | glObj = pointCloudObj;
|
544 | glObj->flag = CV_POINT_CLOUD_MAGIC_VAL;
|
545 | glObj->winname = winname;
|
546 |
|
547 | addGlObj(glObj);
|
548 |
|
549 | icvSetOpenGlCleanCallback(winname.c_str(), glCleanCallback, glObj);
|
550 | }
|
551 |
|
552 | setOpenGlDrawCallback(winname, glDrawPointCloudCallback, glObj);
|
553 |
|
554 | updateWindow(winname);
|
555 | #endif
|
556 | }
|
557 |
|
558 |
|
559 |
|
560 | #ifndef HAVE_OPENGL
|
561 |
|
562 | CV_IMPL void cvSetOpenGlDrawCallback(const char*, CvOpenGlDrawCallback, void*)
|
563 | {
|
564 | CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support");
|
565 | }
|
566 |
|
567 | CV_IMPL void cvSetOpenGlContext(const char*)
|
568 | {
|
569 | CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support");
|
570 | }
|
571 |
|
572 | CV_IMPL void cvUpdateWindow(const char*)
|
573 | {
|
574 | CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support");
|
575 | }
|
576 |
|
577 | void icvSetOpenGlCleanCallback(const char*, CvOpenGlCleanCallback, void*)
|
578 | {
|
579 | CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support");
|
580 | }
|
581 |
|
582 | #endif
|
583 |
|
584 | #if defined (HAVE_QT)
|
585 |
|
586 | CvFont cv::fontQt(const string& nameFont, int pointSize, Scalar color, int weight, int style, int )
|
587 | {
|
588 | return cvFontQt(nameFont.c_str(), pointSize,color,weight, style);
|
589 | }
|
590 |
|
591 | void cv::addText( const Mat& img, const string& text, Point org, CvFont font)
|
592 | {
|
593 | CvMat _img = img;
|
594 | cvAddText( &_img, text.c_str(), org,&font);
|
595 | }
|
596 |
|
597 | void cv::displayStatusBar(const string& name, const string& text, int delayms)
|
598 | {
|
599 | cvDisplayStatusBar(name.c_str(),text.c_str(), delayms);
|
600 | }
|
601 |
|
602 | void cv::displayOverlay(const string& name, const string& text, int delayms)
|
603 | {
|
604 | cvDisplayOverlay(name.c_str(),text.c_str(), delayms);
|
605 | }
|
606 |
|
607 | int cv::startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[])
|
608 | {
|
609 | return cvStartLoop(pt2Func, argc, argv);
|
610 | }
|
611 |
|
612 | void cv::stopLoop()
|
613 | {
|
614 | cvStopLoop();
|
615 | }
|
616 |
|
617 | void cv::saveWindowParameters(const string& windowName)
|
618 | {
|
619 | cvSaveWindowParameters(windowName.c_str());
|
620 | }
|
621 |
|
622 | void cv::loadWindowParameters(const string& windowName)
|
623 | {
|
624 | cvLoadWindowParameters(windowName.c_str());
|
625 | }
|
626 |
|
627 | int cv::createButton(const string& button_name, ButtonCallback on_change, void* userdata, int button_type , bool initial_button_state )
|
628 | {
|
629 | return cvCreateButton(button_name.c_str(), on_change, userdata, button_type , initial_button_state );
|
630 | }
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 | bool cv::getCommandVec( const string& winname, vector<string> & stringVec, char * cmd )
|
637 | {
|
638 | stringVec.clear();
|
639 |
|
640 | if ( cmd != NULL ) cvGetCommand( winname.c_str(), cmd );
|
641 |
|
642 | char buffer[512];
|
643 | int idx = 0;
|
644 | int iRet = 1;
|
645 | while ( iRet == 1 )
|
646 | {
|
647 | iRet = cvGetButtonBarContent( winname.c_str(), idx, buffer );
|
648 | if ( iRet == 1 ) stringVec.push_back( string(buffer) );
|
649 | idx++;
|
650 | }
|
651 | return true;
|
652 | }
|
653 |
|
654 |
|
655 | #else
|
656 |
|
657 | bool cv::getCommandVec( const string& winname, vector<string> & stringVec, char* cmd )
|
658 | {
|
659 | return false;
|
660 | }
|
661 |
|
662 | #endif
|
663 |
|
664 | #if defined WIN32 || defined _WIN32
|
665 | #elif defined (HAVE_GTK)
|
666 |
|
667 |
|
668 | #elif defined (HAVE_COCOA)
|
669 | #elif defined (HAVE_CARBON)
|
670 | #elif defined (HAVE_QT)
|
671 |
|
672 | #else
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 | #define CV_NO_GUI_ERROR(funcname) \
|
683 | cvError( CV_StsError, funcname, \
|
684 | "The function is not implemented. " \
|
685 | "Rebuild the library with Windows, GTK+ 2.x or Carbon support. "\
|
686 | "If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script", \
|
687 | __FILE__, __LINE__ )
|
688 |
|
689 |
|
690 | CV_IMPL int cvNamedWindow( const char*, int )
|
691 | {
|
692 | CV_NO_GUI_ERROR("cvNamedWindow");
|
693 | return -1;
|
694 | }
|
695 |
|
696 | CV_IMPL void cvDestroyWindow( const char* )
|
697 | {
|
698 | CV_NO_GUI_ERROR( "cvDestroyWindow" );
|
699 | }
|
700 |
|
701 | CV_IMPL void
|
702 | cvDestroyAllWindows( void )
|
703 | {
|
704 | CV_NO_GUI_ERROR( "cvDestroyAllWindows" );
|
705 | }
|
706 |
|
707 | CV_IMPL void
|
708 | cvShowImage( const char*, const CvArr* )
|
709 | {
|
710 | CV_NO_GUI_ERROR( "cvShowImage" );
|
711 | }
|
712 |
|
713 | CV_IMPL void cvResizeWindow( const char*, int, int )
|
714 | {
|
715 | CV_NO_GUI_ERROR( "cvResizeWindow" );
|
716 | }
|
717 |
|
718 | CV_IMPL void cvMoveWindow( const char*, int, int )
|
719 | {
|
720 | CV_NO_GUI_ERROR( "cvMoveWindow" );
|
721 | }
|
722 |
|
723 | CV_IMPL int
|
724 | cvCreateTrackbar( const char*, const char*,
|
725 | int*, int, CvTrackbarCallback )
|
726 | {
|
727 | CV_NO_GUI_ERROR( "cvCreateTrackbar" );
|
728 | return -1;
|
729 | }
|
730 |
|
731 | CV_IMPL int
|
732 | cvCreateTrackbar2( const char* , const char* ,
|
733 | int* , int , CvTrackbarCallback2 ,
|
734 | void* )
|
735 | {
|
736 | CV_NO_GUI_ERROR( "cvCreateTrackbar2" );
|
737 | return -1;
|
738 | }
|
739 |
|
740 | CV_IMPL void
|
741 | cvSetMouseCallback( const char*, CvMouseCallback, void* )
|
742 | {
|
743 | CV_NO_GUI_ERROR( "cvSetMouseCallback" );
|
744 | }
|
745 |
|
746 | CV_IMPL int cvGetTrackbarPos( const char*, const char* )
|
747 | {
|
748 | CV_NO_GUI_ERROR( "cvGetTrackbarPos" );
|
749 | return -1;
|
750 | }
|
751 |
|
752 | CV_IMPL void cvSetTrackbarPos( const char*, const char*, int )
|
753 | {
|
754 | CV_NO_GUI_ERROR( "cvSetTrackbarPos" );
|
755 | }
|
756 |
|
757 | CV_IMPL void* cvGetWindowHandle( const char* )
|
758 | {
|
759 | CV_NO_GUI_ERROR( "cvGetWindowHandle" );
|
760 | return 0;
|
761 | }
|
762 |
|
763 | CV_IMPL const char* cvGetWindowName( void* )
|
764 | {
|
765 | CV_NO_GUI_ERROR( "cvGetWindowName" );
|
766 | return 0;
|
767 | }
|
768 |
|
769 | CV_IMPL int cvWaitKey( int )
|
770 | {
|
771 | CV_NO_GUI_ERROR( "cvWaitKey" );
|
772 | return -1;
|
773 | }
|
774 |
|
775 | CV_IMPL int cvInitSystem( int , char** )
|
776 | {
|
777 |
|
778 | CV_NO_GUI_ERROR( "cvInitSystem" );
|
779 | return -1;
|
780 | }
|
781 |
|
782 | CV_IMPL int cvStartWindowThread()
|
783 | {
|
784 |
|
785 | CV_NO_GUI_ERROR( "cvStartWindowThread" );
|
786 | return -1;
|
787 | }
|
788 |
|
789 |
|
790 | CV_IMPL void cvAddText( const CvArr*, const char*, CvPoint , CvFont* )
|
791 | {
|
792 | CV_NO_GUI_ERROR("cvAddText");
|
793 | }
|
794 |
|
795 | CV_IMPL void cvDisplayStatusBar(const char* , const char* , int )
|
796 | {
|
797 | CV_NO_GUI_ERROR("cvDisplayStatusBar");
|
798 | }
|
799 |
|
800 | CV_IMPL void cvDisplayOverlay(const char* , const char* , int )
|
801 | {
|
802 | CV_NO_GUI_ERROR("cvNamedWindow");
|
803 | }
|
804 |
|
805 | CV_IMPL int cvStartLoop(int (*)(int argc, char *argv[]), int , char* argv[])
|
806 | {
|
807 | (void)argv;
|
808 | CV_NO_GUI_ERROR("cvStartLoop");
|
809 | return -1;
|
810 | }
|
811 |
|
812 | CV_IMPL void cvStopLoop()
|
813 | {
|
814 | CV_NO_GUI_ERROR("cvStopLoop");
|
815 | }
|
816 |
|
817 | CV_IMPL void cvSaveWindowParameters(const char* )
|
818 | {
|
819 | CV_NO_GUI_ERROR("cvSaveWindowParameters");
|
820 | }
|
821 |
|
822 |
|
823 |
|
824 |
|
825 |
|
826 |
|
827 | CV_IMPL int cvCreateButton(const char*, void (*)(int, void*), void*, int, int)
|
828 | {
|
829 | CV_NO_GUI_ERROR("cvCreateButton");
|
830 | return -1;
|
831 | }
|
832 |
|
833 | CV_IMPL int cvGetButtonBarContent(const char *, int, char * )
|
834 | {
|
835 |
|
836 | return -1;
|
837 | }
|
838 |
|
839 | CV_IMPL int cvSetButtonBarContent(const char *, int, int, char * )
|
840 | {
|
841 |
|
842 | return -1;
|
843 | }
|
844 |
|
845 | CV_IMPL int cvDispInfoBox_Qt( char*, char* , const char * )
|
846 | {
|
847 |
|
848 | return -1;
|
849 | }
|
850 |
|
851 | #endif
|
852 |
|
853 |
|