mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Doxygen tutorials: warnings cleared
This commit is contained in:
@@ -83,29 +83,22 @@ Explanation
|
||||
src2 = imread("../../images/WindowsLogo.jpg");
|
||||
@endcode
|
||||
**warning**
|
||||
|
||||
|
||||
Since we are *adding* *src1* and *src2*, they both have to be of the same size (width and
|
||||
height) and type.
|
||||
|
||||
2. Now we need to generate the @ref cv::g(x)\` image. For this, the function
|
||||
add_weighted:addWeighted comes quite handy:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
beta = ( 1.0 - alpha );
|
||||
addWeighted( src1, alpha, src2, beta, 0.0, dst);
|
||||
|
||||
2. Now we need to generate the `g(x)` image. For this, the function add_weighted:addWeighted comes quite handy:
|
||||
@code{.cpp}
|
||||
beta = ( 1.0 - alpha );
|
||||
addWeighted( src1, alpha, src2, beta, 0.0, dst);
|
||||
@endcode
|
||||
since @ref cv::addWeighted produces:
|
||||
\f[dst = \alpha \cdot src1 + \beta \cdot src2 + \gamma\f]
|
||||
In this case, `gamma` is the argument \f$0.0\f$ in the code above.
|
||||
|
||||
.. math::
|
||||
|
||||
dst = \\alpha \\cdot src1 + \\beta \\cdot src2 + \\gamma
|
||||
|
||||
In this case, :math:gamma\` is the argument \f$0.0\f$ in the code above.
|
||||
3. Create windows, show the images and wait for the user to end the program.
|
||||
|
||||
Result
|
||||
------
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
@@ -115,6 +115,6 @@ Explanation
|
||||
Result
|
||||
=======
|
||||
|
||||
.. image:: images/Adding_Images_Tutorial_Result_0.jpg
|
||||
.. image:: images/Adding_Images_Tutorial_Result_Big.jpg
|
||||
:alt: Blending Images Tutorial - Final Result
|
||||
:align: center
|
||||
|
||||
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
@@ -97,6 +97,7 @@ int main( int argc, char** argv )
|
||||
return 0;
|
||||
}
|
||||
@endcode
|
||||
|
||||
Explanation
|
||||
-----------
|
||||
|
||||
@@ -134,11 +135,10 @@ Explanation
|
||||
}
|
||||
@endcode
|
||||
Notice the following:
|
||||
|
||||
- To access each pixel in the images we are using this syntax: *image.at\<Vec3b\>(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 @ref cv::alpha cdot p(i,j) + beta\` can give values out of range or not
|
||||
integers (if \f$\alpha\f$ is float), we use :saturate_cast:\`saturate_cast to make sure the
|
||||
- Since the operation \f$\alpha \cdot p(i,j) + \beta\f$ can give values out of range or not
|
||||
integers (if \f$\alpha\f$ is float), we use cv::saturate_cast to make sure the
|
||||
values are valid.
|
||||
|
||||
5. Finally, we create windows and show the images, the usual way.
|
||||
@@ -151,12 +151,13 @@ Explanation
|
||||
|
||||
waitKey(0);
|
||||
@endcode
|
||||
|
||||
@note
|
||||
Instead of using the **for** loops to access each pixel, we could have simply used this command:
|
||||
Instead of using the **for** loops to access each pixel, we could have simply used this command:
|
||||
@code{.cpp}
|
||||
image.convertTo(new_image, -1, alpha, beta);
|
||||
@endcode
|
||||
where @ref cv::convertTo would effectively perform *new_image = a*image + beta\*. However, we
|
||||
where @ref cv::Mat::convertTo would effectively perform *new_image = a*image + beta\*. However, we
|
||||
wanted to show you how to access each pixel. In any case, both methods give the same result but
|
||||
convertTo is more optimized and works a lot faster.
|
||||
|
||||
@@ -171,8 +172,7 @@ Result
|
||||
* Enter the alpha value [1.0-3.0]: 2.2
|
||||
* Enter the beta value [0-100]: 50
|
||||
@endcode
|
||||
|
||||
- We get this:
|
||||
|
||||

|
||||
|
||||
|
||||

|
||||
|
||||
@@ -204,6 +204,6 @@ Result
|
||||
|
||||
* We get this:
|
||||
|
||||
.. image:: images/Basic_Linear_Transform_Tutorial_Result_0.jpg
|
||||
.. image:: images/Basic_Linear_Transform_Tutorial_Result_big.jpg
|
||||
:alt: Basic Linear Transform - Final Result
|
||||
:align: center
|
||||
|
||||
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
@@ -79,10 +79,12 @@ double t = (double)getTickCount();
|
||||
t = ((double)getTickCount() - t)/getTickFrequency();
|
||||
cout << "Times passed in seconds: " << t << endl;
|
||||
@endcode
|
||||
|
||||
@anchor tutorial_how_to_scan_images_storing
|
||||
How the image matrix is stored in the memory?
|
||||
---------------------------------------------
|
||||
|
||||
As you could already read in my @ref matTheBasicImageContainer tutorial the size of the matrix
|
||||
As you could already read in my @ref tutorial_mat_the_basic_image_container tutorial the size of the matrix
|
||||
depends of the color system used. More accurately, it depends from the number of channels used. In
|
||||
case of a gray scale image we have something like:
|
||||
|
||||
@@ -110,7 +112,7 @@ Row n & \tabIt{n,0} & \tabIt{n,1} & \tabIt{n,...} & \tabIt{n, m} \\
|
||||
Note that the order of the channels is inverse: BGR instead of RGB. Because in many cases the memory
|
||||
is large enough to store the rows in a successive fashion the rows may follow one after another,
|
||||
creating a single long row. Because everything is in a single place following one after another this
|
||||
may help to speed up the scanning process. We can use the @ref cv::isContinuous() function to *ask*
|
||||
may help to speed up the scanning process. We can use the @ref cv::Mat::isContinuous() function to *ask*
|
||||
the matrix if this is the case. Continue on to the next section to find an example.
|
||||
|
||||
The efficient way
|
||||
@@ -227,12 +229,12 @@ differences I've used a quite large (2560 X 1600) image. The performance present
|
||||
color images. For a more accurate value I've averaged the value I got from the call of the function
|
||||
for hundred times.
|
||||
|
||||
--------------- ----------------------
|
||||
Efficient Way 79.4717 milliseconds
|
||||
Iterator 83.7201 milliseconds
|
||||
On-The-Fly RA 93.7878 milliseconds
|
||||
LUT function 32.5759 milliseconds
|
||||
--------------- ----------------------
|
||||
Method | Time
|
||||
--------------- | ----------------------
|
||||
Efficient Way | 79.4717 milliseconds
|
||||
Iterator | 83.7201 milliseconds
|
||||
On-The-Fly RA | 93.7878 milliseconds
|
||||
LUT function | 32.5759 milliseconds
|
||||
|
||||
We can conclude a couple of things. If possible, use the already made functions of OpenCV (instead
|
||||
reinventing these). The fastest method turns out to be the LUT function. This is because the OpenCV
|
||||
@@ -242,12 +244,10 @@ Using the on-the-fly reference access method for full image scan is the most cos
|
||||
In the release mode it may beat the iterator approach or not, however it surely sacrifices for this
|
||||
the safety trait of iterators.
|
||||
|
||||
Finally, you may watch a sample run of the program on the [video
|
||||
posted](https://www.youtube.com/watch?v=fB3AN5fjgwc) on our YouTube channel.
|
||||
Finally, you may watch a sample run of the program on the [video posted](https://www.youtube.com/watch?v=fB3AN5fjgwc) on our YouTube channel.
|
||||
|
||||
\htmlonly
|
||||
<div align="center">
|
||||
<iframe title="How to scan images in OpenCV?" width="560" height="349" src="http://www.youtube.com/embed/fB3AN5fjgwc?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
\endhtmlonly
|
||||
|
||||
|
||||
@@ -16,8 +16,7 @@ Code
|
||||
|
||||
You may also find the source code in the
|
||||
`samples/cpp/tutorial_code/core/ippasync/ippasync_sample.cpp` file of the OpenCV source library or
|
||||
download it from here
|
||||
\<../../../../samples/cpp/tutorial_code/core/ippasync/ippasync_sample.cpp\>.
|
||||
download it from [here](samples/cpp/tutorial_code/core/ippasync/ippasync_sample.cpp).
|
||||
|
||||
@includelineno cpp/tutorial_code/core/ippasync/ippasync_sample.cpp
|
||||
|
||||
@@ -37,8 +36,8 @@ Explanation
|
||||
hppStatus sts;
|
||||
hppiVirtualMatrix * virtMatrix;
|
||||
@endcode
|
||||
2. Load input image or video. How to open and read video stream you can see in the @ref
|
||||
videoInputPSNRMSSIM tutorial.
|
||||
2. Load input image or video. How to open and read video stream you can see in the
|
||||
@ref tutorial_video_input_psnr_ssim tutorial.
|
||||
@code{.cpp}
|
||||
if( useCamera )
|
||||
{
|
||||
@@ -83,7 +82,7 @@ Explanation
|
||||
|
||||
result.create( image.rows, image.cols, CV_8U);
|
||||
@endcode
|
||||
6. Convert Mat to [hppiMatrix](http://software.intel.com/en-us/node/501660) using @ref cv::getHpp
|
||||
6. Convert Mat to [hppiMatrix](http://software.intel.com/en-us/node/501660) using @ref cv::hpp::getHpp
|
||||
and call [hppiSobel](http://software.intel.com/en-us/node/474701) function.
|
||||
@code{.cpp}
|
||||
//convert Mat to hppiMatrix
|
||||
@@ -134,6 +133,7 @@ Explanation
|
||||
CHECK_DEL_STATUS(sts, "hppDeleteInstance");
|
||||
}
|
||||
@endcode
|
||||
|
||||
Result
|
||||
------
|
||||
|
||||
@@ -141,4 +141,3 @@ After compiling the code above we can execute it giving an image or video path a
|
||||
as an argument. For this tutorial we use baboon.png image as input. The result is below.
|
||||
|
||||

|
||||
|
||||
|
||||
+7
-8
@@ -19,8 +19,8 @@ this. In the following you'll learn:
|
||||
General
|
||||
-------
|
||||
|
||||
When making the switch you first need to learn some about the new data structure for images: @ref
|
||||
matTheBasicImageContainer, this replaces the old *CvMat* and *IplImage* ones. Switching to the new
|
||||
When making the switch you first need to learn some about the new data structure for images:
|
||||
@ref tutorial_mat_the_basic_image_container, this replaces the old *CvMat* and *IplImage* ones. Switching to the new
|
||||
functions is easier. You just need to remember a couple of new things.
|
||||
|
||||
OpenCV 2 received reorganization. No longer are all the functions crammed into a single library. We
|
||||
@@ -46,8 +46,8 @@ and the subsequent words start with a capital letter (like *copyMakeBorder*).
|
||||
|
||||
Now, remember that you need to link to your application all the modules you use, and in case you are
|
||||
on Windows using the *DLL* system you will need to add, again, to the path all the binaries. For
|
||||
more in-depth information if you're on Windows read @ref Windows_Visual_Studio_How_To and for
|
||||
Linux an example usage is explained in @ref Linux_Eclipse_Usage.
|
||||
more in-depth information if you're on Windows read @ref tutorial_windows_visual_studio_Opencv and for
|
||||
Linux an example usage is explained in @ref tutorial_linux_eclipse.
|
||||
|
||||
Now for converting the *Mat* object you can use either the *IplImage* or the *CvMat* operators.
|
||||
While in the C interface you used to work with pointers here it's no longer the case. In the C++
|
||||
@@ -81,11 +81,11 @@ For example:
|
||||
Mat K(piL), L;
|
||||
L = Mat(pI);
|
||||
@endcode
|
||||
|
||||
A case study
|
||||
------------
|
||||
|
||||
Now that you have the basics done [here's
|
||||
](samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp)
|
||||
Now that you have the basics done [here's](samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp)
|
||||
an example that mixes the usage of the C interface with the C++ one. You will also find it in the
|
||||
sample directory of the OpenCV source code library at the
|
||||
`samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp` .
|
||||
@@ -124,7 +124,7 @@ lines
|
||||
|
||||
Here you can observe that we may go through all the pixels of an image in three fashions: an
|
||||
iterator, a C pointer and an individual element access style. You can read a more in-depth
|
||||
description of these in the @ref howToScanImagesOpenCV tutorial. Converting from the old function
|
||||
description of these in the @ref tutorial_how_to_scan_images tutorial. Converting from the old function
|
||||
names is easy. Just remove the cv prefix and use the new *Mat* data structure. Here's an example of
|
||||
this by using the weighted addition function:
|
||||
|
||||
@@ -161,4 +161,3 @@ of the OpenCV source code library.
|
||||
<iframe title="Interoperability with OpenCV 1" width="560" height="349" src="http://www.youtube.com/embed/qckm-zvo31w?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
\endhtmlonly
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ At first we make sure that the input images data is in unsigned char format. For
|
||||
CV_Assert(myImage.depth() == CV_8U); // accept only uchar images
|
||||
@endcode
|
||||
We create an output image with the same size and the same type as our input. As you can see in the
|
||||
@ref How_Image_Stored_Memory section, depending on the number of channels we may have one or more
|
||||
@ref tutorial_how_to_scan_images_storing "storing" section, depending on the number of channels we may have one or more
|
||||
subcolumns. We will iterate through them via pointers so the total number of elements depends from
|
||||
this number.
|
||||
@code{.cpp}
|
||||
@@ -104,6 +104,7 @@ Result.row(Result.rows - 1).setTo(Scalar(0)); // The bottom row
|
||||
Result.col(0).setTo(Scalar(0)); // The left column
|
||||
Result.col(Result.cols - 1).setTo(Scalar(0)); // The right column
|
||||
@endcode
|
||||
|
||||
The filter2D function
|
||||
---------------------
|
||||
|
||||
|
||||
+66
-70
@@ -18,8 +18,8 @@ numerical matrices and other information describing the matrix itself. *OpenCV*
|
||||
library whose main focus is to process and manipulate this information. Therefore, the first thing
|
||||
you need to be familiar with is how OpenCV stores and handles images.
|
||||
|
||||
*Mat*
|
||||
-----
|
||||
Mat
|
||||
---
|
||||
|
||||
OpenCV has been around since 2001. In those days the library was built around a *C* interface and to
|
||||
store the image in the memory they used a C structure called *IplImage*. This is the one you'll see
|
||||
@@ -62,6 +62,7 @@ To tackle this issue OpenCV uses a reference counting system. The idea is that e
|
||||
its own header, however the matrix may be shared between two instance of them by having their matrix
|
||||
pointers point to the same address. Moreover, the copy operators **will only copy the headers** and
|
||||
the pointer to the large matrix, not the data itself.
|
||||
|
||||
@code{.cpp}
|
||||
Mat A, C; // creates just the header parts
|
||||
A = imread(argv[1], IMREAD_COLOR); // here we'll know the method used (allocate matrix)
|
||||
@@ -70,6 +71,7 @@ Mat B(A); // Use the copy constructor
|
||||
|
||||
C = A; // Assignment operator
|
||||
@endcode
|
||||
|
||||
All the above objects, in the end, point to the same single data matrix. Their headers are
|
||||
different, however, and making a modification using any of them will affect all the other ones as
|
||||
well. In practice the different objects just provide different access method to the same underlying
|
||||
@@ -85,7 +87,7 @@ for cleaning it up when it's no longer needed. The short answer is: the last obj
|
||||
This is handled by using a reference counting mechanism. Whenever somebody copies a header of a
|
||||
*Mat* object, a counter is increased for the matrix. Whenever a header is cleaned this counter is
|
||||
decreased. When the counter reaches zero the matrix too is freed. Sometimes you will want to copy
|
||||
the matrix itself too, so OpenCV provides the @ref cv::clone() and @ref cv::copyTo() functions.
|
||||
the matrix itself too, so OpenCV provides the @ref cv::Mat::clone() and @ref cv::Mat::copyTo() functions.
|
||||
@code{.cpp}
|
||||
Mat F = A.clone();
|
||||
Mat G;
|
||||
@@ -97,10 +99,10 @@ remember from all this is that:
|
||||
- Output image allocation for OpenCV functions is automatic (unless specified otherwise).
|
||||
- You do not need to think about memory management with OpenCVs C++ interface.
|
||||
- The assignment operator and the copy constructor only copies the header.
|
||||
- The underlying matrix of an image may be copied using the @ref cv::clone() and @ref cv::copyTo()
|
||||
- The underlying matrix of an image may be copied using the @ref cv::Mat::clone() and @ref cv::Mat::copyTo()
|
||||
functions.
|
||||
|
||||
*Storing* methods
|
||||
Storing methods
|
||||
-----------------
|
||||
|
||||
This is about how you store the pixel values. You can select the color space and the data type used.
|
||||
@@ -134,10 +136,10 @@ using the float (4 byte = 32 bit) or double (8 byte = 64 bit) data types for eac
|
||||
Nevertheless, remember that increasing the size of a component also increases the size of the whole
|
||||
picture in the memory.
|
||||
|
||||
Creating a *Mat* object explicitly
|
||||
Creating a Mat object explicitly
|
||||
----------------------------------
|
||||
|
||||
In the @ref Load_Save_Image tutorial you have already learned how to write a matrix to an image
|
||||
In the @ref tutorial_load_save_image tutorial you have already learned how to write a matrix to an image
|
||||
file by using the @ref cv::imwrite() function. However, for debugging purposes it's much more
|
||||
convenient to see the actual values. You can do this using the \<\< operator of *Mat*. Be aware that
|
||||
this only works for two dimensional matrices.
|
||||
@@ -146,29 +148,28 @@ Although *Mat* works really well as an image container, it is also a general mat
|
||||
Therefore, it is possible to create and manipulate multidimensional matrices. You can create a Mat
|
||||
object in multiple ways:
|
||||
|
||||
- @ref cv::Mat() Constructor
|
||||
- @ref cv::Mat::Mat Constructor
|
||||
|
||||
@includelineno
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
27-28
|
||||
|
||||

|
||||
lines 27-28
|
||||
|
||||
For two dimensional and multichannel images we first define their size: row and column count wise.
|
||||

|
||||
|
||||
Then we need to specify the data type to use for storing the elements and the number of channels
|
||||
per matrix point. To do this we have multiple definitions constructed according to the following
|
||||
convention:
|
||||
@code{.cpp}
|
||||
CV_[The number of bits per item][Signed or Unsigned][Type Prefix]C[The channel number]
|
||||
@endcode
|
||||
For instance, *CV_8UC3* means we use unsigned char types that are 8 bit long and each pixel has
|
||||
three of these to form the three channels. This are predefined for up to four channel numbers. The
|
||||
@ref cv::Scalar is four element short vector. Specify this and you can initialize all matrix
|
||||
points with a custom value. If you need more you can create the type with the upper macro, setting
|
||||
the channel number in parenthesis as you can see below.
|
||||
For two dimensional and multichannel images we first define their size: row and column count wise.
|
||||
|
||||
Then we need to specify the data type to use for storing the elements and the number of channels
|
||||
per matrix point. To do this we have multiple definitions constructed according to the following
|
||||
convention:
|
||||
@code{.cpp}
|
||||
CV_[The number of bits per item][Signed or Unsigned][Type Prefix]C[The channel number]
|
||||
@endcode
|
||||
For instance, *CV_8UC3* means we use unsigned char types that are 8 bit long and each pixel has
|
||||
three of these to form the three channels. This are predefined for up to four channel numbers. The
|
||||
@ref cv::Scalar is four element short vector. Specify this and you can initialize all matrix
|
||||
points with a custom value. If you need more you can create the type with the upper macro, setting
|
||||
the channel number in parenthesis as you can see below.
|
||||
|
||||
- Use C/C++ arrays and initialize via constructor
|
||||
|
||||
@@ -176,8 +177,8 @@ the channel number in parenthesis as you can see below.
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
35-36
|
||||
|
||||
35-36
|
||||
|
||||
The upper example shows how to create a matrix with more than two dimensions. Specify its
|
||||
dimension, then pass a pointer containing the size for each dimension and the rest remains the
|
||||
same.
|
||||
@@ -187,60 +188,57 @@ the channel number in parenthesis as you can see below.
|
||||
IplImage* img = cvLoadImage("greatwave.png", 1);
|
||||
Mat mtx(img); // convert IplImage* -> Mat
|
||||
@endcode
|
||||
- @ref cv::Create() function:
|
||||
- @ref cv::Mat::create function:
|
||||
|
||||
@includelineno
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
31-32
|
||||
|
||||

|
||||
lines 31-32
|
||||
|
||||
You cannot initialize the matrix values with this construction. It will only reallocate its matrix
|
||||
data memory if the new size will not fit into the old one.
|
||||

|
||||
|
||||
- MATLAB style initializer: @ref cv::zeros() , @ref cv::ones() , @ref cv::eye() . Specify size and
|
||||
You cannot initialize the matrix values with this construction. It will only reallocate its matrix
|
||||
data memory if the new size will not fit into the old one.
|
||||
|
||||
- MATLAB style initializer: @ref cv::Mat::zeros , @ref cv::Mat::ones , @ref cv::Mat::eye . Specify size and
|
||||
data type to use:
|
||||
|
||||
@includelineno
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
40-47
|
||||
|
||||

|
||||
40-47
|
||||
|
||||

|
||||
|
||||
- For small matrices you may use comma separated initializers:
|
||||
|
||||
@includelineno
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
50-51
|
||||
|
||||

|
||||
lines 50-51
|
||||
|
||||
- Create a new header for an existing *Mat* object and @ref cv::clone() or @ref cv::copyTo() it.
|
||||

|
||||
|
||||
- Create a new header for an existing *Mat* object and @ref cv::Mat::clone or @ref cv::Mat::copyTo it.
|
||||
|
||||
@includelineno
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
53-54
|
||||
|
||||
lines 53-54
|
||||
|
||||

|
||||
|
||||
@note
|
||||
You can fill out a matrix with random values using the @ref cv::randu() function. You need to
|
||||
give the lower and upper value for the random values:
|
||||
@note
|
||||
You can fill out a matrix with random values using the @ref cv::randu() function. You need to
|
||||
give the lower and upper value for the random values:
|
||||
|
||||
@includelineno
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
57-58
|
||||
|
||||
57-58
|
||||
|
||||
Output formatting
|
||||
-----------------
|
||||
|
||||
@@ -253,8 +251,8 @@ format your matrix output:
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
61
|
||||
|
||||
61
|
||||
|
||||

|
||||
|
||||
- Python
|
||||
@@ -263,8 +261,8 @@ format your matrix output:
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
62
|
||||
|
||||
62
|
||||
|
||||

|
||||
|
||||
- Comma separated values (CSV)
|
||||
@@ -273,8 +271,8 @@ format your matrix output:
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
64
|
||||
|
||||
64
|
||||
|
||||

|
||||
|
||||
- Numpy
|
||||
@@ -283,8 +281,8 @@ format your matrix output:
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
63
|
||||
|
||||
63
|
||||
|
||||

|
||||
|
||||
- C
|
||||
@@ -293,8 +291,8 @@ format your matrix output:
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
65
|
||||
|
||||
65
|
||||
|
||||

|
||||
|
||||
Output of other common items
|
||||
@@ -308,8 +306,8 @@ OpenCV offers support for output of other common OpenCV data structures too via
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
67-68
|
||||
|
||||
67-68
|
||||
|
||||

|
||||
|
||||
- 3D Point
|
||||
@@ -318,8 +316,8 @@ OpenCV offers support for output of other common OpenCV data structures too via
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
70-71
|
||||
|
||||
70-71
|
||||
|
||||

|
||||
|
||||
- std::vector via cv::Mat
|
||||
@@ -328,8 +326,8 @@ OpenCV offers support for output of other common OpenCV data structures too via
|
||||
cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
|
||||
|
||||
lines
|
||||
74-77
|
||||
|
||||
74-77
|
||||
|
||||

|
||||
|
||||
- std::vector of points
|
||||
@@ -339,12 +337,11 @@ OpenCV offers support for output of other common OpenCV data structures too via
|
||||
|
||||
lines
|
||||
79-83
|
||||
|
||||
|
||||

|
||||
|
||||
Most of the samples here have been included in a small console application. You can download it from
|
||||
[here
|
||||
](samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp)
|
||||
[here](samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp)
|
||||
or in the core section of the cpp samples.
|
||||
|
||||
You can also find a quick video demonstration of this on
|
||||
@@ -355,4 +352,3 @@ You can also find a quick video demonstration of this on
|
||||
<iframe title="Install OpenCV by using its source files - Part 1" width="560" height="349" src="http://www.youtube.com/embed/1tibU7vGWpk?rel=0&loop=1" frameborder="0" allowfullscreen align="middle"></iframe>
|
||||
</div>
|
||||
\endhtmlonly
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@@ -13,15 +13,14 @@ In this tutorial you will learn how to:
|
||||
Code
|
||||
----
|
||||
|
||||
- In the previous tutorial (@ref Drawing_1) we drew diverse geometric figures, giving as input
|
||||
parameters such as coordinates (in the form of @ref cv::Points ), color, thickness, etc. You
|
||||
- In the previous tutorial (@ref tutorial_basic_geometric_drawing) we drew diverse geometric figures, giving as input
|
||||
parameters such as coordinates (in the form of @ref cv::Point), 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* .
|
||||
- This code is in your OpenCV sample folder. Otherwise you can grab it from
|
||||
[here](http://code.opencv.org/projects/opencv/repository/revisions/master/raw/samples/cpp/tutorial_code/core/Matrix/Drawing_2.cpp)
|
||||
.
|
||||
|
||||
Explanation
|
||||
-----------
|
||||
@@ -213,9 +212,9 @@ Explanation
|
||||
**image** minus the value of **i** (remember that for each pixel we are considering three values
|
||||
such as R, G and B, so each of them will be affected)
|
||||
|
||||
Also remember that the substraction operation *always* performs internally a **saturate**
|
||||
operation, which means that the result obtained will always be inside the allowed range (no
|
||||
negative and between 0 and 255 for our example).
|
||||
Also remember that the substraction operation *always* performs internally a **saturate**
|
||||
operation, which means that the result obtained will always be inside the allowed range (no
|
||||
negative and between 0 and 255 for our example).
|
||||
|
||||
Result
|
||||
------
|
||||
@@ -247,6 +246,4 @@ functions, which will produce:
|
||||
colors and positions.
|
||||
8. And the big end (which by the way expresses a big truth too):
|
||||
|
||||

|
||||
|
||||
|
||||

|
||||
|
||||
@@ -262,6 +262,6 @@ As you just saw in the Code section, the program will sequentially execute diver
|
||||
|
||||
#. And the big end (which by the way expresses a big truth too):
|
||||
|
||||
.. image:: images/Drawing_2_Tutorial_Result_7.jpg
|
||||
.. image:: images/Drawing_2_Tutorial_Result_big.jpg
|
||||
:alt: Drawing Tutorial 2 - Final Result 7
|
||||
:align: center
|
||||
|
||||
Reference in New Issue
Block a user