diff --git a/doc/tutorials/core/adding_images/adding_images.rst b/doc/tutorials/core/adding_images/adding_images.rst index e37f4f7064..2df40c2701 100644 --- a/doc/tutorials/core/adding_images/adding_images.rst +++ b/doc/tutorials/core/adding_images/adding_images.rst @@ -8,11 +8,13 @@ Goal In this tutorial you will learn how to: -* What is *linear blending* and why it is useful. -* Add two images using :add_weighted:`addWeighted <>` +.. container:: enumeratevisibleitemswithsquare -Cool Theory -================= + * What is *linear blending* and why it is useful. + * Add two images using :add_weighted:`addWeighted <>` + +Theory +======= .. note:: @@ -24,12 +26,12 @@ From our previous tutorial, we know already a bit of *Pixel operators*. An inter g(x) = (1 - \alpha)f_{0}(x) + \alpha f_{1}(x) -By varying :math:`\alpha` from :math:`0 \rightarrow 1` this operator can be used to perform a temporal *cross-disolve* between two images or videos, as seen in slide shows and film production (cool, eh?) +By varying :math:`\alpha` from :math:`0 \rightarrow 1` this operator can be used to perform a temporal *cross-disolve* between two images or videos, as seen in slide shows and film productions (cool, eh?) Code ===== -As usual, after the not-so-lengthy explanation, let's go to the code. Here it is: +As usual, after the not-so-lengthy explanation, let's go to the code: .. code-block:: cpp @@ -116,4 +118,4 @@ Result .. image:: images/Adding_Images_Tutorial_Result_0.jpg :alt: Blending Images Tutorial - Final Result - :align: center \ No newline at end of file + :align: center diff --git a/doc/tutorials/core/basic_geometric_drawing/basic_geometric_drawing.rst b/doc/tutorials/core/basic_geometric_drawing/basic_geometric_drawing.rst index 068ebc10d3..752527202f 100644 --- a/doc/tutorials/core/basic_geometric_drawing/basic_geometric_drawing.rst +++ b/doc/tutorials/core/basic_geometric_drawing/basic_geometric_drawing.rst @@ -7,13 +7,15 @@ Goals ====== In this tutorial you will learn how to: -* Use :point:`Point <>` to define 2D points in an image. -* Use :scalar:`Scalar <>` and why it is useful -* Draw a **line** by using the OpenCV function :line:`line <>` -* Draw an **ellipse** by using the OpenCV function :ellipse:`ellipse <>` -* Draw a **rectangle** by using the OpenCV function :rectangle:`rectangle <>` -* Draw a **circle** by using the OpenCV function :circle:`circle <>` -* Draw a **filled polygon** by using the OpenCV function :fill_poly:`fillPoly <>` +.. container:: enumeratevisibleitemswithsquare + + * Use :point:`Point <>` to define 2D points in an image. + * Use :scalar:`Scalar <>` and why it is useful + * Draw a **line** by using the OpenCV function :line:`line <>` + * Draw an **ellipse** by using the OpenCV function :ellipse:`ellipse <>` + * Draw a **rectangle** by using the OpenCV function :rectangle:`rectangle <>` + * Draw a **circle** by using the OpenCV function :circle:`circle <>` + * Draw a **filled polygon** by using the OpenCV function :fill_poly:`fillPoly <>` OpenCV Theory =============== @@ -22,7 +24,10 @@ For this tutorial, we will heavily use two structures: :point:`Point <>` and :sc Point ------- -It represents a 2D point, specified by its image coordinates :math:`x` and :math:`y`. We can define it as: + +.. container:: enumeratevisibleitemswithsquare + + It represents a 2D point, specified by its image coordinates :math:`x` and :math:`y`. We can define it as: .. code-block:: cpp @@ -51,7 +56,7 @@ Scalar Code ===== -* This code is in your OpenCV sample folder. Otherwise you can grab it from `here `_ +* This code is in your OpenCV sample folder. Otherwise you can grab it from `here `_ Explanation ============= @@ -126,11 +131,13 @@ Explanation As we can see, *MyLine* just call the function :line:`line <>`, which does the following: - * Draw a line from Point **start** to Point **end** - * The line is displayed in the image **img** - * The line color is defined by **Scalar( 0, 0, 0)** which is the RGB value correspondent to **Black** - * The line thickness is set to **thickness** (in this case 2) - * The line is a 8-connected one (**lineType** = 8) + .. container:: enumeratevisibleitemswithsquare + + * Draw a line from Point **start** to Point **end** + * The line is displayed in the image **img** + * The line color is defined by **Scalar( 0, 0, 0)** which is the RGB value correspondent to **Black** + * The line thickness is set to **thickness** (in this case 2) + * The line is a 8-connected one (**lineType** = 8) * *MyEllipse* @@ -153,13 +160,15 @@ Explanation } From the code above, we can observe that the function :ellipse:`ellipse <>` draws an ellipse such that: - - * The ellipse is displayed in the image **img** - * The ellipse center is located in the point **(w/2.0, w/2.0)** and is enclosed in a box of size **(w/4.0, w/16.0)** - * The ellipse is rotated **angle** degrees - * The ellipse extends an arc between **0** and **360** degrees - * The color of the figure will be **Scalar( 255, 255, 0)** which means blue in RGB value. - * The ellipse's **thickness** is 2. + + .. container:: enumeratevisibleitemswithsquare + + * The ellipse is displayed in the image **img** + * The ellipse center is located in the point **(w/2.0, w/2.0)** and is enclosed in a box of size **(w/4.0, w/16.0)** + * The ellipse is rotated **angle** degrees + * The ellipse extends an arc between **0** and **360** degrees + * The color of the figure will be **Scalar( 255, 255, 0)** which means blue in RGB value. + * The ellipse's **thickness** is 2. * *MyFilledCircle* @@ -181,11 +190,13 @@ Explanation Similar to the ellipse function, we can observe that *circle* receives as arguments: - * The image where the circle will be displayed (**img**) - * The center of the circle denoted as the Point **center** - * The radius of the circle: **w/32.0** - * The color of the circle: **Scalar(0, 0, 255)** which means *Red* in RGB - * Since **thickness** = -1, the circle will be drawn filled. + .. container:: enumeratevisibleitemswithsquare + + * The image where the circle will be displayed (**img**) + * The center of the circle denoted as the Point **center** + * The radius of the circle: **w/32.0** + * The color of the circle: **Scalar(0, 0, 255)** which means *Red* in BGR + * Since **thickness** = -1, the circle will be drawn filled. * *MyPolygon* @@ -230,12 +241,14 @@ Explanation } To draw a filled polygon we use the function :fill_poly:`fillPoly <>`. We note that: - - * The polygon will be drawn on **img** - * The vertices of the polygon are the set of points in **ppt** - * The total number of vertices to be drawn are **npt** - * The number of polygons to be drawn is only **1** - * The color of the polygon is defined by **Scalar( 255, 255, 255)**, which is the RGB value for *white* + + .. container:: enumeratevisibleitemswithsquare + + * The polygon will be drawn on **img** + * The vertices of the polygon are the set of points in **ppt** + * The total number of vertices to be drawn are **npt** + * The number of polygons to be drawn is only **1** + * The color of the polygon is defined by **Scalar( 255, 255, 255)**, which is the BGR value for *white* * *rectangle* @@ -250,10 +263,12 @@ Explanation Finally we have the :rectangle:`rectangle <>` function (we did not create a special function for this guy). We note that: - * The rectangle will be drawn on **rook_image** - * Two opposite vertices of the rectangle are defined by ** Point( 0, 7*w/8.0 )** and **Point( w, w)** - * The color of the rectangle is given by **Scalar(0, 255, 255)** which is the RGB value for *yellow* - * Since the thickness value is given by **-1**, the rectangle will be filled. + .. container:: enumeratevisibleitemswithsquare + + * The rectangle will be drawn on **rook_image** + * Two opposite vertices of the rectangle are defined by ** Point( 0, 7*w/8.0 )** and **Point( w, w)** + * The color of the rectangle is given by **Scalar(0, 255, 255)** which is the BGR value for *yellow* + * Since the thickness value is given by **-1**, the rectangle will be filled. Result ======= diff --git a/doc/tutorials/core/basic_linear_transform/basic_linear_transform.rst b/doc/tutorials/core/basic_linear_transform/basic_linear_transform.rst index cb605d0ccc..097e79e00b 100644 --- a/doc/tutorials/core/basic_linear_transform/basic_linear_transform.rst +++ b/doc/tutorials/core/basic_linear_transform/basic_linear_transform.rst @@ -18,8 +18,8 @@ In this tutorial you will learn how to: + Get some cool info about pixel transformations -Cool Theory -================= +Theory +======= .. note:: The explanation below belongs to the book `Computer Vision: Algorithms and Applications `_ by Richard Szeliski @@ -27,44 +27,52 @@ Cool Theory Image Processing -------------------- -* A general image processing operator is a function that takes one or more input images and produces an output image. +.. container:: enumeratevisibleitemswithsquare + + * A general image processing operator is a function that takes one or more input images and produces an output image. -* Image transforms can be seen as: + * Image transforms can be seen as: - * Point operators (pixel transforms) - * Neighborhood (area-based) operators + + Point operators (pixel transforms) + + Neighborhood (area-based) operators Pixel Transforms ^^^^^^^^^^^^^^^^^ -* In this kind of image processing transform, each output pixel's value depends on only the corresponding input pixel value (plus, potentially, some globally collected information or parameters). +.. container:: enumeratevisibleitemswithsquare + + * In this kind of image processing transform, each output pixel's value depends on only the corresponding input pixel value (plus, potentially, some globally collected information or parameters). -* Examples of such operators include *brightness and contrast adjustments* as well as color correction and transformations. + * Examples of such operators include *brightness and contrast adjustments* as well as color correction and transformations. Brightness and contrast adjustments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* Two commonly used point processes are *multiplication* and *addition* with a constant: - .. math:: +.. container:: enumeratevisibleitemswithsquare - g(x) = \alpha f(x) + \beta + * Two commonly used point processes are *multiplication* and *addition* with a constant: -* The parameters :math:`\alpha > 0` and :math:`\beta` are often called the *gain* and *bias* parameters; sometimes these parameters are said to control *contrast* and *brightness* respectively. + .. math:: + + g(x) = \alpha f(x) + \beta + + * The parameters :math:`\alpha > 0` and :math:`\beta` are often called the *gain* and *bias* parameters; sometimes these parameters are said to control *contrast* and *brightness* respectively. -* You can think of :math:`f(x)` as the source image pixels and :math:`g(x)` as the output image pixels. Then, more conveniently we can write the expression as: + * You can think of :math:`f(x)` as the source image pixels and :math:`g(x)` as the output image pixels. Then, more conveniently we can write the expression as: - .. math:: + .. math:: - g(i,j) = \alpha \cdot f(i,j) + \beta + g(i,j) = \alpha \cdot f(i,j) + \beta - where :math:`i` and :math:`j` indicates that the pixel is located in the *i-th* row and *j-th* column. + where :math:`i` and :math:`j` indicates that the pixel is located in the *i-th* row and *j-th* column. Code ===== -* The following code performs the operation :math:`g(i,j) = \alpha \cdot f(i,j) + \beta` -* Here it is: +.. container:: enumeratevisibleitemswithsquare + + * The following code performs the operation :math:`g(i,j) = \alpha \cdot f(i,j) + \beta` : .. code-block:: cpp @@ -132,8 +140,10 @@ Explanation #. Now, since we will make some transformations to this image, we need a new Mat object to store it. Also, we want this to have the following features: - * Initial pixel values equal to zero - * Same size and type as the original image + .. container:: enumeratevisibleitemswithsquare + + * Initial pixel values equal to zero + * Same size and type as the original image .. code-block:: cpp @@ -155,9 +165,11 @@ Explanation Notice the following: - * To access each pixel in the images we are using this syntax: *image.at(y,x)[c]* where *y* is the row, *x* is the column and *c* is R, G or B (0, 1 or 2). + .. container:: enumeratevisibleitemswithsquare + + * To access each pixel in the images we are using this syntax: *image.at(y,x)[c]* where *y* is the row, *x* is the column and *c* is R, G or B (0, 1 or 2). - * Since the operation :math:`\alpha \cdot p(i,j) + \beta` can give values out of range or not integers (if :math:`\alpha` is float), we use :saturate_cast:`saturate_cast <>` to make sure the values are valid. + * Since the operation :math:`\alpha \cdot p(i,j) + \beta` can give values out of range or not integers (if :math:`\alpha` is float), we use :saturate_cast:`saturate_cast <>` to make sure the values are valid. #. Finally, we create windows and show the images, the usual way. @@ -199,4 +211,4 @@ Result .. image:: images/Basic_Linear_Transform_Tutorial_Result_0.jpg :alt: Basic Linear Transform - Final Result - :align: center \ No newline at end of file + :align: center diff --git a/doc/tutorials/core/random_generator_and_text/random_generator_and_text.rst b/doc/tutorials/core/random_generator_and_text/random_generator_and_text.rst index fb487cab71..e463a57deb 100644 --- a/doc/tutorials/core/random_generator_and_text/random_generator_and_text.rst +++ b/doc/tutorials/core/random_generator_and_text/random_generator_and_text.rst @@ -8,16 +8,21 @@ Goals In this tutorial you will learn how to: -* Use the *Random Number generator class* (:rng:`RNG <>`) and how to get a random number from a uniform distribution. -* Display text on an OpenCV window by using the function :put_text:`putText <>` +.. container:: enumeratevisibleitemswithsquare + + * Use the *Random Number generator class* (:rng:`RNG <>`) and how to get a random number from a uniform distribution. + * Display text on an OpenCV window by using the function :put_text:`putText <>` Code ===== -* In the previous tutorial (:ref:`Drawing_1`) we drew diverse geometric figures, giving as input parameters such as coordinates (in the form of :point:`Points <>`), color, thickness, etc. You might have noticed that we gave specific values for these arguments. + +.. container:: enumeratevisibleitemswithsquare + + * In the previous tutorial (:ref:`Drawing_1`) we drew diverse geometric figures, giving as input parameters such as coordinates (in the form of :point:`Points <>`), color, thickness, etc. You might have noticed that we gave specific values for these arguments. -* In this tutorial, we intend to use *random* values for the drawing parameters. Also, we intend to populate our image with a big number of geometric figures. Since we will be initializing them in a random fashion, this process will be automatic and made by using *loops* . + * In this tutorial, we intend to use *random* values for the drawing parameters. Also, we intend to populate our image with a big number of geometric figures. Since we will be initializing them in a random fashion, this process will be automatic and made by using *loops* . -* This code is in your OpenCV sample folder. Otherwise you can grab it from `here `_ . + * This code is in your OpenCV sample folder. Otherwise you can grab it from `here `_ . Explanation ============ @@ -172,12 +177,14 @@ Explanation So, what does the function :put_text:`putText <>` do? In our example: - * Draws the text **"Testing text rendering"** in **image** - * The bottom-left corner of the text will be located in the Point **org** - * The font type is a random integer value in the range: :math:`[0, 8>`. - * The scale of the font is denoted by the expression **rng.uniform(0, 100)x0.05 + 0.1** (meaning its range is: :math:`[0.1, 5.1>`) - * The text color is random (denoted by **randomColor(rng)**) - * The text thickness ranges between 1 and 10, as specified by **rng.uniform(1,10)** + .. container:: enumeratevisibleitemswithsquare + + * Draws the text **"Testing text rendering"** in **image** + * The bottom-left corner of the text will be located in the Point **org** + * The font type is a random integer value in the range: :math:`[0, 8>`. + * The scale of the font is denoted by the expression **rng.uniform(0, 100)x0.05 + 0.1** (meaning its range is: :math:`[0.1, 5.1>`) + * The text color is random (denoted by **randomColor(rng)**) + * The text thickness ranges between 1 and 10, as specified by **rng.uniform(1,10)** As a result, we will get (analagously to the other drawing functions) **NUMBER** texts over our image, in random locations. @@ -257,4 +264,4 @@ As you just saw in the Code section, the program will sequentially execute diver .. image:: images/Drawing_2_Tutorial_Result_7.jpg :alt: Drawing Tutorial 2 - Final Result 7 - :align: center \ No newline at end of file + :align: center diff --git a/doc/tutorials/introduction/display_image/display_image.rst b/doc/tutorials/introduction/display_image/display_image.rst index a8be339867..af07b7f7f4 100644 --- a/doc/tutorials/introduction/display_image/display_image.rst +++ b/doc/tutorials/introduction/display_image/display_image.rst @@ -17,7 +17,7 @@ In this tutorial you will learn how to: Source Code =========== -Download the :download:`source code from here <../../../../samples/cpp/tutorial_code/introduction/display_image/display_image.cpp>` or look it up in our library at :file:`samples/cpp/tutorial_code/introduction/display_image/display_image.cpp`. +Download the source code from `here `_. .. literalinclude:: ../../../../samples/cpp/tutorial_code/introduction/display_image/display_image.cpp :language: cpp @@ -108,20 +108,22 @@ Because we want our window to be displayed until the user presses a key (otherwi Result ======= -* Compile your code and then run the executable giving an image path as argument. If you're on Windows the executable will of course contain an *exe* extension too. Of course assure the image file is near your program file. +.. container:: enumeratevisibleitemswithsquare + + * Compile your code and then run the executable giving an image path as argument. If you're on Windows the executable will of course contain an *exe* extension too. Of course assure the image file is near your program file. - .. code-block:: bash + .. code-block:: bash - ./DisplayImage HappyFish.jpg + ./DisplayImage HappyFish.jpg -* You should get a nice window as the one shown below: + * You should get a nice window as the one shown below: - .. image:: images/Display_Image_Tutorial_Result.jpg - :alt: Display Image Tutorial - Final Result - :align: center + .. image:: images/Display_Image_Tutorial_Result.jpg + :alt: Display Image Tutorial - Final Result + :align: center -.. raw:: html + .. raw:: html -
- -
+
+ +
diff --git a/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.rst b/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.rst index d5e039134a..3e3191735f 100644 --- a/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.rst +++ b/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.rst @@ -6,12 +6,14 @@ Using OpenCV with gcc and CMake .. note:: We assume that you have successfully installed OpenCV in your workstation. -The easiest way of using OpenCV in your code is to use `CMake `_. A few advantages (taken from the Wiki): +.. container:: enumeratevisibleitemswithsquare -* No need to change anything when porting between Linux and Windows -* Can easily be combined with other tools by CMake( i.e. Qt, ITK and VTK ) + * The easiest way of using OpenCV in your code is to use `CMake `_. A few advantages (taken from the Wiki): -If you are not familiar with CMake, checkout the `tutorial `_ on its website. + #. No need to change anything when porting between Linux and Windows + #. Can easily be combined with other tools by CMake( i.e. Qt, ITK and VTK ) + + * If you are not familiar with CMake, checkout the `tutorial `_ on its website. Steps ======