Skip to content

Commit

Permalink
Fixed Load, Modify, and Save an Image tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Osokin authored and dreamworld committed Mar 21, 2014
1 parent dc21e2c commit 2d3aa38
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@
'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),
Expand Down
17 changes: 8 additions & 9 deletions doc/tutorials/introduction/load_save_image/load_save_image.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
======
Expand All @@ -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
======
Expand Down Expand Up @@ -65,24 +65,23 @@ 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:

.. code-block:: cpp
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
Expand Down

0 comments on commit 2d3aa38

Please sign in to comment.