Fixed Load, Modify, and Save an Image tutorial
This commit is contained in:
parent
dc21e2cc0e
commit
2d3aa3861c
@ -310,6 +310,8 @@ extlinks = {
|
||||
'calib3d' : ('http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#%s', None ),
|
||||
'feature2d' : ('http://docs.opencv.org/modules/imgproc/doc/feature_detection.html#%s', None ),
|
||||
'imgproc_geometric' : ('http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#%s', None ),
|
||||
'miscellaneous_transformations': ('http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html#%s', None),
|
||||
'user_interface': ('http://docs.opencv.org/modules/highgui/doc/user_interface.html#%s', None),
|
||||
|
||||
# 'opencv_group' : ('http://answers.opencv.org/%s', None),
|
||||
'opencv_qa' : ('http://answers.opencv.org/%s', None),
|
||||
|
@ -5,7 +5,7 @@ Load, Modify, and Save an Image
|
||||
|
||||
.. note::
|
||||
|
||||
We assume that by now you know how to load an image using :readwriteimagevideo:`imread() <imread>` and to display it in a window (using :imshow:`imshow <>`). Read the :ref:`Display_Image` tutorial otherwise.
|
||||
We assume that by now you know how to load an image using :readwriteimagevideo:`imread <imread>` and to display it in a window (using :user_interface:`imshow <imshow>`). Read the :ref:`Display_Image` tutorial otherwise.
|
||||
|
||||
Goals
|
||||
======
|
||||
@ -14,9 +14,9 @@ In this tutorial you will learn how to:
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
* Load an image using :readwriteimagevideo:`imread() <imread>`
|
||||
* Transform an image from BGR to Grayscale format by using :cvt_color:`cvtColor <>`
|
||||
* Save your transformed image in a file on disk (using :readwriteimagevideo:`imwrite() <imwrite>`)
|
||||
* Load an image using :readwriteimagevideo:`imread <imread>`
|
||||
* Transform an image from BGR to Grayscale format by using :miscellaneous_transformations:`cvtColor <cvtcolor>`
|
||||
* Save your transformed image in a file on disk (using :readwriteimagevideo:`imwrite <imwrite>`)
|
||||
|
||||
Code
|
||||
======
|
||||
@ -65,8 +65,7 @@ Explanation
|
||||
|
||||
#. We begin by:
|
||||
|
||||
* Creating a Mat object to store the image information
|
||||
* Load an image using :readwriteimagevideo:`imread() <imread>`, located in the path given by *imageName*. Fort this example, assume you are loading a RGB image.
|
||||
* Load an image using :readwriteimagevideo:`imread <imread>`, located in the path given by *imageName*. Fort this example, assume you are loading a RGB image.
|
||||
|
||||
#. Now we are going to convert our image from BGR to Grayscale format. OpenCV has a really nice function to do this kind of transformations:
|
||||
|
||||
@ -74,15 +73,15 @@ Explanation
|
||||
|
||||
cvtColor( image, gray_image, CV_BGR2GRAY );
|
||||
|
||||
As you can see, :cvt_color:`cvtColor <>` takes as arguments:
|
||||
As you can see, :miscellaneous_transformations:`cvtColor <cvtcolor>` takes as arguments:
|
||||
|
||||
.. container:: enumeratevisibleitemswithsquare
|
||||
|
||||
* a source image (*image*)
|
||||
* a destination image (*gray_image*), in which we will save the converted image.
|
||||
* an additional parameter that indicates what kind of transformation will be performed. In this case we use **CV_BGR2GRAY** (because of :readwriteimagevideo:`imread() <imread>` has BGR default channel order in case of color images).
|
||||
* an additional parameter that indicates what kind of transformation will be performed. In this case we use **CV_BGR2GRAY** (because of :readwriteimagevideo:`imread <imread>` has BGR default channel order in case of color images).
|
||||
|
||||
#. So now we have our new *gray_image* and want to save it on disk (otherwise it will get lost after the program ends). To save it, we will use a function analagous to :readwriteimagevideo:`imread() <imread>`: :readwriteimagevideo:`imwrite() <imwrite>`
|
||||
#. So now we have our new *gray_image* and want to save it on disk (otherwise it will get lost after the program ends). To save it, we will use a function analagous to :readwriteimagevideo:`imread <imread>`: :readwriteimagevideo:`imwrite <imwrite>`
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user