@@ -172,21 +172,23 @@ namespace cv
172
172
// ! @addtogroup highgui
173
173
// ! @{
174
174
175
- // Flags for namedWindow
176
- enum { WINDOW_NORMAL = 0x00000000 , // the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size
177
- WINDOW_AUTOSIZE = 0x00000001 , // the user cannot resize the window, the size is constrainted by the image displayed
178
- WINDOW_OPENGL = 0x00001000 , // window with opengl support
179
-
180
- WINDOW_FULLSCREEN = 1 , // change the window to fullscreen
181
- WINDOW_FREERATIO = 0x00000100 , // the image expends as much as it can (no ratio constraint)
182
- WINDOW_KEEPRATIO = 0x00000000 // the ratio of the image is respected
175
+ // ! Flags for cv::namedWindow
176
+ enum WindowFlags {
177
+ WINDOW_NORMAL = 0x00000000 , // !< the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size
178
+ WINDOW_AUTOSIZE = 0x00000001 , // !< the user cannot resize the window, the size is constrainted by the image displayed
179
+ WINDOW_OPENGL = 0x00001000 , // !< window with opengl support
180
+
181
+ WINDOW_FULLSCREEN = 1 , // !< change the window to fullscreen
182
+ WINDOW_FREERATIO = 0x00000100 , // !< the image expends as much as it can (no ratio constraint)
183
+ WINDOW_KEEPRATIO = 0x00000000 // !< the ratio of the image is respected
183
184
};
184
185
185
- // Flags for set / getWindowProperty
186
- enum { WND_PROP_FULLSCREEN = 0 , // fullscreen property (can be WINDOW_NORMAL or WINDOW_FULLSCREEN)
187
- WND_PROP_AUTOSIZE = 1 , // autosize property (can be WINDOW_NORMAL or WINDOW_AUTOSIZE)
188
- WND_PROP_ASPECT_RATIO = 2 , // window's aspect ration (can be set to WINDOW_FREERATIO or WINDOW_KEEPRATIO);
189
- WND_PROP_OPENGL = 3 // opengl support
186
+ // ! Flags for cv::setWindowProperty / cv::getWindowProperty
187
+ enum WindowPropertyFlags {
188
+ WND_PROP_FULLSCREEN = 0 , // !< fullscreen property (can be WINDOW_NORMAL or WINDOW_FULLSCREEN)
189
+ WND_PROP_AUTOSIZE = 1 , // !< autosize property (can be WINDOW_NORMAL or WINDOW_AUTOSIZE)
190
+ WND_PROP_ASPECT_RATIO = 2 , // !< window's aspect ration (can be set to WINDOW_FREERATIO or WINDOW_KEEPRATIO);
191
+ WND_PROP_OPENGL = 3 // !< opengl support
190
192
};
191
193
192
194
enum { EVENT_MOUSEMOVE = 0 ,
@@ -211,24 +213,27 @@ enum { EVENT_FLAG_LBUTTON = 1,
211
213
EVENT_FLAG_ALTKEY = 32
212
214
};
213
215
214
- // Qt font
215
- enum { QT_FONT_LIGHT = 25 , // QFont::Light,
216
- QT_FONT_NORMAL = 50 , // QFont::Normal,
217
- QT_FONT_DEMIBOLD = 63 , // QFont::DemiBold,
218
- QT_FONT_BOLD = 75 , // QFont::Bold,
219
- QT_FONT_BLACK = 87 // QFont::Black
216
+ // ! Qt font weight
217
+ enum QtFontWeights {
218
+ QT_FONT_LIGHT = 25 , // !< QFont::Light ( Weight of 25 )
219
+ QT_FONT_NORMAL = 50 , // !< QFont::Normal ( Weight of 50 )
220
+ QT_FONT_DEMIBOLD = 63 , // !< QFont::DemiBold ( Weight of 63 )
221
+ QT_FONT_BOLD = 75 , // !< QFont::Bold ( Weight of 75 )
222
+ QT_FONT_BLACK = 87 // !< QFont::Black ( Weight of 87 )
220
223
};
221
224
222
- // Qt font style
223
- enum { QT_STYLE_NORMAL = 0 , // QFont::StyleNormal,
224
- QT_STYLE_ITALIC = 1 , // QFont::StyleItalic,
225
- QT_STYLE_OBLIQUE = 2 // QFont::StyleOblique
225
+ // ! Qt font style
226
+ enum QtFontStyles {
227
+ QT_STYLE_NORMAL = 0 , // !< QFont::StyleNormal
228
+ QT_STYLE_ITALIC = 1 , // !< QFont::StyleItalic
229
+ QT_STYLE_OBLIQUE = 2 // !< QFont::StyleOblique
226
230
};
227
231
228
- // Qt "button" type
229
- enum { QT_PUSH_BUTTON = 0 ,
230
- QT_CHECKBOX = 1 ,
231
- QT_RADIOBOX = 2
232
+ // ! Qt "button" type
233
+ enum QtButtonTypes {
234
+ QT_PUSH_BUTTON = 0 , // !< Push button
235
+ QT_CHECKBOX = 1 , // !< Checkbox button
236
+ QT_RADIOBOX = 2 // !< Radiobox button
232
237
};
233
238
234
239
@@ -240,32 +245,28 @@ typedef void (*ButtonCallback)(int state, void* userdata);
240
245
/* * @brief Creates a window.
241
246
242
247
@param winname Name of the window in the window caption that may be used as a window identifier.
243
- @param flags Flags of the window. The supported flags are:
244
- > - **WINDOW_NORMAL** If this is set, the user can resize the window (no constraint).
245
- > - **WINDOW_AUTOSIZE** If this is set, the window size is automatically adjusted to fit the
246
- > displayed image (see imshow ), and you cannot change the window size manually.
247
- > - **WINDOW_OPENGL** If this is set, the window will be created with OpenGL support.
248
+ @param flags Flags of the window. The supported flags are: (cv::WindowFlags)
248
249
249
250
The function namedWindow creates a window that can be used as a placeholder for images and
250
251
trackbars. Created windows are referred to by their names.
251
252
252
253
If a window with the same name already exists, the function does nothing.
253
254
254
- You can call destroyWindow or destroyAllWindows to close the window and de-allocate any associated
255
+ You can call cv:: destroyWindow or cv:: destroyAllWindows to close the window and de-allocate any associated
255
256
memory usage. For a simple program, you do not really have to call these functions because all the
256
257
resources and windows of the application are closed automatically by the operating system upon exit.
257
258
258
259
@note
259
260
260
261
Qt backend supports additional flags:
261
- - **CV_WINDOW_NORMAL or CV_WINDOW_AUTOSIZE :** CV_WINDOW_NORMAL enables you to resize the
262
- window, whereas CV_WINDOW_AUTOSIZE adjusts automatically the window size to fit the
262
+ - **WINDOW_NORMAL or WINDOW_AUTOSIZE :** WINDOW_NORMAL enables you to resize the
263
+ window, whereas WINDOW_AUTOSIZE adjusts automatically the window size to fit the
263
264
displayed image (see imshow ), and you cannot change the window size manually.
264
- - **CV_WINDOW_FREERATIO or CV_WINDOW_KEEPRATIO :** CV_WINDOW_FREERATIO adjusts the image
265
- with no respect to its ratio, whereas CV_WINDOW_KEEPRATIO keeps the image ratio.
265
+ - **WINDOW_FREERATIO or WINDOW_KEEPRATIO :** WINDOW_FREERATIO adjusts the image
266
+ with no respect to its ratio, whereas WINDOW_KEEPRATIO keeps the image ratio.
266
267
- **CV_GUI_NORMAL or CV_GUI_EXPANDED:** CV_GUI_NORMAL is the old way to draw the window
267
268
without statusbar and toolbar, whereas CV_GUI_EXPANDED is a new enhanced GUI.
268
- By default, flags == CV_WINDOW_AUTOSIZE | CV_WINDOW_KEEPRATIO | CV_GUI_EXPANDED
269
+ By default, flags == WINDOW_AUTOSIZE | WINDOW_KEEPRATIO | CV_GUI_EXPANDED
269
270
*/
270
271
CV_EXPORTS_W void namedWindow (const String& winname, int flags = WINDOW_AUTOSIZE);
271
272
@@ -314,7 +315,7 @@ CV_EXPORTS_W int waitKey(int delay = 0);
314
315
@param mat Image to be shown.
315
316
316
317
The function imshow displays an image in the specified window. If the window was created with the
317
- CV_WINDOW_AUTOSIZE flag, the image is shown with its original size, however it is still limited by the screen resolution.
318
+ WINDOW_AUTOSIZE flag, the image is shown with its original size, however it is still limited by the screen resolution.
318
319
Otherwise, the image is scaled to fit the window. The function may scale the image, depending on its depth:
319
320
320
321
- If the image is 8-bit unsigned, it is displayed as is.
@@ -326,20 +327,22 @@ Otherwise, the image is scaled to fit the window. The function may scale the ima
326
327
If window was created with OpenGL support, imshow also support ogl::Buffer , ogl::Texture2D and
327
328
cuda::GpuMat as input.
328
329
329
- If the window was not created before this function, it is assumed creating a window with CV_WINDOW_AUTOSIZE .
330
+ If the window was not created before this function, it is assumed creating a window with WINDOW_AUTOSIZE .
330
331
331
332
If you need to show an image that is bigger than the screen resolution, you will need to call namedWindow("", WINDOW_NORMAL) before the imshow.
332
333
333
- @note This function should be followed by waitKey function which displays the image for specified
334
- milliseconds. Otherwise, it won't display the image. For example, waitKey(0) will display the window
335
- infinitely until any keypress (it is suitable for image display). waitKey(25) will display a frame
334
+ @note This function should be followed by cv:: waitKey function which displays the image for specified
335
+ milliseconds. Otherwise, it won't display the image. For example, cv:: waitKey(0) will display the window
336
+ infinitely until any keypress (it is suitable for image display). cv:: waitKey(25) will display a frame
336
337
for 25 ms, after which display will be automatically closed. (If you put it in a loop to read
337
338
videos, it will display the video frame-by-frame)
338
339
339
340
@note
340
341
341
342
[Windows Backend Only] Pressing Ctrl+C will copy the image to the clipboard.
342
343
344
+ [Windows Backend Only] Pressing Ctrl+S will show a dialog to save the image.
345
+
343
346
*/
344
347
CV_EXPORTS_W void imshow (const String& winname, InputArray mat);
345
348
@@ -352,7 +355,7 @@ CV_EXPORTS_W void imshow(const String& winname, InputArray mat);
352
355
@note
353
356
354
357
- The specified window size is for the image area. Toolbars are not counted.
355
- - Only windows created without CV_WINDOW_AUTOSIZE flag can be resized.
358
+ - Only windows created without WINDOW_AUTOSIZE flag can be resized.
356
359
*/
357
360
CV_EXPORTS_W void resizeWindow (const String& winname, int width, int height);
358
361
@@ -367,21 +370,8 @@ CV_EXPORTS_W void moveWindow(const String& winname, int x, int y);
367
370
/* * @brief Changes parameters of a window dynamically.
368
371
369
372
@param winname Name of the window.
370
- @param prop_id Window property to edit. The following operation flags are available:
371
- - **CV_WND_PROP_FULLSCREEN** Change if the window is fullscreen ( CV_WINDOW_NORMAL or
372
- CV_WINDOW_FULLSCREEN ).
373
- - **CV_WND_PROP_AUTOSIZE** Change if the window is resizable (CV_WINDOW_NORMAL or
374
- CV_WINDOW_AUTOSIZE ).
375
- - **CV_WND_PROP_ASPECTRATIO** Change if the aspect ratio of the image is preserved (
376
- CV_WINDOW_FREERATIO or CV_WINDOW_KEEPRATIO ).
377
- @param prop_value New value of the window property. The following operation flags are available:
378
- - **CV_WINDOW_NORMAL** Change the window to normal size or make the window resizable.
379
- - **CV_WINDOW_AUTOSIZE** Constrain the size by the displayed image. The window is not
380
- resizable.
381
- - **CV_WINDOW_FULLSCREEN** Change the window to fullscreen.
382
- - **CV_WINDOW_FREERATIO** Make the window resizable without any ratio constraints.
383
- - **CV_WINDOW_KEEPRATIO** Make the window resizable, but preserve the proportions of the
384
- displayed image.
373
+ @param prop_id Window property to edit. The supported operation flags are: (cv::WindowPropertyFlags)
374
+ @param prop_value New value of the window property. The supported flags are: (cv::WindowFlags)
385
375
386
376
The function setWindowProperty enables changing properties of a window.
387
377
*/
@@ -394,13 +384,7 @@ CV_EXPORTS_W void setWindowTitle(const String& winname, const String& title);
394
384
/* * @brief Provides parameters of a window.
395
385
396
386
@param winname Name of the window.
397
- @param prop_id Window property to retrieve. The following operation flags are available:
398
- - **CV_WND_PROP_FULLSCREEN** Change if the window is fullscreen ( CV_WINDOW_NORMAL or
399
- CV_WINDOW_FULLSCREEN ).
400
- - **CV_WND_PROP_AUTOSIZE** Change if the window is resizable (CV_WINDOW_NORMAL or
401
- CV_WINDOW_AUTOSIZE ).
402
- - **CV_WND_PROP_ASPECTRATIO** Change if the aspect ratio of the image is preserved
403
- (CV_WINDOW_FREERATIO or CV_WINDOW_KEEPRATIO ).
387
+ @param prop_id Window property to retrieve. The following operation flags are available: (cv::WindowPropertyFlags)
404
388
405
389
See setWindowProperty to know the meaning of the returned values.
406
390
@@ -466,10 +450,6 @@ control panel.
466
450
467
451
Clicking the label of each trackbar enables editing the trackbar values manually.
468
452
469
- @note
470
-
471
- - An example of using the trackbar functionality can be found at
472
- opencv_source_code/samples/cpp/connected_components.cpp
473
453
*/
474
454
CV_EXPORTS int createTrackbar (const String& trackbarname, const String& winname,
475
455
int * value, int count,
@@ -609,25 +589,15 @@ struct QtFont
609
589
font is set to a system-dependent default value. Generally, this is 12 points.
610
590
@param color Color of the font in BGRA where A = 255 is fully transparent. Use the macro CV _ RGB
611
591
for simplicity.
612
- @param weight Font weight. The following operation flags are available:
613
- - **CV_FONT_LIGHT** Weight of 25
614
- - **CV_FONT_NORMAL** Weight of 50
615
- - **CV_FONT_DEMIBOLD** Weight of 63
616
- - **CV_FONT_BOLD** Weight of 75
617
- - **CV_FONT_BLACK** Weight of 87
618
-
619
- You can also specify a positive integer for better control.
620
- @param style Font style. The following operation flags are available:
621
- - **CV_STYLE_NORMAL** Normal font
622
- - **CV_STYLE_ITALIC** Italic font
623
- - **CV_STYLE_OBLIQUE** Oblique font
592
+ @param weight Font weight. Available operation flags are : (cv::QtFontWeights) You can also specify a positive integer for better control.
593
+ @param style Font style. The following operation flags are available: (cv::QtFontStyles)
624
594
@param spacing Spacing between characters. It can be negative or positive.
625
595
626
- The function fontQt creates a CvFont object. This CvFont is not compatible with putText .
596
+ The function fontQt creates a QtFont object. This QtFont is not compatible with putText .
627
597
628
598
A basic usage of this function is the following: :
629
599
@code
630
- CvFont font = fontQt(''Times'');
600
+ QtFont font = fontQt(''Times'');
631
601
addText( img1, ``Hello World !'', Point(50,50), font);
632
602
@endcode
633
603
*/
@@ -642,7 +612,7 @@ CV_EXPORTS QtFont fontQt(const String& nameFont, int pointSize = -1,
642
612
@param org Point(x,y) where the text should start on an image.
643
613
@param font Font to use to draw a text.
644
614
645
- The function addText draws *text* on an image *img* using a specific font *font* (see example fontQt
615
+ The function addText draws *text* on an image *img* using a specific font *font* (see example cv:: fontQt
646
616
)
647
617
*/
648
618
CV_EXPORTS void addText ( const Mat& img, const String& text, Point org, const QtFont& font);
@@ -669,7 +639,7 @@ CV_EXPORTS void displayOverlay(const String& winname, const String& text, int de
669
639
the previous text timed out, the timer is restarted and the text is updated. If this value is
670
640
zero, the text never disappears.
671
641
672
- The function displayOverlay displays useful information/tips on top of the window for a certain
642
+ The function displayStatusBar displays useful information/tips on top of the window for a certain
673
643
amount of time *delayms* . This information is displayed on the window statusbar (the window must be
674
644
created with the CV_GUI_EXPANDED flags).
675
645
*/
@@ -705,11 +675,7 @@ CV_EXPORTS void stopLoop();
705
675
This function should be prototyped as void Foo(int state,\*void); . *state* is the current state
706
676
of the button. It could be -1 for a push button, 0 or 1 for a check/radio box button.
707
677
@param userdata Pointer passed to the callback function.
708
- @param type Optional type of the button.
709
- - **CV_PUSH_BUTTON** Push button
710
- - **CV_CHECKBOX** Checkbox button
711
- - **CV_RADIOBOX** Radiobox button. The radiobox on the same buttonbar (same line) are
712
- exclusive, that is only one can be selected at a time.
678
+ @param type Optional type of the button. Available types are: (cv::QtButtonTypes)
713
679
@param initial_button_state Default state of the button. Use for checkbox and radiobox. Its
714
680
value could be 0 or 1. *(Optional)*
715
681
@@ -720,10 +686,10 @@ control panel before, or if the last element attached to the control panel was a
720
686
See below various examples of the createButton function call: :
721
687
@code
722
688
createButton(NULL,callbackButton);//create a push button "button 0", that will call callbackButton.
723
- createButton("button2",callbackButton,NULL,CV_CHECKBOX ,0);
689
+ createButton("button2",callbackButton,NULL,QT_CHECKBOX ,0);
724
690
createButton("button3",callbackButton,&value);
725
- createButton("button5",callbackButton1,NULL,CV_RADIOBOX );
726
- createButton("button6",callbackButton2,NULL,CV_PUSH_BUTTON ,1);
691
+ createButton("button5",callbackButton1,NULL,QT_RADIOBOX );
692
+ createButton("button6",callbackButton2,NULL,QT_PUSH_BUTTON ,1);
727
693
@endcode
728
694
*/
729
695
CV_EXPORTS int createButton ( const String& bar_name, ButtonCallback on_change,
0 commit comments