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

Merge pull request #25042 from mshabunin:doc-upgrade

Documentation transition to fresh Doxygen #25042

* current Doxygen version is 1.10, but we will use 1.9.8 for now due to issue with snippets (https://github.com/doxygen/doxygen/pull/10584)
* Doxyfile adapted to new version
* MathJax updated to 3.x
* `@relates` instructions removed temporarily due to issue in Doxygen (to avoid warnings)
* refactored matx.hpp - extracted matx.inl.hpp
* opencv_contrib - https://github.com/opencv/opencv_contrib/pull/3638
This commit is contained in:
Maksim Shabunin
2024-03-05 16:19:45 +03:00
committed by GitHub
parent 0f5792a7a1
commit bf06e3d09f
49 changed files with 1764 additions and 1658 deletions
@@ -111,7 +111,7 @@ called and it will update the output image based on the current trackbar values.
Let's analyze these two functions:
#### The erosion function
### The erosion function (CPP)
@snippet cpp/tutorial_code/ImgProc/Morphology_1.cpp erosion
@@ -135,7 +135,7 @@ receives three arguments:
That is all. We are ready to perform the erosion of our image.
#### The dilation function
### The dilation function (CPP)
The code is below. As you can see, it is completely similar to the snippet of code for **erosion**.
Here we also have the option of defining our kernel, its anchor point and the size of the operator
@@ -175,7 +175,7 @@ In short we
The action and state changed listeners added call at the end the `update` method which updates
the image based on the current slider values. So every time we move any slider, the `update` method is triggered.
#### Updating the image
### Updating the image (Java)
To update the image we used the following implementation:
@@ -190,7 +190,7 @@ In other words we
Let's analyze the `erode` and `dilate` methods:
#### The erosion method
### The erosion method (Java)
@snippet java/tutorial_code/ImgProc/erosion_dilatation/MorphologyDemo1.java erosion
@@ -213,7 +213,7 @@ receives three arguments:
That is all. We are ready to perform the erosion of our image.
#### The dilation function
### The dilation function (Java)
The code is below. As you can see, it is completely similar to the snippet of code for **erosion**.
Here we also have the option of defining our kernel, its anchor point and the size of the operator
@@ -240,7 +240,7 @@ called and it will update the output image based on the current trackbar values.
Let's analyze these two functions:
#### The erosion function
### The erosion function (Python)
@snippet python/tutorial_code/imgProc/erosion_dilatation/morphology_1.py erosion
@@ -262,7 +262,7 @@ specified, it is assumed to be in the center.
That is all. We are ready to perform the erosion of our image.
#### The dilation function
### The dilation function (Python)
The code is below. As you can see, it is completely similar to the snippet of code for **erosion**.
Here we also have the option of defining our kernel, its anchor point and the size of the operator
@@ -133,7 +133,7 @@ Explanation
Let's check the OpenCV functions that involve only the smoothing procedure, since the rest is
already known by now.
#### Normalized Block Filter:
### Normalized Block Filter:
- OpenCV offers the function **blur()** to perform smoothing with this filter.
We specify 4 arguments (more details, check the Reference):
@@ -157,7 +157,7 @@ already known by now.
@snippet samples/python/tutorial_code/imgProc/Smoothing/smoothing.py blur
@end_toggle
#### Gaussian Filter:
### Gaussian Filter:
- It is performed by the function **GaussianBlur()** :
Here we use 4 arguments (more details, check the OpenCV reference):
@@ -183,7 +183,7 @@ already known by now.
@snippet samples/python/tutorial_code/imgProc/Smoothing/smoothing.py gaussianblur
@end_toggle
#### Median Filter:
### Median Filter:
- This filter is provided by the **medianBlur()** function:
We use three arguments:
@@ -203,7 +203,7 @@ already known by now.
@snippet samples/python/tutorial_code/imgProc/Smoothing/smoothing.py medianblur
@end_toggle
#### Bilateral Filter
### Bilateral Filter
- Provided by OpenCV function **bilateralFilter()**
We use 5 arguments:
@@ -78,7 +78,7 @@ You can also download it from
Explanation
-----------
#### Declare the variables
### Declare the variables
First we declare the variables we are going to use:
@@ -97,7 +97,7 @@ First we declare the variables we are going to use:
Especial attention deserves the variable *rng* which is a random number generator. We use it to
generate the random border color, as we will see soon.
#### Load an image
### Load an image
As usual we load our source image *src*:
@@ -113,7 +113,7 @@ As usual we load our source image *src*:
@snippet python/tutorial_code/ImgTrans/MakeBorder/copy_make_border.py load
@end_toggle
#### Create a window
### Create a window
After giving a short intro of how to use the program, we create a window:
@@ -129,7 +129,7 @@ After giving a short intro of how to use the program, we create a window:
@snippet python/tutorial_code/ImgTrans/MakeBorder/copy_make_border.py create_window
@end_toggle
#### Initialize arguments
### Initialize arguments
Now we initialize the argument that defines the size of the borders (*top*, *bottom*, *left* and
*right*). We give them a value of 5% the size of *src*.
@@ -146,7 +146,7 @@ Now we initialize the argument that defines the size of the borders (*top*, *bot
@snippet python/tutorial_code/ImgTrans/MakeBorder/copy_make_border.py init_arguments
@end_toggle
#### Loop
### Loop
The program runs in an infinite loop while the key **ESC** isn't pressed.
If the user presses '**c**' or '**r**', the *borderType* variable
@@ -164,7 +164,7 @@ takes the value of *BORDER_CONSTANT* or *BORDER_REPLICATE* respectively:
@snippet python/tutorial_code/ImgTrans/MakeBorder/copy_make_border.py check_keypress
@end_toggle
#### Random color
### Random color
In each iteration (after 0.5 seconds), the random border color (*value*) is updated...
@@ -182,7 +182,7 @@ In each iteration (after 0.5 seconds), the random border color (*value*) is upda
This value is a set of three numbers picked randomly in the range \f$[0,255]\f$.
#### Form a border around the image
### Form a border around the image
Finally, we call the function **copyMakeBorder()** to apply the respective padding:
@@ -209,7 +209,7 @@ Finally, we call the function **copyMakeBorder()** to apply the respective paddi
-# *value*: If *borderType* is *BORDER_CONSTANT*, this is the value used to fill the border
pixels.
#### Display the results
### Display the results
We display our output image in the image created previously
@@ -94,7 +94,7 @@ You can also download it from
Explanation
-----------
#### Load an image
### Load an image
@add_toggle_cpp
@snippet cpp/tutorial_code/ImgTrans/filter2D_demo.cpp load
@@ -108,7 +108,7 @@ Explanation
@snippet python/tutorial_code/ImgTrans/Filter2D/filter2D.py load
@end_toggle
#### Initialize the arguments
### Initialize the arguments
@add_toggle_cpp
@snippet cpp/tutorial_code/ImgTrans/filter2D_demo.cpp init_arguments
@@ -122,7 +122,7 @@ Explanation
@snippet python/tutorial_code/ImgTrans/Filter2D/filter2D.py init_arguments
@end_toggle
##### Loop
### Loop
Perform an infinite loop updating the kernel size and applying our linear filter to the input
image. Let's analyze that more in detail:
@@ -74,7 +74,7 @@ Explanation
The image we used can be found [here](https://raw.githubusercontent.com/opencv/opencv/4.x/samples/data/smarties.png)
#### Load an image:
### Load an image:
@add_toggle_cpp
@snippet samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp load
@@ -88,7 +88,7 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o
@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py load
@end_toggle
#### Convert it to grayscale:
### Convert it to grayscale:
@add_toggle_cpp
@snippet samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp convert_to_gray
@@ -102,7 +102,7 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o
@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py convert_to_gray
@end_toggle
#### Apply a Median blur to reduce noise and avoid false circle detection:
### Apply a Median blur to reduce noise and avoid false circle detection:
@add_toggle_cpp
@snippet samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp reduce_noise
@@ -116,7 +116,7 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o
@snippet samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py reduce_noise
@end_toggle
#### Proceed to apply Hough Circle Transform:
### Proceed to apply Hough Circle Transform:
@add_toggle_cpp
@snippet samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp houghcircles
@@ -144,7 +144,7 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o
- *min_radius = 0*: Minimum radius to be detected. If unknown, put zero as default.
- *max_radius = 0*: Maximum radius to be detected. If unknown, put zero as default.
#### Draw the detected circles:
### Draw the detected circles:
@add_toggle_cpp
@snippet samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp draw
@@ -160,7 +160,7 @@ The image we used can be found [here](https://raw.githubusercontent.com/opencv/o
You can see that we will draw the circle(s) on red and the center(s) with a small green dot
#### Display the detected circle(s) and wait for the user to exit the program:
### Display the detected circle(s) and wait for the user to exit the program:
@add_toggle_cpp
@snippet samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp display
@@ -129,7 +129,7 @@ The sample code that we will explain can be downloaded from
Explanation
-----------
#### Load an image:
### Load an image:
@add_toggle_cpp
@snippet samples/cpp/tutorial_code/ImgTrans/houghlines.cpp load
@@ -143,7 +143,7 @@ Explanation
@snippet samples/python/tutorial_code/ImgTrans/HoughLine/hough_lines.py load
@end_toggle
#### Detect the edges of the image by using a Canny detector:
### Detect the edges of the image by using a Canny detector:
@add_toggle_cpp
@snippet samples/cpp/tutorial_code/ImgTrans/houghlines.cpp edge_detection
@@ -160,7 +160,7 @@ Explanation
Now we will apply the Hough Line Transform. We will explain how to use both OpenCV functions
available for this purpose.
#### Standard Hough Line Transform:
### Standard Hough Line Transform:
First, you apply the Transform:
@add_toggle_cpp
@@ -199,7 +199,7 @@ And then you display the result by drawing the lines.
@snippet samples/python/tutorial_code/ImgTrans/HoughLine/hough_lines.py draw_lines
@end_toggle
#### Probabilistic Hough Line Transform
### Probabilistic Hough Line Transform
First you apply the transform:
@add_toggle_cpp
@@ -242,7 +242,7 @@ And then you display the result by drawing the lines.
@snippet samples/python/tutorial_code/ImgTrans/HoughLine/hough_lines.py draw_lines_p
@end_toggle
#### Display the original image and the detected lines:
### Display the original image and the detected lines:
@add_toggle_cpp
@snippet samples/cpp/tutorial_code/ImgTrans/houghlines.cpp imshow
@@ -256,7 +256,7 @@ And then you display the result by drawing the lines.
@snippet samples/python/tutorial_code/ImgTrans/HoughLine/hough_lines.py imshow
@end_toggle
#### Wait until the user exits the program
### Wait until the user exits the program
@add_toggle_cpp
@snippet samples/cpp/tutorial_code/ImgTrans/houghlines.cpp exit
@@ -81,7 +81,7 @@ Code
Explanation
-----------
#### Declare variables
### Declare variables
@add_toggle_cpp
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp variables
@@ -95,7 +95,7 @@ Explanation
@snippet samples/python/tutorial_code/ImgTrans/LaPlace/laplace_demo.py variables
@end_toggle
#### Load source image
### Load source image
@add_toggle_cpp
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp load
@@ -109,7 +109,7 @@ Explanation
@snippet samples/python/tutorial_code/ImgTrans/LaPlace/laplace_demo.py load
@end_toggle
#### Reduce noise
### Reduce noise
@add_toggle_cpp
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp reduce_noise
@@ -123,7 +123,7 @@ Explanation
@snippet samples/python/tutorial_code/ImgTrans/LaPlace/laplace_demo.py reduce_noise
@end_toggle
#### Grayscale
### Grayscale
@add_toggle_cpp
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp convert_to_gray
@@ -137,7 +137,7 @@ Explanation
@snippet samples/python/tutorial_code/ImgTrans/LaPlace/laplace_demo.py convert_to_gray
@end_toggle
#### Laplacian operator
### Laplacian operator
@add_toggle_cpp
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp laplacian
@@ -160,7 +160,7 @@ Explanation
this example.
- *scale*, *delta* and *BORDER_DEFAULT*: We leave them as default values.
#### Convert output to a *CV_8U* image
### Convert output to a *CV_8U* image
@add_toggle_cpp
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp convert
@@ -174,7 +174,7 @@ Explanation
@snippet samples/python/tutorial_code/ImgTrans/LaPlace/laplace_demo.py convert
@end_toggle
#### Display the result
### Display the result
@add_toggle_cpp
@snippet cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp display
@@ -58,7 +58,7 @@ Theory
gradient of an image intensity function.
-# The Sobel Operator combines Gaussian smoothing and differentiation.
#### Formulation
### Formulation
Assuming that the image to be operated is \f$I\f$:
@@ -140,23 +140,23 @@ You can also download it from
Explanation
-----------
#### Declare variables
### Declare variables
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp variables
#### Load source image
### Load source image
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp load
#### Reduce noise
### Reduce noise
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp reduce_noise
#### Grayscale
### Grayscale
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp convert_to_gray
#### Sobel Operator
### Sobel Operator
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp sobel
@@ -174,18 +174,18 @@ Explanation
Notice that to calculate the gradient in *x* direction we use: \f$x_{order}= 1\f$ and
\f$y_{order} = 0\f$. We do analogously for the *y* direction.
#### Convert output to a CV_8U image
### Convert output to a CV_8U image
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp convert
#### Gradient
### Gradient
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp blend
We try to approximate the *gradient* by adding both directional gradients (note that
this is not an exact calculation at all! but it is good for our purposes).
#### Show results
### Show results
@snippet cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp display
@@ -80,7 +80,7 @@ Explanation / Result
Get image from [here](https://raw.githubusercontent.com/opencv/opencv/4.x/doc/tutorials/imgproc/morph_lines_detection/images/src.png) .
#### Load Image
### Load Image
@add_toggle_cpp
@snippet samples/cpp/tutorial_code/ImgProc/morph_lines_detection/Morphology_3.cpp load_image
@@ -96,7 +96,7 @@ Get image from [here](https://raw.githubusercontent.com/opencv/opencv/4.x/doc/tu
![](images/src.png)
#### Grayscale
### Grayscale
@add_toggle_cpp
@snippet samples/cpp/tutorial_code/ImgProc/morph_lines_detection/Morphology_3.cpp gray
@@ -112,7 +112,7 @@ Get image from [here](https://raw.githubusercontent.com/opencv/opencv/4.x/doc/tu
![](images/gray.png)
#### Grayscale to Binary image
### Grayscale to Binary image
@add_toggle_cpp
@snippet samples/cpp/tutorial_code/ImgProc/morph_lines_detection/Morphology_3.cpp bin
@@ -128,7 +128,7 @@ Get image from [here](https://raw.githubusercontent.com/opencv/opencv/4.x/doc/tu
![](images/binary.png)
#### Output images
### Output images
Now we are ready to apply morphological operations in order to extract the horizontal and vertical lines and as a consequence to separate the music notes from the music sheet, but first let's initialize the output images that we will use for that reason:
@@ -144,7 +144,7 @@ Now we are ready to apply morphological operations in order to extract the horiz
@snippet samples/python/tutorial_code/imgProc/morph_lines_detection/morph_lines_detection.py init
@end_toggle
#### Structure elements
### Structure elements
As we specified in the theory in order to extract the object that we desire, we need to create the corresponding structure element. Since we want to extract the horizontal lines, a corresponding structure element for that purpose will have the following shape:
![](images/linear_horiz.png)
@@ -182,7 +182,7 @@ and again this is represented as follows:
![](images/vert.png)
#### Refine edges / Result
### Refine edges / Result
As you can see we are almost there. However, at that point you will notice that the edges of the notes are a bit rough. For that reason we need to refine the edges in order to obtain a smoother result:
@@ -43,7 +43,7 @@ Theory
pyramid (with less resolution)
- In this tutorial we'll use the *Gaussian pyramid*.
#### Gaussian Pyramid
### Gaussian Pyramid
- Imagine the pyramid as a set of layers in which the higher the layer, the smaller the size.
@@ -100,7 +100,7 @@ Explanation
Let's check the general structure of the program:
#### Load an image
### Load an image
@add_toggle_cpp
@snippet cpp/tutorial_code/ImgProc/Pyramids/Pyramids.cpp load
@@ -114,7 +114,7 @@ Let's check the general structure of the program:
@snippet python/tutorial_code/imgProc/Pyramids/pyramids.py load
@end_toggle
#### Create window
### Create window
@add_toggle_cpp
@snippet cpp/tutorial_code/ImgProc/Pyramids/Pyramids.cpp show_image
@@ -128,7 +128,7 @@ Let's check the general structure of the program:
@snippet python/tutorial_code/imgProc/Pyramids/pyramids.py show_image
@end_toggle
#### Loop
### Loop
@add_toggle_cpp
@snippet cpp/tutorial_code/ImgProc/Pyramids/Pyramids.cpp loop