OpenCV 4.5.3(日本語機械翻訳)
highgui.hpp
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.hpp"
47 #ifdef HAVE_OPENCV_IMGCODECS
48 #include "opencv2/imgcodecs.hpp"
49 #endif
50 #ifdef HAVE_OPENCV_VIDEOIO
51 #include "opencv2/videoio.hpp"
52 #endif
53
176 namespace cv
177{
178
181
184
187 WINDOW_NORMAL = 0x00000000,
188 WINDOW_AUTOSIZE = 0x00000001,
189 WINDOW_OPENGL = 0x00001000,
190
192 WINDOW_FREERATIO = 0x00000100,
193 WINDOW_KEEPRATIO = 0x00000000,
195 WINDOW_GUI_NORMAL = 0x00000010,
196 };
197
206 WND_PROP_VSYNC = 6
207 };
208
223 };
224
233 };
234
236
239
246 QT_FONT_BLACK = 87
247 };
248
254 };
255
261 QT_NEW_BUTTONBAR = 1024
262 };
263
265
273 typedef void (*MouseCallback)(int event, int x, int y, int flags, void* userdata);
274
279 typedef void (*TrackbarCallback)(int pos, void* userdata);
280
284 typedef void (*OpenGlDrawCallback)(void* userdata);
285
290 typedef void (*ButtonCallback)(int state, void* userdata);
291
318 CV_EXPORTS_W void namedWindow(const String& winname, int flags = WINDOW_AUTOSIZE);
319
326 CV_EXPORTS_W void destroyWindow(const String& winname);
327
332 CV_EXPORTS_W void destroyAllWindows();
333
334CV_EXPORTS_W int startWindowThread();
335
343 CV_EXPORTS_W int waitKeyEx(int delay = 0);
344
363 CV_EXPORTS_W int waitKey(int delay = 0);
364
377 CV_EXPORTS_W int pollKey();
378
414 CV_EXPORTS_W void imshow(const String& winname, InputArray mat);
415
427 CV_EXPORTS_W void resizeWindow(const String& winname, int width, int height);
428
433 CV_EXPORTS_W void resizeWindow(const String& winname, const cv::Size& size);
434
441 CV_EXPORTS_W void moveWindow(const String& winname, int x, int y);
442
451 CV_EXPORTS_W void setWindowProperty(const String& winname, int prop_id, double prop_value);
452
457 CV_EXPORTS_W void setWindowTitle(const String& winname, const String& title);
458
468 CV_EXPORTS_W double getWindowProperty(const String& winname, int prop_id);
469
478 CV_EXPORTS_W Rect getWindowImageRect(const String& winname);
479
489 CV_EXPORTS void setMouseCallback(const String& winname, MouseCallback onMouse, void* userdata = 0);
490
509 CV_EXPORTS int getMouseWheelDelta(int flags);
510
526 CV_EXPORTS_W Rect selectROI(const String& windowName, InputArray img, bool showCrosshair = true, bool fromCenter = false);
527
530 CV_EXPORTS_W Rect selectROI(InputArray img, bool showCrosshair = true, bool fromCenter = false);
531
548 CV_EXPORTS_W void selectROIs(const String& windowName, InputArray img,
549 CV_OUT std::vector<Rect>& boundingBoxes, bool showCrosshair = true, bool fromCenter = false);
550
577 CV_EXPORTS int createTrackbar(const String& trackbarname, const String& winname,
578 int* value, int count,
579 TrackbarCallback onChange = 0,
580 void* userdata = 0);
581
594 CV_EXPORTS_W int getTrackbarPos(const String& trackbarname, const String& winname);
595
609 CV_EXPORTS_W void setTrackbarPos(const String& trackbarname, const String& winname, int pos);
610
624 CV_EXPORTS_W void setTrackbarMax(const String& trackbarname, const String& winname, int maxval);
625
639 CV_EXPORTS_W void setTrackbarMin(const String& trackbarname, const String& winname, int minval);
640
643
649 CV_EXPORTS void imshow(const String& winname, const ogl::Texture2D& tex);
650
691 CV_EXPORTS void setOpenGlDrawCallback(const String& winname, OpenGlDrawCallback onOpenGlDraw, void* userdata = 0);
692
697 CV_EXPORTS void setOpenGlContext(const String& winname);
698
703 CV_EXPORTS void updateWindow(const String& winname);
704
706
709
712 struct QtFont
713{
714 const char* nameFont;
717 const int* ascii;
718 const int* greek;
719 const int* cyrillic;
720 float hscale, vscale;
721 float shear;
723 float dx;
725};
726
747 CV_EXPORTS QtFont fontQt(const String& nameFont, int pointSize = -1,
748 Scalar color = Scalar::all(0), int weight = QT_FONT_NORMAL,
749 int style = QT_STYLE_NORMAL, int spacing = 0);
750
761 CV_EXPORTS void addText( const Mat& img, const String& text, Point org, const QtFont& font);
762
777 CV_EXPORTS_W void addText(const Mat& img, const String& text, Point org, const String& nameFont, int pointSize = -1, Scalar color = Scalar::all(0),
778 int weight = QT_FONT_NORMAL, int style = QT_STYLE_NORMAL, int spacing = 0);
779
792 CV_EXPORTS_W void displayOverlay(const String& winname, const String& text, int delayms = 0);
793
806 CV_EXPORTS_W void displayStatusBar(const String& winname, const String& text, int delayms = 0);
807
815 CV_EXPORTS void saveWindowParameters(const String& windowName);
816
824 CV_EXPORTS void loadWindowParameters(const String& windowName);
825
826CV_EXPORTS int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
827
828CV_EXPORTS void stopLoop();
829
856 CV_EXPORTS int createButton( const String& bar_name, ButtonCallback on_change,
857 void* userdata = 0, int type = QT_PUSH_BUTTON,
858 bool initial_button_state = false);
859
861
863
864} // cv
865
866 #endif
n-dimensional dense array class
Definition: mat.hpp:802
Template class for 2D rectangles
Definition: core/types.hpp:421
static Scalar_< double > all(double v0)
returns a scalar with all elements set to v0
Template class for specifying the size of an image or rectangle.
Definition: core/types.hpp:316
Smart pointer for OpenGL 2D texture memory with reference counting.
Definition: opengl.hpp:284
CV_EXPORTS void setOpenGlContext(const String &winname)
Sets the specified window as current OpenGL context.
CV_EXPORTS void setOpenGlDrawCallback(const String &winname, OpenGlDrawCallback onOpenGlDraw, void *userdata=0)
Sets a callback function to be called to draw on top of displayed image.
CV_EXPORTS void updateWindow(const String &winname)
Force window to redraw its context and call draw callback ( See cv::setOpenGlDrawCallback ).
CV_EXPORTS int createButton(const String &bar_name, ButtonCallback on_change, void *userdata=0, int type=QT_PUSH_BUTTON, bool initial_button_state=false)
Attaches a button to the control panel.
CV_EXPORTS void saveWindowParameters(const String &windowName)
Saves parameters of the specified window.
CV_EXPORTS_W void displayOverlay(const String &winname, const String &text, int delayms=0)
Displays a text on a window image as an overlay for a specified duration.
CV_EXPORTS QtFont fontQt(const String &nameFont, int pointSize=-1, Scalar color=Scalar::all(0), int weight=QT_FONT_NORMAL, int style=QT_STYLE_NORMAL, int spacing=0)
Creates the font to draw a text on an image.
QtFontStyles
Qt font style
Definition: highgui.hpp:250
CV_EXPORTS void addText(const Mat &img, const String &text, Point org, const QtFont &font)
Draws a text on the image.
CV_EXPORTS_W void displayStatusBar(const String &winname, const String &text, int delayms=0)
Displays a text on the window statusbar during the specified period of time.
QtFontWeights
Qt font weight
Definition: highgui.hpp:241
QtButtonTypes
Qt "button" type
Definition: highgui.hpp:257
CV_EXPORTS void loadWindowParameters(const String &windowName)
Loads parameters of the specified window.
@ QT_STYLE_OBLIQUE
Oblique font.
Definition: highgui.hpp:253
@ QT_STYLE_NORMAL
Normal font.
Definition: highgui.hpp:251
@ QT_STYLE_ITALIC
Italic font.
Definition: highgui.hpp:252
@ QT_FONT_LIGHT
Weight of 25
Definition: highgui.hpp:242
@ QT_FONT_DEMIBOLD
Weight of 63
Definition: highgui.hpp:244
@ QT_FONT_NORMAL
Weight of 50
Definition: highgui.hpp:243
@ QT_FONT_BLACK
Weight of 87
Definition: highgui.hpp:246
@ QT_FONT_BOLD
Weight of 75
Definition: highgui.hpp:245
@ QT_CHECKBOX
Checkbox button.
Definition: highgui.hpp:259
@ QT_RADIOBOX
Radiobox button.
Definition: highgui.hpp:260
@ QT_PUSH_BUTTON
Push button.
Definition: highgui.hpp:258
@ QT_NEW_BUTTONBAR
Button should create a new buttonbar
Definition: highgui.hpp:261
MouseEventTypes
Mouse Events see cv::MouseCallback
Definition: highgui.hpp:210
MouseEventFlags
Mouse Event Flags see cv::MouseCallback
Definition: highgui.hpp:226
WindowFlags
Flags for cv::namedWindow
Definition: highgui.hpp:186
WindowPropertyFlags
Flags for cv::setWindowProperty / cv::getWindowProperty
Definition: highgui.hpp:199
@ EVENT_MBUTTONDOWN
indicates that the middle mouse button is pressed.
Definition: highgui.hpp:214
@ EVENT_RBUTTONDBLCLK
indicates that right mouse button is double clicked.
Definition: highgui.hpp:219
@ EVENT_MOUSEWHEEL
positive and negative values mean forward and backward scrolling, respectively.
Definition: highgui.hpp:221
@ EVENT_LBUTTONUP
indicates that left mouse button is released.
Definition: highgui.hpp:215
@ EVENT_MOUSEHWHEEL
positive and negative values mean right and left scrolling, respectively.
Definition: highgui.hpp:222
@ EVENT_MOUSEMOVE
indicates that the mouse pointer has moved over the window.
Definition: highgui.hpp:211
@ EVENT_RBUTTONDOWN
indicates that the right mouse button is pressed.
Definition: highgui.hpp:213
@ EVENT_RBUTTONUP
indicates that right mouse button is released.
Definition: highgui.hpp:216
@ EVENT_MBUTTONUP
indicates that middle mouse button is released.
Definition: highgui.hpp:217
@ EVENT_LBUTTONDOWN
indicates that the left mouse button is pressed.
Definition: highgui.hpp:212
@ EVENT_LBUTTONDBLCLK
indicates that left mouse button is double clicked.
Definition: highgui.hpp:218
@ EVENT_MBUTTONDBLCLK
indicates that middle mouse button is double clicked.
Definition: highgui.hpp:220
@ EVENT_FLAG_RBUTTON
indicates that the right mouse button is down.
Definition: highgui.hpp:228
@ EVENT_FLAG_CTRLKEY
indicates that CTRL Key is pressed.
Definition: highgui.hpp:230
@ EVENT_FLAG_SHIFTKEY
indicates that SHIFT Key is pressed.
Definition: highgui.hpp:231
@ EVENT_FLAG_MBUTTON
indicates that the middle mouse button is down.
Definition: highgui.hpp:229
@ EVENT_FLAG_LBUTTON
indicates that the left mouse button is down.
Definition: highgui.hpp:227
@ EVENT_FLAG_ALTKEY
indicates that ALT Key is pressed.
Definition: highgui.hpp:232
@ WINDOW_FREERATIO
the image expends as much as it can (no ratio constraint).
Definition: highgui.hpp:192
@ WINDOW_NORMAL
the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal s...
Definition: highgui.hpp:187
@ WINDOW_OPENGL
window with opengl support.
Definition: highgui.hpp:189
@ WINDOW_GUI_NORMAL
old fashious way
Definition: highgui.hpp:195
@ WINDOW_FULLSCREEN
change the window to fullscreen.
Definition: highgui.hpp:191
@ WINDOW_KEEPRATIO
the ratio of the image is respected.
Definition: highgui.hpp:193
@ WINDOW_AUTOSIZE
the user cannot resize the window, the size is constrainted by the image displayed.
Definition: highgui.hpp:188
@ WINDOW_GUI_EXPANDED
status bar and tool bar
Definition: highgui.hpp:194
@ WND_PROP_VISIBLE
checks whether the window exists and is visible
Definition: highgui.hpp:204
@ WND_PROP_TOPMOST
property to toggle normal window being topmost or not
Definition: highgui.hpp:205
@ WND_PROP_OPENGL
opengl support.
Definition: highgui.hpp:203
@ WND_PROP_FULLSCREEN
fullscreen property (can be WINDOW_NORMAL or WINDOW_FULLSCREEN).
Definition: highgui.hpp:200
@ WND_PROP_AUTOSIZE
autosize property (can be WINDOW_NORMAL or WINDOW_AUTOSIZE).
Definition: highgui.hpp:201
@ WND_PROP_ASPECT_RATIO
window's aspect ration (can be set to WINDOW_FREERATIO or WINDOW_KEEPRATIO).
Definition: highgui.hpp:202
@ WND_PROP_VSYNC
enable or disable VSYNC (in OpenGL mode)
Definition: highgui.hpp:206
void(* TrackbarCallback)(int pos, void *userdata)
Callback function for Trackbar see cv::createTrackbar
Definition: highgui.hpp:279
CV_EXPORTS_W Rect getWindowImageRect(const String &winname)
Provides rectangle of image in the window.
CV_EXPORTS int createTrackbar(const String &trackbarname, const String &winname, int *value, int count, TrackbarCallback onChange=0, void *userdata=0)
Creates a trackbar and attaches it to the specified window.
void(* ButtonCallback)(int state, void *userdata)
Callback function for a button created by cv::createButton
Definition: highgui.hpp:290
CV_EXPORTS_W double getWindowProperty(const String &winname, int prop_id)
Provides parameters of a window.
CV_EXPORTS_W Rect selectROI(const String &windowName, InputArray img, bool showCrosshair=true, bool fromCenter=false)
Allows users to select a ROI on the given image.
CV_EXPORTS_W void setWindowTitle(const String &winname, const String &title)
Updates window title
CV_EXPORTS_W void destroyAllWindows()
Destroys all of the HighGUI windows.
CV_EXPORTS int getMouseWheelDelta(int flags)
Gets the mouse-wheel motion delta, when handling mouse-wheel events cv::EVENT_MOUSEWHEEL and cv::EVEN...
CV_EXPORTS void setMouseCallback(const String &winname, MouseCallback onMouse, void *userdata=0)
Sets mouse handler for the specified window
CV_EXPORTS_W int waitKey(int delay=0)
Waits for a pressed key.
CV_EXPORTS_W void moveWindow(const String &winname, int x, int y)
Moves the window to the specified position
CV_EXPORTS_W void setTrackbarMax(const String &trackbarname, const String &winname, int maxval)
Sets the trackbar maximum position.
CV_EXPORTS_W void imshow(const String &winname, InputArray mat)
Displays an image in the specified window.
CV_EXPORTS_W int pollKey()
Polls for a pressed key.
void(* OpenGlDrawCallback)(void *userdata)
Callback function defined to be called every frame. See cv::setOpenGlDrawCallback
Definition: highgui.hpp:284
CV_EXPORTS_W int waitKeyEx(int delay=0)
Similar to waitKey, but returns full key code.
CV_EXPORTS_W void setTrackbarMin(const String &trackbarname, const String &winname, int minval)
Sets the trackbar minimum position.
CV_EXPORTS_W void destroyWindow(const String &winname)
Destroys the specified window.
CV_EXPORTS_W void resizeWindow(const String &winname, int width, int height)
Resizes the window to the specified size
CV_EXPORTS_W int getTrackbarPos(const String &trackbarname, const String &winname)
Returns the trackbar position.
void(* MouseCallback)(int event, int x, int y, int flags, void *userdata)
Callback function for mouse events. see cv::setMouseCallback
Definition: highgui.hpp:273
CV_EXPORTS_W void setWindowProperty(const String &winname, int prop_id, double prop_value)
Changes parameters of a window dynamically.
CV_EXPORTS_W void namedWindow(const String &winname, int flags=WINDOW_AUTOSIZE)
Creates a window.
CV_EXPORTS_W void selectROIs(const String &windowName, InputArray img, CV_OUT std::vector< Rect > &boundingBoxes, bool showCrosshair=true, bool fromCenter=false)
Allows users to select multiple ROIs on the given image.
CV_EXPORTS_W void setTrackbarPos(const String &trackbarname, const String &winname, int pos)
Sets the trackbar position.
cv
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
QtFont available only for Qt. See cv::fontQt
Definition: highgui.hpp:713
float shear
slope coefficient: 0 - normal, >0 - italic
Definition: highgui.hpp:721
int line_type
PointSize
Definition: highgui.hpp:724
float dx
horizontal interval between letters
Definition: highgui.hpp:723
const char * nameFont
Name of the font
Definition: highgui.hpp:714
const int * ascii
font data and metrics
Definition: highgui.hpp:717
int thickness
See cv::QtFontWeights
Definition: highgui.hpp:722
Scalar color
Color of the font. Scalar(blue_component, green_component, red_component[, alpha_component])
Definition: highgui.hpp:715
int font_face
See cv::QtFontStyles
Definition: highgui.hpp:716