1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Doxygen tutorials: cpp done

This commit is contained in:
Maksim Shabunin
2014-11-28 16:21:28 +03:00
parent c5536534d8
commit 36a04ef8de
92 changed files with 2142 additions and 3691 deletions

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 111 KiB

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

@@ -94,9 +94,8 @@ Below is the output of the program. Use the first image as the input. For the DE
the SRTM file located at the USGS here.
[<http://dds.cr.usgs.gov/srtm/version2_1/SRTM1/Region_04/N37W123.hgt.zip>](http://dds.cr.usgs.gov/srtm/version2_1/SRTM1/Region_04/N37W123.hgt.zip)
![image](images/output.jpg)
![](images/gdal_output.jpg)
![image](images/heat-map.jpg)
![image](images/flood-zone.jpg)
![](images/gdal_heat-map.jpg)
![](images/gdal_flood-zone.jpg)
@@ -106,8 +106,8 @@ Results
Below is the output of the program. Use the first image as the input. For the DEM model, download the SRTM file located at the USGS here. `http://dds.cr.usgs.gov/srtm/version2_1/SRTM1/Region_04/N37W123.hgt.zip <http://dds.cr.usgs.gov/srtm/version2_1/SRTM1/Region_04/N37W123.hgt.zip>`_
.. image:: images/output.jpg
.. image:: images/gdal_output.jpg
.. image:: images/heat-map.jpg
.. image:: images/gdal_heat-map.jpg
.. image:: images/flood-zone.jpg
.. image:: images/gdal_flood-zone.jpg
@@ -7,7 +7,7 @@ Adding a Trackbar to our applications! {#tutorial_trackbar}
- Well, it is time to use some fancy GUI tools. OpenCV provides some GUI utilities (*highgui.h*)
for you. An example of this is a **Trackbar**
![image](images/Adding_Trackbars_Tutorial_Trackbar.png)
![](images/Adding_Trackbars_Tutorial_Trackbar.png)
- In this tutorial we will just modify our two previous programs so that they get the input
information from the trackbar.
@@ -88,16 +88,16 @@ Explanation
We only analyze the code that is related to Trackbar:
1. First, we load 02 images, which are going to be blended.
-# First, we load 02 images, which are going to be blended.
@code{.cpp}
src1 = imread("../../images/LinuxLogo.jpg");
src2 = imread("../../images/WindowsLogo.jpg");
@endcode
2. To create a trackbar, first we have to create the window in which it is going to be located. So:
-# To create a trackbar, first we have to create the window in which it is going to be located. So:
@code{.cpp}
namedWindow("Linear Blend", 1);
@endcode
3. Now we can create the Trackbar:
-# Now we can create the Trackbar:
@code{.cpp}
createTrackbar( TrackbarName, "Linear Blend", &alpha_slider, alpha_slider_max, on_trackbar );
@endcode
@@ -110,7 +110,7 @@ We only analyze the code that is related to Trackbar:
- The numerical value of Trackbar is stored in **alpha_slider**
- Whenever the user moves the Trackbar, the callback function **on_trackbar** is called
4. Finally, we have to define the callback function **on_trackbar**
-# Finally, we have to define the callback function **on_trackbar**
@code{.cpp}
void on_trackbar( int, void* )
{
@@ -133,10 +133,10 @@ Result
- Our program produces the following output:
![image](images/Adding_Trackbars_Tutorial_Result_0.jpg)
![](images/Adding_Trackbars_Tutorial_Result_0.jpg)
- As a manner of practice, you can also add 02 trackbars for the program made in
@ref tutorial_basic_linear_transform. One trackbar to set \f$\alpha\f$ and another for \f$\beta\f$. The output might
look like:
![image](images/Adding_Trackbars_Tutorial_Result_1.jpg)
![](images/Adding_Trackbars_Tutorial_Result_1.jpg)
@@ -25,10 +25,14 @@ version of it ](samples/cpp/tutorial_code/HighGUI/video-input-psnr-ssim/video/Me
You may also find the source code and these video file in the
`samples/cpp/tutorial_code/HighGUI/video-input-psnr-ssim/` folder of the OpenCV source library.
@includelineno cpp/tutorial_code/HighGUI/video-input-psnr-ssim/video-input-psnr-ssim.cpp
@dontinclude cpp/tutorial_code/HighGUI/video-input-psnr-ssim/video-input-psnr-ssim.cpp
lines
1-15, 29-31, 33-208
@until Scalar getMSSIM
@skip main
@until {
@skip if
@until return mssim;
@until }
How to read a video stream (online-camera or offline-file)?
-----------------------------------------------------------
@@ -243,10 +247,9 @@ for each frame, and the SSIM only for the frames where the PSNR falls below an i
visualization purpose we show both images in an OpenCV window and print the PSNR and MSSIM values to
the console. Expect to see something like:
![image](images/outputVideoInput.png)
![](images/outputVideoInput.png)
You may observe a runtime instance of this on the [YouTube
here](https://www.youtube.com/watch?v=iOcNljutOgg).
You may observe a runtime instance of this on the [YouTube here](https://www.youtube.com/watch?v=iOcNljutOgg).
\htmlonly
<div align="center">
@@ -47,7 +47,7 @@ somehow longer and includes names such as *XVID*, *DIVX*, *H264* or *LAGS* (*Lag
Codec*). The full list of codecs you may use on a system depends on just what one you have
installed.
![image](images/videoFileStructure.png)
![](images/videoFileStructure.png)
As you can see things can get really complicated with videos. However, OpenCV is mainly a computer
vision library, not a video stream, codec and write one. Therefore, the developers tried to keep
@@ -75,7 +75,7 @@ const string source = argv[1]; // the source file name
string::size_type pAt = source.find_last_of('.'); // Find extension point
const string NAME = source.substr(0, pAt) + argv[2][0] + ".avi"; // Form the new name with container
@endcode
1. The codec to use for the video track. Now all the video codecs have a unique short name of
-# The codec to use for the video track. Now all the video codecs have a unique short name of
maximum four characters. Hence, the *XVID*, *DIVX* or *H264* names. This is called a four
character code. You may also ask this from an input video by using its *get* function. Because
the *get* function is a general function it always returns double values. A double value is
@@ -109,13 +109,13 @@ const string NAME = source.substr(0, pAt) + argv[2][0] + ".avi"; // Form the n
If you pass for this argument minus one than a window will pop up at runtime that contains all
the codec installed on your system and ask you to select the one to use:
![image](images/videoCompressSelect.png)
![](images/videoCompressSelect.png)
2. The frame per second for the output video. Again, here I keep the input videos frame per second
-# The frame per second for the output video. Again, here I keep the input videos frame per second
by using the *get* function.
3. The size of the frames for the output video. Here too I keep the input videos frame size per
-# The size of the frames for the output video. Here too I keep the input videos frame size per
second by using the *get* function.
4. The final argument is an optional one. By default is true and says that the output will be a
-# The final argument is an optional one. By default is true and says that the output will be a
colorful one (so for write you will send three channel images). To create a gray scale video
pass a false parameter here.
@@ -148,7 +148,7 @@ merge(spl, res);
Put all this together and you'll get the upper source code, whose runtime result will show something
around the idea:
![image](images/resultOutputWideoWrite.png)
![](images/resultOutputWideoWrite.png)
You may observe a runtime instance of this on the [YouTube
here](https://www.youtube.com/watch?v=jpBwHxsl1_0).