Commit ec57a938 authored by HelenWong's avatar HelenWong

Fix#3714:Improve Display Image Tutorial

For Bug #3714, user use the imshow() function without calling
namedWindow() properly, because user did not know the implicit rule for
imshow(). (i.e. without calling namedWindow implied calling namedWindow(
,CV__WINDOW_AUTOSIZE).

Improve the Display Image Tutorial to educate the user for such implied
rule.

Put a note on documentation for Bug#3714

Revise the documentation regarding to imshow() function to better
educate the user the implicit rule. (i.e. without creating the window
before the imshow() function is the same as creating AUTOSIZE window)
parent 1ce31dcd
......@@ -75,6 +75,8 @@ Now we call the :imread:`imread <>` function which loads the image name specifie
:tab-width: 4
:lines: 17
If the second argument is not specified, it is implied ``CV_LOAD_IMAGE_COLOR``
.. note::
OpenCV offers support for the image formats Windows bitmap (bmp), portable image formats (pbm, pgm, ppm) and Sun raster (sr, ras). With help of plugins (you need to specify to use them if you build yourself the library, nevertheless in the packages we ship present by default) you may also load image formats like JPEG (jpeg, jpg, jpe), JPEG 2000 (jp2 - codenamed in the CMake as Jasper), TIFF files (tiff, tif) and portable network graphics (png). Furthermore, OpenEXR is also a possibility.
......@@ -91,6 +93,8 @@ After checking that the image data was loaded correctly, we want to display our
:lines: 25
:tab-width: 4
If the second argument is not specified by the user, it is implied to be ``WINDOW_AUTOSIZE``, which means you can't change the size of the image.
Finally, to update the content of the OpenCV window with a new image use the :imshow:`imshow <>` function. Specify the OpenCV window name to update and the image to use during this operation:
.. literalinclude:: ../../../../samples/cpp/tutorial_code/introduction/display_image/display_image.cpp
......
......@@ -83,6 +83,8 @@ The function ``imshow`` displays an image in the specified window. If the window
* 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 window was not created before this function, it is assumed creating a window with ``CV_WINDOW_AUTOSIZE``.
If window was created with OpenGL support, ``imshow`` also support :ocv:class:`ogl::Buffer` , :ocv:class:`ogl::Texture2D` and :ocv:class:`gpu::GpuMat` as input.
namedWindow
......@@ -294,4 +296,4 @@ Force window to redraw its context and call draw callback ( :ocv:func:`setOpenGl
.. ocv:function:: void updateWindow(const string& winname)
:param winname: Window name
:param winname: Window name
\ No newline at end of file
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