Commit 83f25a34 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

merged the latest changes (grammar & style fix) and pre-latest changes (C & old…

merged the latest changes (grammar & style fix) and pre-latest changes (C & old Python interface and relocated short descriptions). Also, made some additional corrections
parent ea520d13
Qt* New Functions
Qt New Functions
================
.. highlight:: cpp
......@@ -56,59 +56,58 @@ See below the example used to generate the figure: ::
return 0;
}
.. index:: setWindowProperty
.. _setWindowProperty:
setWindowProperty
---------------------
Changes parameters of a window dynamically.
.. ocv:function:: void setWindowProperty(const string& name, int prop_id, double prop_value)
Changes parameters of a window dynamically.
.. ocv:cfunction:: void cvSetWindowProperty(const char* name, int propId, double propValue)
:param name: Name of the window.
:param prop_id: Window property to edit. The following operation flags are available:
* **CV_WND_PROP_FULLSCREEN** Change if the window is fullscreen ( ``CV_WINDOW_NORMAL`` or ``CV_WINDOW_FULLSCREEN`` ).
* **CV_WND_PROP_FULLSCREEN** Change if the window is fullscreen ( ``CV_WINDOW_NORMAL`` or ``CV_WINDOW_FULLSCREEN`` ).
* **CV_WND_PROP_AUTOSIZE** Change if the window is resizable (texttt {CV\_WINDOW\_NORMAL} or ``CV_WINDOW_AUTOSIZE`` ).
* **CV_WND_PROP_AUTOSIZE** Change if the window is resizable (``CV_WINDOW_NORMAL`` or ``CV_WINDOW_AUTOSIZE`` ).
* **CV_WND_PROP_ASPECTRATIO** Change if the aspect ratio of the image is preserved (texttt {CV\_WINDOW\_FREERATIO} or ``CV_WINDOW_KEEPRATIO`` ).
* **CV_WND_PROP_ASPECTRATIO** Change if the aspect ratio of the image is preserved ( ``CV_WINDOW_FREERATIO`` or ``CV_WINDOW_KEEPRATIO`` ).
:param prop_value: New value of the window property. The following operation flags are available:
* **CV_WINDOW_NORMAL** Change the window to normal size or make the window resizable.
* **CV_WINDOW_NORMAL** Change the window to normal size or make the window resizable.
* **CV_WINDOW_AUTOSIZE** Constrain the size by the displayed image. The window is not resizable.
* **CV_WINDOW_AUTOSIZE** Constrain the size by the displayed image. The window is not resizable.
* **CV_WINDOW_FULLSCREEN** Change the window to fullscreen.
* **CV_WINDOW_FULLSCREEN** Change the window to fullscreen.
* **CV_WINDOW_FREERATIO** Make the window resizable without any ratio constraints.
* **CV_WINDOW_FREERATIO** Make the window resizable without any ratio constraints.
* **CV_WINDOW_KEEPRATIO** Make the window resizable but preserve the proportions of the displayed image.
* **CV_WINDOW_KEEPRATIO** Make the window resizable, but preserve the proportions of the displayed image.
The function ``setWindowProperty`` enables changing properties of a window.
.. index:: getWindowProperty
getWindowProperty
---------------------
Provides parameters of a window.
.. ocv:function:: void getWindowProperty(const string& name, int prop_id)
Provides parameters of a window.
.. ocv:cfunction:: void cvGetWindowProperty(const char* name, int propId)
:param name: Name of the window.
:param prop_id: Window property to retrive. The following operation flags are available:
* **CV_WND_PROP_FULLSCREEN** Change if the window is fullscreen ( ``CV_WINDOW_NORMAL`` or ``CV_WINDOW_FULLSCREEN`` ).
* **CV_WND_PROP_FULLSCREEN** Change if the window is fullscreen ( ``CV_WINDOW_NORMAL`` or ``CV_WINDOW_FULLSCREEN`` ).
* **CV_WND_PROP_AUTOSIZE** Change if the window is resizable (texttt {CV\_WINDOW\_NORMAL} or ``CV_WINDOW_AUTOSIZE`` ).
* **CV_WND_PROP_AUTOSIZE** Change if the window is resizable (``CV_WINDOW_NORMAL`` or ``CV_WINDOW_AUTOSIZE`` ).
* **CV_WND_PROP_ASPECTRATIO** Change if the aspect ratio of the image is preserved (texttt {CV\_WINDOW\_FREERATIO} or ``CV_WINDOW_KEEPRATIO`` ).
* **CV_WND_PROP_ASPECTRATIO** Change if the aspect ratio of the image is preserved (``CV_WINDOW_FREERATIO`` or ``CV_WINDOW_KEEPRATIO`` ).
See
......@@ -116,21 +115,19 @@ See
The function ``getWindowProperty`` returns properties of a window.
.. index:: fontQt
.. _fontQt:
fontQt
----------
Creates the font to draw a text on an image.
.. ocv:function:: CvFont fontQt(const string& nameFont, int pointSize = -1, Scalar color = Scalar::all(0), int weight = CV_FONT_NORMAL, int style = CV_STYLE_NORMAL, int spacing = 0)
Creates the font to draw a text on an image.
.. ocv:cfunction:: CvFont cvFontQt(const char* nameFont, int pointSize=-1, CvScalar color=cvScalarAll(0), int weight=CV_FONT_NORMAL, int style=CV_STYLE_NORMAL, int spacing=0)
:param nameFont: Name of the font. The name should match the name of a system font (such as *Times*). If the font is not found, a default one is used.
:param pointSize: Size of the font. If not specified, equal zero or negative, the point size of the font is set to a system-dependent default value. Generally, this is 12 points.
:param color: Color of the font in BGRA where A = 255 is fully transparent. Use the macro ``CV _ RGB`` for simplicity.
:param color: Color of the font in BGRA where A = 255 is fully transparent. Use the macro ``CV _ RGB`` for simplicity.
:param weight: Font weight. The following operation flags are available:
......@@ -163,13 +160,14 @@ A basic usage of this function is the following: ::
CvFont font = fontQt(''Times'');
addText( img1, ``Hello World !'', Point(50,50), font);
.. index:: addText
addText
-----------
Creates the font to draw a text on an image.
.. ocv:function:: void addText(const Mat& img, const string& text, Point location, CvFont *font)
Creates the font to draw a text on an image.
.. ocv:cfunction:: void cvAddText(const CvArr* img, const char* text, CvPoint location, CvFont *font)
:param img: 8-bit 3-channel image where the text should be drawn.
......@@ -185,16 +183,17 @@ on an image
*img*
using a specific font
*font*
(see example
:ocv:func:`fontQt` )
(see example :ocv:func:`fontQt` )
.. index:: displayOverlay
displayOverlay
------------------
Displays a text on a window image as an overlay for a specified duration.
.. ocv:function:: void displayOverlay(const string& name, const string& text, int delay)
Displays a text on a window image as an overlay for a specified duration.
.. ocv:cfunction:: void cvDisplayOverlay(const char* name, const char* text, int delay)
:param name: Name of the window.
......@@ -204,13 +203,14 @@ displayOverlay
The function ``displayOverlay`` displays useful information/tips on top of the window for a certain amount of time *delay*. The function does not modify the image, displayed in the window, that is, after the specified delay the original content of the window is restored.
.. index:: displayStatusBar
displayStatusBar
--------------------
Displays a text on the window statusbar during the specified period of time.
.. ocv:function:: void displayStatusBar(const string& name, const string& text, int delay)
Displays a text on the window statusbar during the specified period of time.
.. ocv:cfunction:: void cvDisplayStatusBar(const char* name, const char* text, int delayms)
:param name: Name of the window.
......@@ -222,14 +222,13 @@ The function ``displayOverlay`` displays useful information/tips on top of the w
*delay*
. This information is displayed on the window statubar (the window must be created with the ``CV_GUI_EXPANDED`` flags).
.. index:: createOpenGLCallback
createOpenGLCallback
------------------------
Creates a callback function called to draw OpenGL on top the the image display by ``windowname``.
.. ocv:function:: void createOpenGLCallback( const string& window_name, OpenGLCallback callbackOpenGL, void* userdata CV_DEFAULT(NULL), double angle CV_DEFAULT(-1), double zmin CV_DEFAULT(-1), double zmax CV_DEFAULT(-1)
Creates a callback function called to draw OpenGL on top the the image display by ``windowname``.
.. ocv:cfunction:: void cvCreateOpenGLCallback( const char* windowName, CvOpenGLCallback callbackOpenGL, void* userdata=NULL, double angle=-1, double zmin=-1, double zmax=-1
:param window_name: Name of the window.
......@@ -243,7 +242,7 @@ createOpenGLCallback
:param zmax: Parameter specifying the distance from the viewer to the far clipping plane (always positive). Default value is 1000. *(Optional)*
The function ``createOpenGLCallback`` can be used to draw 3D data on the window. See the callback example below: ::
The function ``createOpenGLCallback`` can be used to draw 3D data on the window. See the example of callback use below: ::
void on_opengl(void* param)
{
......@@ -274,42 +273,40 @@ The function ``createOpenGLCallback`` can be used to draw 3D data on the window.
}
}
.. index:: saveWindowParameters
saveWindowParameters
------------------------
Saves parameters of the specified window.
.. ocv:function:: void saveWindowParameters(const string& name)
Saves parameters of the window ``windowname`` .
.. ocv:cfunction:: void cvSaveWindowParameters(const char* name)
:param name: Name of the window.
The function ``saveWindowParameters`` saves size, location, flags, trackbars value, zoom and panning location of the window
``window_name`` .
.. index:: loadWindowParameters
loadWindowParameters
------------------------
Loads parameters of the specified window.
.. ocv:function:: void loadWindowParameters(const string& name)
Loads parameters of the window ``windowname`` .
.. ocv:cfunction:: void cvLoadWindowParameters(const char* name)
:param name: Name of the window.
The function ``loadWindowParameters`` loads size, location, flags, trackbars value, zoom, and panning location of the window
The function ``loadWindowParameters`` loads size, location, flags, trackbars value, zoom and panning location of the window
``window_name`` .
.. index:: createButton
createButton
----------------
Attaches a button to the control panel.
.. ocv:function:: createButton( const string& button_name CV_DEFAULT(NULL),ButtonCallback 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))
Attaches a button to the control panel.
.. ocv:cfunction:: cvCreateButton( const char* buttonName=NULL, CvButtonCallback onChange=NULL, void* userdata=NULL, int buttonType=CV_PUSH_BUTTON, int initialButtonState=0
:param button_name: Name of the button.
......@@ -323,7 +320,7 @@ createButton
* **CV_CHECKBOX** Checkbox button
* **CV_RADIOBOX** Radiobox button. The radiobox on the same buttonbar (same line) are exclusive, that is, only one can be selected at a time.
* **CV_RADIOBOX** Radiobox button. The radiobox on the same buttonbar (same line) are exclusive, that is only one can be selected at a time.
:param initial_button_state: Default state of the button. Use for checkbox and radiobox. Its value could be 0 or 1. *(Optional)*
......
......@@ -3,15 +3,14 @@ User Interface
.. highlight:: cpp
.. index:: createTrackbar
.. _createTrackbar:
createTrackbar
------------------
Creates a trackbar and attaches it to the specified window.
.. ocv:function:: 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.
.. ocv:cfunction:: int cvCreateTrackbar( const char* trackbarName, const char* windowName, int* value, int count, CvTrackbarCallback onChange )
.. ocv:pyoldfunction:: CreateTrackbar(trackbarName, windowName, value, count, onChange) -> None
:param trackbarname: Name of the created trackbar.
......@@ -25,29 +24,22 @@ createTrackbar
:param userdata: User data that is passed as is to the callback. It can be used to handle trackbar events without using global variables.
The function ``createTrackbar`` creates a trackbar (a slider or range control) with the specified name and range, assigns a variable ``value`` to be a position syncronized with the trackbar and specifies the callback function ``onChange`` to be called on the trackbar position change. The created trackbar is displayed on top of the given window.
**[Qt Backend Only]**
Qt-specific details:
* **winname** Name of the window that will be used as a parent for created trackbar. It can be NULL if the trackbar should be attached to the control panel.
The function ``createTrackbar`` creates a trackbar (a slider or range control) with the specified name and range, assigns a variable ``value`` to be a position syncronized with the trackbar and specifies the callback function ``onChange`` to be called on the trackbar position change. The created trackbar is displayed in the specified window ``winname``.
The created trackbar is displayed at the bottom of the given window if
*winname*
is correctly provided, or displayed on the control panel if
*winname*
is NULL.
Clicking the label of each trackbar enables editing the trackbar values manually for a more accurate control of it.
.. note::
**[Qt Backend Only]** ``winname`` can be empty (or NULL) if the trackbar should be attached to the control panel.
.. index:: getTrackbarPos
Clicking the label of each trackbar enables editing the trackbar values manually.
getTrackbarPos
------------------
Returns the trackbar position.
.. ocv:function:: int getTrackbarPos( const string& trackbarname, const string& winname )
Returns the trackbar position.
.. ocv:cfunction:: int cvGetTrackbarPos( const char* trackbarName, const char* windowName )
.. ocv:pyoldfunction:: GetTrackbarPos(trackbarName, windowName)-> None
:param trackbarname: Name of the trackbar.
......@@ -55,21 +47,15 @@ getTrackbarPos
The function returns the current position of the specified trackbar.
.. note::
**[Qt Backend Only]**
Qt-specific details:
* **winname** Name of the window that is the parent of the trackbar. It can be NULL if the trackbar is attached to the control panel.
.. index:: imshow
.. _imshow:
**[Qt Backend Only]** ``winname`` can be empty (or NULL) if the trackbar is attached to the control panel.
imshow
----------
.. ocv:function:: void imshow( const string& winname, InputArray image )
Displays an image in the specified window.
Displays an image in the specified window.
.. ocv:function:: void imshow( const string& winname, InputArray image )
:param winname: Name of the window.
......@@ -77,28 +63,25 @@ imshow
The function ``imshow`` displays an image in the specified window. If the window was created with the ``CV_WINDOW_AUTOSIZE`` flag, the image is shown with its original size. Otherwise, the image is scaled to fit the window. The function may scale the image, depending on its depth:
*
If the image is 8-bit unsigned, it is displayed as is.
* If the image is 8-bit unsigned, it is displayed as is.
*
If the image is 16-bit unsigned or 32-bit integer, the pixels are divided by 256. That is, the value range [0,255*256] is mapped to [0,255].
* If the image is 16-bit unsigned or 32-bit integer, the pixels are divided by 256. That is, the value range [0,255*256] is mapped to [0,255].
*
If the image is 32-bit floating-point, the pixel values are multiplied by 255. That is, the value range [0,1] is mapped to [0,255].
* If the image is 32-bit floating-point, the pixel values are multiplied by 255. That is, the value range [0,1] is mapped to [0,255].
.. index:: namedWindow
.. _namedWindow:
namedWindow
---------------
Creates a window.
.. ocv:function:: void namedWindow( const string& winname, int flags )
Creates a window.
.. ocv:cfunction:: int cvNamedWindow( const char* name, int flags )
.. ocv:pyoldfunction:: NamedWindow(name, flags=CV_WINDOW_AUTOSIZE)-> None
:param name: Name of the window in the window caption that may be used as a window identifier.
:param flags: Flags of the window. Currently the only supported flag is ``CV_WINDOW_AUTOSIZE`` . If it is set, the window size is automatically adjusted to fit the displayed image (see :ocv:func:`imshow` ), and you cannot change the window size manually.
:param flags: Flags of the window. Currently the only supported flag is ``CV_WINDOW_AUTOSIZE`` . If this is set, the window size is automatically adjusted to fit the displayed image (see :ocv:func:`imshow` ), and you cannot change the window size manually.
The function ``namedWindow`` creates a window that can be used as a placeholder for images and trackbars. Created windows are referred to by their names.
......@@ -106,99 +89,80 @@ If a window with the same name already exists, the function does nothing.
You can call :ocv:func:`destroyWindow` or :ocv:func:`destroyAllWindows` to close the window and de-allocate any associated memory usage. For a simple program, you do not really have to call these functions because all the resources and windows of the application are closed automatically by the operating system upon exit.
.. note::
**[Qt Backend Only]**
Qt-specific details:
* **flags** Flags of the window. Currently the supported flags are:
* **CV_WINDOW_NORMAL or CV_WINDOW_AUTOSIZE:** ``CV_WINDOW_NORMAL`` enables you to resize the window, whereas ``CV_WINDOW_AUTOSIZE`` adjusts automatically the window size to fit the displayed image (see :ocv:func:`imshow` ), and you cannot change the window size manually.
* **CV_WINDOW_FREERATIO or CV_WINDOW_KEEPRATIO:** ``CV_WINDOW_FREERATIO`` adjusts the image with no respect to its ratio, whereas ``CV_WINDOW_KEEPRATIO`` keeps the image ratio.
* **CV_GUI_NORMAL or CV_GUI_EXPANDED:** ``CV_GUI_NORMAL`` is the old way to draw the window without statusbar and toolbar, whereas ``CV_GUI_EXPANDED`` is a new enhanced GUI.
This parameter is optional. The default flags set for a new window are ``CV_WINDOW_AUTOSIZE`` , ``CV_WINDOW_KEEPRATIO`` , and ``CV_GUI_EXPANDED`` .
However, if you want to modify the flags, you can combine them using the OR operator, that is:
::
namedWindow( ``myWindow'', ``CV_WINDOW_NORMAL`` textbar ``CV_GUI_NORMAL`` );
Qt backend supports additional flags:
..
* **CV_WINDOW_NORMAL or CV_WINDOW_AUTOSIZE:** ``CV_WINDOW_NORMAL`` enables you to resize the window, whereas ``CV_WINDOW_AUTOSIZE`` adjusts automatically the window size to fit the displayed image (see :ocv:func:`imshow` ), and you cannot change the window size manually.
* **CV_WINDOW_FREERATIO or CV_WINDOW_KEEPRATIO:** ``CV_WINDOW_FREERATIO`` adjusts the image with no respect to its ratio, whereas ``CV_WINDOW_KEEPRATIO`` keeps the image ratio.
.. index:: destroyWindow
* **CV_GUI_NORMAL or CV_GUI_EXPANDED:** ``CV_GUI_NORMAL`` is the old way to draw the window without statusbar and toolbar, whereas ``CV_GUI_EXPANDED`` is a new enhanced GUI.
.. _destroyWindow:
By default, ``flags == CV_WINDOW_AUTOSIZE | CV_WINDOW_KEEPRATIO | CV_GUI_EXPANDED``
destroyWindow
-------------
.. ocv:function:: void destroyWindow( const string &winname )
Destroys a window.
Destroys a window.
.. ocv:function:: void destroyWindow( const string &winname )
.. ocv:cfunction:: void cvDestroyWindow( const char* name )
.. ocv:pyoldfunction:: DestroyWindow(name)-> None
:param winname: Name of the window to be destroyed.
The function ``destroyWindow`` destroys the window with the given name.
.. index:: destroyAllWindows
.. _destroyAllWindows:
destroyAllWindows
-----------------
.. ocv:function:: void destroyAllWindows()
Destroys all of the HighGUI windows.
Destroys all of the HighGUI windows.
.. ocv:function:: void destroyAllWindows()
The function ``destroyAllWindows`` destroys all of the opened HighGUI windows.
.. index:: setTrackbarPos
.. _setTrackbarPos:
setTrackbarPos
------------------
Sets the trackbar position.
.. ocv:function:: void setTrackbarPos( const string& trackbarname, const string& winname, int pos )
Sets the trackbar position.
.. ocv:cfunction:: void cvSetTrackbarPos( const char* trackbarName, const char* windowName, int pos )
.. ocv:pyoldfunction:: SetTrackbarPos(trackbarName, windowName, pos)-> None
:param trackbarname: Name of the trackbar.
:param winname: Name of the window that is the parent of the trackbar.
:param winname: Name of the window that is the parent of trackbar.
:param pos: New position.
The function sets the position of the specified trackbar in the specified window.
**[Qt Backend Only]**
Qt-specific details:
* **winname** Name of the window that is the parent of the trackbar. It can be NULL if the trackbar is attached to the control panel.
.. index:: waitKey
.. _waitKey:
.. note::
**[Qt Backend Only]** ``winname`` can be empty (or NULL) if the trackbar is attached to the control panel.
waitKey
-----------
Waits for a pressed key.
.. ocv:function:: int waitKey(int delay=0)
Waits for a pressed key.
.. ocv:cfunction:: int cvWaitKey( int delay=0 )
.. ocv:pyoldfunction:: WaitKey(delay=0)-> int
:param delay: Delay in milliseconds. 0 is the special value that means "forever".
The function ``waitKey`` waits for a key event infinitely (when
:math:`\texttt{delay}\leq 0` ) or for ``delay`` milliseconds, when it is positive. It returns the code of the pressed key or -1 if no key was pressed before the specified time had elapsed.
:math:`\texttt{delay}\leq 0` ) or for ``delay`` milliseconds, when it is positive. Since the OS has a minimum time between switching threads, the function will not wait exactly ``delay`` ms, it will wait at least ``delay`` ms, depending on what else is running on your computer at that time. It returns the code of the pressed key or -1 if no key was pressed before the specified time had elapsed.
.. note::
* This function is the only method in HighGUI that can fetch and handle events, so it needs to be called periodically for normal event processing unless HighGUI is used within an environment that takes care of event processing.
* The function only works if there is at least one HighGUI window created and the window is active. If there are several HighGUI windows, any of them can be active.
This function is the only method in HighGUI that can fetch and handle events, so it needs to be called periodically for normal event processing unless HighGUI is used within an environment that takes care of event processing.
.. note::
The function only works if there is at least one HighGUI window created and the window is active. If there are several HighGUI windows, any of them can be active.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment