Commit c61bc3a0 authored by Suleyman TURKMEN's avatar Suleyman TURKMEN

Update documentation and samples

parent 1c73e66e
Changing the contrast and brightness of an image! {#tutorial_basic_linear_transform} Changing the contrast and brightness of an image! {#tutorial_basic_linear_transform}
================================================= =================================================
@prev_tutorial{tutorial_adding_images}
@next_tutorial{tutorial_discrete_fourier_transform}
Goal Goal
---- ----
......
Discrete Fourier Transform {#tutorial_discrete_fourier_transform} Discrete Fourier Transform {#tutorial_discrete_fourier_transform}
========================== ==========================
@prev_tutorial{tutorial_random_generator_and_text} @prev_tutorial{tutorial_basic_linear_transform}
@next_tutorial{tutorial_file_input_output_with_xml_yml} @next_tutorial{tutorial_file_input_output_with_xml_yml}
Goal Goal
......
File Input and Output using XML and YAML files {#tutorial_file_input_output_with_xml_yml} File Input and Output using XML and YAML files {#tutorial_file_input_output_with_xml_yml}
============================================== ==============================================
@prev_tutorial{tutorial_discrete_fourier_transform}
@next_tutorial{tutorial_interoperability_with_OpenCV_1}
Goal Goal
---- ----
......
How to scan images, lookup tables and time measurement with OpenCV {#tutorial_how_to_scan_images} How to scan images, lookup tables and time measurement with OpenCV {#tutorial_how_to_scan_images}
================================================================== ==================================================================
@prev_tutorial{tutorial_mat_the_basic_image_container}
@next_tutorial{tutorial_mat_mask_operations}
Goal Goal
---- ----
......
How to use the OpenCV parallel_for_ to parallelize your code {#tutorial_how_to_use_OpenCV_parallel_for_} How to use the OpenCV parallel_for_ to parallelize your code {#tutorial_how_to_use_OpenCV_parallel_for_}
================================================================== ==================================================================
@prev_tutorial{tutorial_how_to_use_ippa_conversion}
Goal Goal
---- ----
......
Intel® IPP Asynchronous C/C++ library in OpenCV {#tutorial_how_to_use_ippa_conversion} Intel® IPP Asynchronous C/C++ library in OpenCV {#tutorial_how_to_use_ippa_conversion}
=============================================== ===============================================
@prev_tutorial{tutorial_interoperability_with_OpenCV_1}
@next_tutorial{tutorial_how_to_use_OpenCV_parallel_for_}
Goal Goal
---- ----
......
Interoperability with OpenCV 1 {#tutorial_interoperability_with_OpenCV_1} Interoperability with OpenCV 1 {#tutorial_interoperability_with_OpenCV_1}
============================== ==============================
@prev_tutorial{tutorial_file_input_output_with_xml_yml}
@next_tutorial{tutorial_how_to_use_ippa_conversion}
Goal Goal
---- ----
......
Operations with images {#tutorial_mat_operations} Operations with images {#tutorial_mat_operations}
====================== ======================
@prev_tutorial{tutorial_mat_mask_operations}
@next_tutorial{tutorial_adding_images}
Input/Output Input/Output
------------ ------------
......
Mat - The Basic Image Container {#tutorial_mat_the_basic_image_container} Mat - The Basic Image Container {#tutorial_mat_the_basic_image_container}
=============================== ===============================
@next_tutorial{tutorial_how_to_scan_images}
Goal Goal
---- ----
......
...@@ -62,24 +62,6 @@ understanding how to manipulate the images on a pixel level. ...@@ -62,24 +62,6 @@ understanding how to manipulate the images on a pixel level.
We will learn how to change our image appearance! We will learn how to change our image appearance!
- @subpage tutorial_basic_geometric_drawing
*Languages:* C++, Java, Python
*Compatibility:* \> OpenCV 2.0
*Author:* Ana Huamán
We will learn how to draw simple geometry with OpenCV!
- @subpage tutorial_random_generator_and_text
*Compatibility:* \> OpenCV 2.0
*Author:* Ana Huamán
We will draw some *fancy-looking* stuff using OpenCV!
- @subpage tutorial_discrete_fourier_transform - @subpage tutorial_discrete_fourier_transform
*Languages:* C++, Java, Python *Languages:* C++, Java, Python
......
Basic Drawing {#tutorial_basic_geometric_drawing} Basic Drawing {#tutorial_basic_geometric_drawing}
============= =============
@prev_tutorial{tutorial_basic_linear_transform}
@next_tutorial{tutorial_random_generator_and_text} @next_tutorial{tutorial_random_generator_and_text}
Goals Goals
...@@ -82,20 +81,20 @@ Code ...@@ -82,20 +81,20 @@ Code
@add_toggle_cpp @add_toggle_cpp
- This code is in your OpenCV sample folder. Otherwise you can grab it from - This code is in your OpenCV sample folder. Otherwise you can grab it from
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/cpp/tutorial_code/core/Matrix/Drawing_1.cpp) [here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp)
@include samples/cpp/tutorial_code/core/Matrix/Drawing_1.cpp @include samples/cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp
@end_toggle @end_toggle
@add_toggle_java @add_toggle_java
- This code is in your OpenCV sample folder. Otherwise you can grab it from - This code is in your OpenCV sample folder. Otherwise you can grab it from
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java) [here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java)
@include samples/java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java @include samples/java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java
@end_toggle @end_toggle
@add_toggle_python @add_toggle_python
- This code is in your OpenCV sample folder. Otherwise you can grab it from - This code is in your OpenCV sample folder. Otherwise you can grab it from
[here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py) [here](https://raw.githubusercontent.com/opencv/opencv/3.4/samples/python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py)
@include samples/python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py @include samples/python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py
@end_toggle @end_toggle
Explanation Explanation
...@@ -104,42 +103,42 @@ Explanation ...@@ -104,42 +103,42 @@ Explanation
Since we plan to draw two examples (an atom and a rook), we have to create two images and two Since we plan to draw two examples (an atom and a rook), we have to create two images and two
windows to display them. windows to display them.
@add_toggle_cpp @add_toggle_cpp
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp create_images @snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp create_images
@end_toggle @end_toggle
@add_toggle_java @add_toggle_java
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java create_images @snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java create_images
@end_toggle @end_toggle
@add_toggle_python @add_toggle_python
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py create_images @snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py create_images
@end_toggle @end_toggle
We created functions to draw different geometric shapes. For instance, to draw the atom we used We created functions to draw different geometric shapes. For instance, to draw the atom we used
**MyEllipse** and **MyFilledCircle**: **MyEllipse** and **MyFilledCircle**:
@add_toggle_cpp @add_toggle_cpp
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp draw_atom @snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp draw_atom
@end_toggle @end_toggle
@add_toggle_java @add_toggle_java
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java draw_atom @snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java draw_atom
@end_toggle @end_toggle
@add_toggle_python @add_toggle_python
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py draw_atom @snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py draw_atom
@end_toggle @end_toggle
And to draw the rook we employed **MyLine**, **rectangle** and a **MyPolygon**: And to draw the rook we employed **MyLine**, **rectangle** and a **MyPolygon**:
@add_toggle_cpp @add_toggle_cpp
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp draw_rook @snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp draw_rook
@end_toggle @end_toggle
@add_toggle_java @add_toggle_java
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java draw_rook @snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java draw_rook
@end_toggle @end_toggle
@add_toggle_python @add_toggle_python
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py draw_rook @snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py draw_rook
@end_toggle @end_toggle
...@@ -149,15 +148,15 @@ Let's check what is inside each of these functions: ...@@ -149,15 +148,15 @@ Let's check what is inside each of these functions:
<H4>MyLine</H4> <H4>MyLine</H4>
@add_toggle_cpp @add_toggle_cpp
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp my_line @snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp my_line
@end_toggle @end_toggle
@add_toggle_java @add_toggle_java
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java my_line @snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java my_line
@end_toggle @end_toggle
@add_toggle_python @add_toggle_python
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py my_line @snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py my_line
@end_toggle @end_toggle
- As we can see, **MyLine** just call the function **line()** , which does the following: - As we can see, **MyLine** just call the function **line()** , which does the following:
...@@ -170,15 +169,15 @@ Let's check what is inside each of these functions: ...@@ -170,15 +169,15 @@ Let's check what is inside each of these functions:
<H4>MyEllipse</H4> <H4>MyEllipse</H4>
@add_toggle_cpp @add_toggle_cpp
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp my_ellipse @snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp my_ellipse
@end_toggle @end_toggle
@add_toggle_java @add_toggle_java
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java my_ellipse @snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java my_ellipse
@end_toggle @end_toggle
@add_toggle_python @add_toggle_python
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py my_ellipse @snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py my_ellipse
@end_toggle @end_toggle
- From the code above, we can observe that the function **ellipse()** draws an ellipse such - From the code above, we can observe that the function **ellipse()** draws an ellipse such
...@@ -194,15 +193,15 @@ Let's check what is inside each of these functions: ...@@ -194,15 +193,15 @@ Let's check what is inside each of these functions:
<H4>MyFilledCircle</H4> <H4>MyFilledCircle</H4>
@add_toggle_cpp @add_toggle_cpp
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp my_filled_circle @snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp my_filled_circle
@end_toggle @end_toggle
@add_toggle_java @add_toggle_java
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java my_filled_circle @snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java my_filled_circle
@end_toggle @end_toggle
@add_toggle_python @add_toggle_python
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py my_filled_circle @snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py my_filled_circle
@end_toggle @end_toggle
- Similar to the ellipse function, we can observe that *circle* receives as arguments: - Similar to the ellipse function, we can observe that *circle* receives as arguments:
...@@ -215,15 +214,15 @@ Let's check what is inside each of these functions: ...@@ -215,15 +214,15 @@ Let's check what is inside each of these functions:
<H4>MyPolygon</H4> <H4>MyPolygon</H4>
@add_toggle_cpp @add_toggle_cpp
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp my_polygon @snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp my_polygon
@end_toggle @end_toggle
@add_toggle_java @add_toggle_java
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java my_polygon @snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java my_polygon
@end_toggle @end_toggle
@add_toggle_python @add_toggle_python
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py my_polygon @snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py my_polygon
@end_toggle @end_toggle
- To draw a filled polygon we use the function **fillPoly()** . We note that: - To draw a filled polygon we use the function **fillPoly()** . We note that:
...@@ -235,15 +234,15 @@ Let's check what is inside each of these functions: ...@@ -235,15 +234,15 @@ Let's check what is inside each of these functions:
<H4>rectangle</H4> <H4>rectangle</H4>
@add_toggle_cpp @add_toggle_cpp
@snippet cpp/tutorial_code/core/Matrix/Drawing_1.cpp rectangle @snippet cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp rectangle
@end_toggle @end_toggle
@add_toggle_java @add_toggle_java
@snippet java/tutorial_code/core/BasicGeometricDrawing/BasicGeometricDrawing.java rectangle @snippet java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java rectangle
@end_toggle @end_toggle
@add_toggle_python @add_toggle_python
@snippet python/tutorial_code/core/BasicGeometricDrawing/basic_geometric_drawing.py rectangle @snippet python/tutorial_code/imgProc/BasicGeometricDrawing/basic_geometric_drawing.py rectangle
@end_toggle @end_toggle
- Finally we have the @ref cv::rectangle function (we did not create a special function for - Finally we have the @ref cv::rectangle function (we did not create a special function for
......
Eroding and Dilating {#tutorial_erosion_dilatation} Eroding and Dilating {#tutorial_erosion_dilatation}
==================== ====================
@prev_tutorial{tutorial_gausian_median_blur_bilateral_filter}
@next_tutorial{tutorial_opening_closing_hats}
Goal Goal
---- ----
......
Smoothing Images {#tutorial_gausian_median_blur_bilateral_filter} Smoothing Images {#tutorial_gausian_median_blur_bilateral_filter}
================ ================
@prev_tutorial{tutorial_random_generator_and_text}
@next_tutorial{tutorial_erosion_dilatation} @next_tutorial{tutorial_erosion_dilatation}
Goal Goal
......
Back Projection {#tutorial_back_projection} Back Projection {#tutorial_back_projection}
=============== ===============
@prev_tutorial{tutorial_histogram_comparison}
@next_tutorial{tutorial_template_matching}
Goal Goal
---- ----
......
Histogram Calculation {#tutorial_histogram_calculation} Histogram Calculation {#tutorial_histogram_calculation}
===================== =====================
@prev_tutorial{tutorial_histogram_equalization}
@next_tutorial{tutorial_histogram_comparison}
Goal Goal
---- ----
......
Histogram Comparison {#tutorial_histogram_comparison} Histogram Comparison {#tutorial_histogram_comparison}
==================== ====================
@prev_tutorial{tutorial_histogram_calculation}
@next_tutorial{tutorial_back_projection}
Goal Goal
---- ----
......
Histogram Equalization {#tutorial_histogram_equalization} Histogram Equalization {#tutorial_histogram_equalization}
====================== ======================
@prev_tutorial{tutorial_warp_affine}
@next_tutorial{tutorial_histogram_calculation}
Goal Goal
---- ----
......
Canny Edge Detector {#tutorial_canny_detector} Canny Edge Detector {#tutorial_canny_detector}
=================== ===================
@prev_tutorial{tutorial_laplace_operator}
@next_tutorial{tutorial_hough_lines}
Goal Goal
---- ----
......
Image Segmentation with Distance Transform and Watershed Algorithm {#tutorial_distance_transform} Image Segmentation with Distance Transform and Watershed Algorithm {#tutorial_distance_transform}
============= =============
@prev_tutorial{tutorial_point_polygon_test}
@next_tutorial{tutorial_out_of_focus_deblur_filter}
Goal Goal
---- ----
......
Remapping {#tutorial_remap} Remapping {#tutorial_remap}
========= =========
@prev_tutorial{tutorial_hough_circle}
@next_tutorial{tutorial_warp_affine}
Goal Goal
---- ----
......
Affine Transformations {#tutorial_warp_affine} Affine Transformations {#tutorial_warp_affine}
====================== ======================
@prev_tutorial{tutorial_remap}
@next_tutorial{tutorial_histogram_equalization}
Goal Goal
---- ----
......
More Morphology Transformations {#tutorial_opening_closing_hats} More Morphology Transformations {#tutorial_opening_closing_hats}
=============================== ===============================
@prev_tutorial{tutorial_erosion_dilatation}
@next_tutorial{tutorial_hitOrMiss}
Goal Goal
---- ----
......
Out-of-focus Deblur Filter {#tutorial_out_of_focus_deblur_filter} Out-of-focus Deblur Filter {#tutorial_out_of_focus_deblur_filter}
========================== ==========================
@prev_tutorial{tutorial_distance_transform}
Goal Goal
---- ----
......
Random generator and text with OpenCV {#tutorial_random_generator_and_text} Random generator and text with OpenCV {#tutorial_random_generator_and_text}
===================================== =====================================
@prev_tutorial{tutorial_basic_geometric_drawing}
@next_tutorial{tutorial_gausian_median_blur_bilateral_filter}
Goals Goals
----- -----
......
Creating Bounding boxes and circles for contours {#tutorial_bounding_rects_circles} Creating Bounding boxes and circles for contours {#tutorial_bounding_rects_circles}
================================================ ================================================
@prev_tutorial{tutorial_hull}
@next_tutorial{tutorial_bounding_rotated_ellipses}
Goal Goal
---- ----
......
Creating Bounding rotated boxes and ellipses for contours {#tutorial_bounding_rotated_ellipses} Creating Bounding rotated boxes and ellipses for contours {#tutorial_bounding_rotated_ellipses}
========================================================= =========================================================
@prev_tutorial{tutorial_bounding_rects_circles}
@next_tutorial{tutorial_moments}
Goal Goal
---- ----
......
Finding contours in your image {#tutorial_find_contours} Finding contours in your image {#tutorial_find_contours}
============================== ==============================
@prev_tutorial{tutorial_template_matching}
@next_tutorial{tutorial_hull}
Goal Goal
---- ----
......
Convex Hull {#tutorial_hull} Convex Hull {#tutorial_hull}
=========== ===========
@prev_tutorial{tutorial_find_contours}
@next_tutorial{tutorial_bounding_rects_circles}
Goal Goal
---- ----
......
Image Moments {#tutorial_moments} Image Moments {#tutorial_moments}
============= =============
@prev_tutorial{tutorial_bounding_rotated_ellipses}
@next_tutorial{tutorial_point_polygon_test}
Goal Goal
---- ----
......
Point Polygon Test {#tutorial_point_polygon_test} Point Polygon Test {#tutorial_point_polygon_test}
================== ==================
@prev_tutorial{tutorial_moments}
@next_tutorial{tutorial_distance_transform}
Goal Goal
---- ----
......
...@@ -3,6 +3,24 @@ Image Processing (imgproc module) {#tutorial_table_of_content_imgproc} ...@@ -3,6 +3,24 @@ Image Processing (imgproc module) {#tutorial_table_of_content_imgproc}
In this section you will learn about the image processing (manipulation) functions inside OpenCV. In this section you will learn about the image processing (manipulation) functions inside OpenCV.
- @subpage tutorial_basic_geometric_drawing
*Languages:* C++, Java, Python
*Compatibility:* \> OpenCV 2.0
*Author:* Ana Huamán
We will learn how to draw simple geometry with OpenCV!
- @subpage tutorial_random_generator_and_text
*Compatibility:* \> OpenCV 2.0
*Author:* Ana Huamán
We will draw some *fancy-looking* stuff using OpenCV!
- @subpage tutorial_gausian_median_blur_bilateral_filter - @subpage tutorial_gausian_median_blur_bilateral_filter
*Languages:* C++, Java, Python *Languages:* C++, Java, Python
......
Basic Thresholding Operations {#tutorial_threshold} Basic Thresholding Operations {#tutorial_threshold}
============================= =============================
@prev_tutorial{tutorial_pyramids}
@next_tutorial{tutorial_threshold_inRange}
Goal Goal
---- ----
......
Thresholding Operations using inRange {#tutorial_threshold_inRange} Thresholding Operations using inRange {#tutorial_threshold_inRange}
===================================== =====================================
@prev_tutorial{tutorial_threshold}
@next_tutorial{tutorial_filter_2d}
Goal Goal
---- ----
......
...@@ -24,17 +24,7 @@ Explanation ...@@ -24,17 +24,7 @@ Explanation
The most important code part is: The most important code part is:
@code{.cpp} @snippet cpp/stitching.cpp stitching
Mat pano;
Ptr<Stitcher> stitcher = Stitcher::create(mode, try_use_gpu);
Stitcher::Status status = stitcher->stitch(imgs, pano);
if (status != Stitcher::OK)
{
cout << "Can't stitch images, error code = " << int(status) << endl;
return -1;
}
@endcode
A new instance of stitcher is created and the @ref cv::Stitcher::stitch will A new instance of stitcher is created and the @ref cv::Stitcher::stitch will
do all the hard work. do all the hard work.
......
...@@ -307,11 +307,11 @@ optimization procedures like calibrateCamera, stereoCalibrate, or solvePnP . ...@@ -307,11 +307,11 @@ optimization procedures like calibrateCamera, stereoCalibrate, or solvePnP .
*/ */
CV_EXPORTS_W void Rodrigues( InputArray src, OutputArray dst, OutputArray jacobian = noArray() ); CV_EXPORTS_W void Rodrigues( InputArray src, OutputArray dst, OutputArray jacobian = noArray() );
/** @example pose_from_homography.cpp /** @example samples/cpp/tutorial_code/features2D/Homography/pose_from_homography.cpp
An example program about pose estimation from coplanar points An example program about pose estimation from coplanar points
Check @ref tutorial_homography "the corresponding tutorial" for more details Check @ref tutorial_homography "the corresponding tutorial" for more details
*/ */
/** @brief Finds a perspective transformation between two planes. /** @brief Finds a perspective transformation between two planes.
...@@ -526,11 +526,11 @@ CV_EXPORTS_W void projectPoints( InputArray objectPoints, ...@@ -526,11 +526,11 @@ CV_EXPORTS_W void projectPoints( InputArray objectPoints,
OutputArray jacobian = noArray(), OutputArray jacobian = noArray(),
double aspectRatio = 0 ); double aspectRatio = 0 );
/** @example homography_from_camera_displacement.cpp /** @example samples/cpp/tutorial_code/features2D/Homography/homography_from_camera_displacement.cpp
An example program about homography from the camera displacement An example program about homography from the camera displacement
Check @ref tutorial_homography "the corresponding tutorial" for more details Check @ref tutorial_homography "the corresponding tutorial" for more details
*/ */
/** @brief Finds an object pose from 3D-2D point correspondences. /** @brief Finds an object pose from 3D-2D point correspondences.
...@@ -1966,11 +1966,11 @@ CV_EXPORTS_W cv::Mat estimateAffinePartial2D(InputArray from, InputArray to, Out ...@@ -1966,11 +1966,11 @@ CV_EXPORTS_W cv::Mat estimateAffinePartial2D(InputArray from, InputArray to, Out
size_t maxIters = 2000, double confidence = 0.99, size_t maxIters = 2000, double confidence = 0.99,
size_t refineIters = 10); size_t refineIters = 10);
/** @example decompose_homography.cpp /** @example samples/cpp/tutorial_code/features2D/Homography/decompose_homography.cpp
An example program with homography decomposition. An example program with homography decomposition.
Check @ref tutorial_homography "the corresponding tutorial" for more details. Check @ref tutorial_homography "the corresponding tutorial" for more details.
*/ */
/** @brief Decompose a homography matrix to rotation(s), translation(s) and plane normal(s). /** @brief Decompose a homography matrix to rotation(s), translation(s) and plane normal(s).
......
...@@ -273,9 +273,11 @@ of p and len. ...@@ -273,9 +273,11 @@ of p and len.
*/ */
CV_EXPORTS_W int borderInterpolate(int p, int len, int borderType); CV_EXPORTS_W int borderInterpolate(int p, int len, int borderType);
/** @example copyMakeBorder_demo.cpp /** @example samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp
An example using copyMakeBorder function An example using copyMakeBorder function.
*/ Check @ref tutorial_copyMakeBorder "the corresponding tutorial" for more details
*/
/** @brief Forms a border around an image. /** @brief Forms a border around an image.
The function copies the source image into the middle of the destination image. The areas to the The function copies the source image into the middle of the destination image. The areas to the
...@@ -474,9 +476,10 @@ The function can also be emulated with a matrix expression, for example: ...@@ -474,9 +476,10 @@ The function can also be emulated with a matrix expression, for example:
*/ */
CV_EXPORTS_W void scaleAdd(InputArray src1, double alpha, InputArray src2, OutputArray dst); CV_EXPORTS_W void scaleAdd(InputArray src1, double alpha, InputArray src2, OutputArray dst);
/** @example AddingImagesTrackbar.cpp /** @example samples/cpp/tutorial_code/HighGUI/AddingImagesTrackbar.cpp
Check @ref tutorial_trackbar "the corresponding tutorial" for more details
*/
*/
/** @brief Calculates the weighted sum of two arrays. /** @brief Calculates the weighted sum of two arrays.
The function addWeighted calculates the weighted sum of two arrays as follows: The function addWeighted calculates the weighted sum of two arrays as follows:
...@@ -2527,14 +2530,18 @@ public: ...@@ -2527,14 +2530,18 @@ public:
Mat mean; //!< mean value subtracted before the projection and added after the back projection Mat mean; //!< mean value subtracted before the projection and added after the back projection
}; };
/** @example pca.cpp /** @example samples/cpp/pca.cpp
An example using %PCA for dimensionality reduction while maintaining an amount of variance An example using %PCA for dimensionality reduction while maintaining an amount of variance
*/ */
/** @example samples/cpp/tutorial_code/ml/introduction_to_pca/introduction_to_pca.cpp
Check @ref tutorial_introduction_to_pca "the corresponding tutorial" for more details
*/
/** /**
@brief Linear Discriminant Analysis @brief Linear Discriminant Analysis
@todo document this class @todo document this class
*/ */
class CV_EXPORTS LDA class CV_EXPORTS LDA
{ {
public: public:
...@@ -2850,7 +2857,7 @@ public: ...@@ -2850,7 +2857,7 @@ public:
use explicit type cast operators, as in the a1 initialization above. use explicit type cast operators, as in the a1 initialization above.
@param a lower inclusive boundary of the returned random number. @param a lower inclusive boundary of the returned random number.
@param b upper non-inclusive boundary of the returned random number. @param b upper non-inclusive boundary of the returned random number.
*/ */
int uniform(int a, int b); int uniform(int a, int b);
/** @overload */ /** @overload */
float uniform(float a, float b); float uniform(float a, float b);
...@@ -2912,7 +2919,7 @@ public: ...@@ -2912,7 +2919,7 @@ public:
Inspired by http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c Inspired by http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c
@todo document @todo document
*/ */
class CV_EXPORTS RNG_MT19937 class CV_EXPORTS RNG_MT19937
{ {
public: public:
...@@ -2930,17 +2937,11 @@ public: ...@@ -2930,17 +2937,11 @@ public:
unsigned operator ()(unsigned N); unsigned operator ()(unsigned N);
unsigned operator ()(); unsigned operator ()();
/** @brief returns uniformly distributed integer random number from [a,b) range /** @brief returns uniformly distributed integer random number from [a,b) range*/
*/
int uniform(int a, int b); int uniform(int a, int b);
/** @brief returns uniformly distributed floating-point random number from [a,b) range /** @brief returns uniformly distributed floating-point random number from [a,b) range*/
*/
float uniform(float a, float b); float uniform(float a, float b);
/** @brief returns uniformly distributed double-precision floating-point random number from [a,b) range /** @brief returns uniformly distributed double-precision floating-point random number from [a,b) range*/
*/
double uniform(double a, double b); double uniform(double a, double b);
private: private:
...@@ -2954,8 +2955,8 @@ private: ...@@ -2954,8 +2955,8 @@ private:
//! @addtogroup core_cluster //! @addtogroup core_cluster
//! @{ //! @{
/** @example kmeans.cpp /** @example samples/cpp/kmeans.cpp
An example on K-means clustering An example on K-means clustering
*/ */
/** @brief Finds centers of clusters and groups input samples around the clusters. /** @brief Finds centers of clusters and groups input samples around the clusters.
...@@ -3067,7 +3068,7 @@ etc.). ...@@ -3067,7 +3068,7 @@ etc.).
Here is example of SimpleBlobDetector use in your application via Algorithm interface: Here is example of SimpleBlobDetector use in your application via Algorithm interface:
@snippet snippets/core_various.cpp Algorithm @snippet snippets/core_various.cpp Algorithm
*/ */
class CV_EXPORTS_W Algorithm class CV_EXPORTS_W Algorithm
{ {
public: public:
...@@ -3083,8 +3084,8 @@ public: ...@@ -3083,8 +3084,8 @@ public:
virtual void write(FileStorage& fs) const { (void)fs; } virtual void write(FileStorage& fs) const { (void)fs; }
/** @brief simplified API for language bindings /** @brief simplified API for language bindings
* @overload * @overload
*/ */
CV_WRAP void write(const Ptr<FileStorage>& fs, const String& name = String()) const; CV_WRAP void write(const Ptr<FileStorage>& fs, const String& name = String()) const;
/** @brief Reads algorithm parameters from a file storage /** @brief Reads algorithm parameters from a file storage
...@@ -3092,20 +3093,20 @@ public: ...@@ -3092,20 +3093,20 @@ public:
CV_WRAP virtual void read(const FileNode& fn) { (void)fn; } CV_WRAP virtual void read(const FileNode& fn) { (void)fn; }
/** @brief Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read /** @brief Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
*/ */
CV_WRAP virtual bool empty() const { return false; } CV_WRAP virtual bool empty() const { return false; }
/** @brief Reads algorithm from the file node /** @brief Reads algorithm from the file node
This is static template method of Algorithm. It's usage is following (in the case of SVM): This is static template method of Algorithm. It's usage is following (in the case of SVM):
@code @code
cv::FileStorage fsRead("example.xml", FileStorage::READ); cv::FileStorage fsRead("example.xml", FileStorage::READ);
Ptr<SVM> svm = Algorithm::read<SVM>(fsRead.root()); Ptr<SVM> svm = Algorithm::read<SVM>(fsRead.root());
@endcode @endcode
In order to make this method work, the derived class must overwrite Algorithm::read(const In order to make this method work, the derived class must overwrite Algorithm::read(const
FileNode& fn) and also have static create() method without parameters FileNode& fn) and also have static create() method without parameters
(or with all the optional parameters) (or with all the optional parameters)
*/ */
template<typename _Tp> static Ptr<_Tp> read(const FileNode& fn) template<typename _Tp> static Ptr<_Tp> read(const FileNode& fn)
{ {
Ptr<_Tp> obj = _Tp::create(); Ptr<_Tp> obj = _Tp::create();
...@@ -3115,16 +3116,16 @@ public: ...@@ -3115,16 +3116,16 @@ public:
/** @brief Loads algorithm from the file /** @brief Loads algorithm from the file
@param filename Name of the file to read. @param filename Name of the file to read.
@param objname The optional name of the node to read (if empty, the first top-level node will be used) @param objname The optional name of the node to read (if empty, the first top-level node will be used)
This is static template method of Algorithm. It's usage is following (in the case of SVM): This is static template method of Algorithm. It's usage is following (in the case of SVM):
@code @code
Ptr<SVM> svm = Algorithm::load<SVM>("my_svm_model.xml"); Ptr<SVM> svm = Algorithm::load<SVM>("my_svm_model.xml");
@endcode @endcode
In order to make this method work, the derived class must overwrite Algorithm::read(const In order to make this method work, the derived class must overwrite Algorithm::read(const
FileNode& fn). FileNode& fn).
*/ */
template<typename _Tp> static Ptr<_Tp> load(const String& filename, const String& objname=String()) template<typename _Tp> static Ptr<_Tp> load(const String& filename, const String& objname=String())
{ {
FileStorage fs(filename, FileStorage::READ); FileStorage fs(filename, FileStorage::READ);
...@@ -3138,14 +3139,14 @@ public: ...@@ -3138,14 +3139,14 @@ public:
/** @brief Loads algorithm from a String /** @brief Loads algorithm from a String
@param strModel The string variable containing the model you want to load. @param strModel The string variable containing the model you want to load.
@param objname The optional name of the node to read (if empty, the first top-level node will be used) @param objname The optional name of the node to read (if empty, the first top-level node will be used)
This is static template method of Algorithm. It's usage is following (in the case of SVM): This is static template method of Algorithm. It's usage is following (in the case of SVM):
@code @code
Ptr<SVM> svm = Algorithm::loadFromString<SVM>(myStringModel); Ptr<SVM> svm = Algorithm::loadFromString<SVM>(myStringModel);
@endcode @endcode
*/ */
template<typename _Tp> static Ptr<_Tp> loadFromString(const String& strModel, const String& objname=String()) template<typename _Tp> static Ptr<_Tp> loadFromString(const String& strModel, const String& objname=String())
{ {
FileStorage fs(strModel, FileStorage::READ + FileStorage::MEMORY); FileStorage fs(strModel, FileStorage::READ + FileStorage::MEMORY);
...@@ -3156,11 +3157,11 @@ public: ...@@ -3156,11 +3157,11 @@ public:
} }
/** Saves the algorithm to a file. /** Saves the algorithm to a file.
In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs). */ In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs). */
CV_WRAP virtual void save(const String& filename) const; CV_WRAP virtual void save(const String& filename) const;
/** Returns the algorithm string identifier. /** Returns the algorithm string identifier.
This string is used as top level xml/yml node tag when the object is saved to a file or string. */ This string is used as top level xml/yml node tag when the object is saved to a file or string. */
CV_WRAP virtual String getDefaultName() const; CV_WRAP virtual String getDefaultName() const;
protected: protected:
......
...@@ -575,7 +575,7 @@ protected: ...@@ -575,7 +575,7 @@ protected:
MatStep& operator = (const MatStep&); MatStep& operator = (const MatStep&);
}; };
/** @example cout_mat.cpp /** @example samples/cpp/cout_mat.cpp
An example demonstrating the serial out capabilities of cv::Mat An example demonstrating the serial out capabilities of cv::Mat
*/ */
......
...@@ -287,12 +287,12 @@ element is a structure of 2 integers, followed by a single-precision floating-po ...@@ -287,12 +287,12 @@ element is a structure of 2 integers, followed by a single-precision floating-po
equivalent notations of the above specification are `iif`, `2i1f` and so forth. Other examples: `u` equivalent notations of the above specification are `iif`, `2i1f` and so forth. Other examples: `u`
means that the array consists of bytes, and `2d` means the array consists of pairs of doubles. means that the array consists of bytes, and `2d` means the array consists of pairs of doubles.
@see @ref filestorage.cpp @see @ref samples/cpp/filestorage.cpp
*/ */
//! @{ //! @{
/** @example filestorage.cpp /** @example samples/cpp/filestorage.cpp
A complete example using the FileStorage interface A complete example using the FileStorage interface
*/ */
......
...@@ -59,6 +59,20 @@ ...@@ -59,6 +59,20 @@
A network training is in principle not supported. A network training is in principle not supported.
@} @}
*/ */
/** @example samples/dnn/classification.cpp
Check @ref tutorial_dnn_googlenet "the corresponding tutorial" for more details
*/
/** @example samples/dnn/colorization.cpp
*/
/** @example samples/dnn/object_detection.cpp
Check @ref tutorial_dnn_yolo "the corresponding tutorial" for more details
*/
/** @example samples/dnn/openpose.cpp
*/
/** @example samples/dnn/segmentation.cpp
*/
/** @example samples/dnn/text_detection.cpp
*/
#include <opencv2/dnn/dnn.hpp> #include <opencv2/dnn/dnn.hpp>
#endif /* OPENCV_DNN_HPP */ #endif /* OPENCV_DNN_HPP */
...@@ -452,12 +452,13 @@ The function getWindowImageRect returns the client screen coordinates, width and ...@@ -452,12 +452,13 @@ The function getWindowImageRect returns the client screen coordinates, width and
*/ */
CV_EXPORTS_W Rect getWindowImageRect(const String& winname); CV_EXPORTS_W Rect getWindowImageRect(const String& winname);
/** @example samples/cpp/create_mask.cpp
This program demonstrates using mouse events and how to make and use a mask image (black and white) .
*/
/** @brief Sets mouse handler for the specified window /** @brief Sets mouse handler for the specified window
@param winname Name of the window. @param winname Name of the window.
@param onMouse Mouse callback. See OpenCV samples, such as @param onMouse Callback function for mouse events. See OpenCV samples on how to specify and use the callback.
<https://github.com/opencv/opencv/tree/3.4/samples/cpp/ffilldemo.cpp>, on how to specify and
use the callback.
@param userdata The optional parameter passed to the callback. @param userdata The optional parameter passed to the callback.
*/ */
CV_EXPORTS void setMouseCallback(const String& winname, MouseCallback onMouse, void* userdata = 0); CV_EXPORTS void setMouseCallback(const String& winname, MouseCallback onMouse, void* userdata = 0);
......
This diff is collapsed.
...@@ -215,7 +215,7 @@ public: ...@@ -215,7 +215,7 @@ public:
virtual Ptr<MaskGenerator> getMaskGenerator() = 0; virtual Ptr<MaskGenerator> getMaskGenerator() = 0;
}; };
/** @example facedetect.cpp /** @example samples/cpp/facedetect.cpp
This program demonstrates usage of the Cascade classifier class This program demonstrates usage of the Cascade classifier class
\image html Cascade_Classifier_Tutorial_Result_Haar.jpg "Sample screenshot" width=321 height=254 \image html Cascade_Classifier_Tutorial_Result_Haar.jpg "Sample screenshot" width=321 height=254
*/ */
...@@ -443,7 +443,7 @@ public: ...@@ -443,7 +443,7 @@ public:
*/ */
CV_WRAP double getWinSigma() const; CV_WRAP double getWinSigma() const;
/**@example peopledetect.cpp /**@example samples/cpp/peopledetect.cpp
*/ */
/**@brief Sets coefficients for the linear SVM classifier. /**@brief Sets coefficients for the linear SVM classifier.
@param _svmdetector coefficients for the linear SVM classifier. @param _svmdetector coefficients for the linear SVM classifier.
...@@ -478,7 +478,7 @@ public: ...@@ -478,7 +478,7 @@ public:
*/ */
virtual void copyTo(HOGDescriptor& c) const; virtual void copyTo(HOGDescriptor& c) const;
/**@example train_HOG.cpp /**@example samples/cpp/train_HOG.cpp
*/ */
/** @brief Computes HOG descriptors of given image. /** @brief Computes HOG descriptors of given image.
@param img Matrix of the type CV_8U containing an image where HOG features will be calculated. @param img Matrix of the type CV_8U containing an image where HOG features will be calculated.
...@@ -575,7 +575,7 @@ public: ...@@ -575,7 +575,7 @@ public:
*/ */
CV_WRAP static std::vector<float> getDefaultPeopleDetector(); CV_WRAP static std::vector<float> getDefaultPeopleDetector();
/**@example hog.cpp /**@example samples/tapi/hog.cpp
*/ */
/** @brief Returns coefficients of the classifier trained for people detection (for 48x96 windows). /** @brief Returns coefficients of the classifier trained for people detection (for 48x96 windows).
*/ */
......
...@@ -730,7 +730,7 @@ CV_EXPORTS_W void decolor( InputArray src, OutputArray grayscale, OutputArray co ...@@ -730,7 +730,7 @@ CV_EXPORTS_W void decolor( InputArray src, OutputArray grayscale, OutputArray co
//! @addtogroup photo_clone //! @addtogroup photo_clone
//! @{ //! @{
/** @example cloning_demo.cpp /** @example samples/cpp/tutorial_code/photo/seamless_cloning/cloning_demo.cpp
An example using seamlessClone function An example using seamlessClone function
*/ */
/** @brief Image editing tasks concern either global changes (color/intensity corrections, filters, /** @brief Image editing tasks concern either global changes (color/intensity corrections, filters,
...@@ -836,7 +836,7 @@ CV_EXPORTS_W void edgePreservingFilter(InputArray src, OutputArray dst, int flag ...@@ -836,7 +836,7 @@ CV_EXPORTS_W void edgePreservingFilter(InputArray src, OutputArray dst, int flag
CV_EXPORTS_W void detailEnhance(InputArray src, OutputArray dst, float sigma_s = 10, CV_EXPORTS_W void detailEnhance(InputArray src, OutputArray dst, float sigma_s = 10,
float sigma_r = 0.15f); float sigma_r = 0.15f);
/** @example npr_demo.cpp /** @example samples/cpp/tutorial_code/photo/non_photorealistic_rendering/npr_demo.cpp
An example using non-photorealistic line drawing functions An example using non-photorealistic line drawing functions
*/ */
/** @brief Pencil-like non-photorealistic line drawing /** @brief Pencil-like non-photorealistic line drawing
......
...@@ -53,7 +53,7 @@ namespace cv ...@@ -53,7 +53,7 @@ namespace cv
//! @addtogroup shape //! @addtogroup shape
//! @{ //! @{
/** @example shape_example.cpp /** @example samples/cpp/shape_example.cpp
An example using shape distance algorithm An example using shape distance algorithm
*/ */
/** @brief Abstract base class for shape distance algorithms. /** @brief Abstract base class for shape distance algorithms.
......
...@@ -109,6 +109,14 @@ namespace cv { ...@@ -109,6 +109,14 @@ namespace cv {
//! @addtogroup stitching //! @addtogroup stitching
//! @{ //! @{
/** @example samples/cpp/stitching.cpp
A basic example on image stitching
*/
/** @example samples/cpp/stitching_detailed.cpp
A detailed example on image stitching
*/
/** @brief High level image stitcher. /** @brief High level image stitcher.
It's possible to use this class without being aware of the entire stitching pipeline. However, to It's possible to use this class without being aware of the entire stitching pipeline. However, to
......
...@@ -78,9 +78,10 @@ See the OpenCV sample camshiftdemo.c that tracks colored objects. ...@@ -78,9 +78,10 @@ See the OpenCV sample camshiftdemo.c that tracks colored objects.
*/ */
CV_EXPORTS_W RotatedRect CamShift( InputArray probImage, CV_IN_OUT Rect& window, CV_EXPORTS_W RotatedRect CamShift( InputArray probImage, CV_IN_OUT Rect& window,
TermCriteria criteria ); TermCriteria criteria );
/** @example camshiftdemo.cpp /** @example samples/cpp/camshiftdemo.cpp
An example using the mean-shift tracking algorithm An example using the mean-shift tracking algorithm
*/ */
/** @brief Finds an object on a back projection image. /** @brief Finds an object on a back projection image.
@param probImage Back projection of the object histogram. See calcBackProject for details. @param probImage Back projection of the object histogram. See calcBackProject for details.
...@@ -123,9 +124,10 @@ CV_EXPORTS_W int buildOpticalFlowPyramid( InputArray img, OutputArrayOfArrays py ...@@ -123,9 +124,10 @@ CV_EXPORTS_W int buildOpticalFlowPyramid( InputArray img, OutputArrayOfArrays py
int derivBorder = BORDER_CONSTANT, int derivBorder = BORDER_CONSTANT,
bool tryReuseInputImage = true ); bool tryReuseInputImage = true );
/** @example lkdemo.cpp /** @example samples/cpp/lkdemo.cpp
An example using the Lucas-Kanade optical flow algorithm An example using the Lucas-Kanade optical flow algorithm
*/ */
/** @brief Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with /** @brief Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with
pyramids. pyramids.
...@@ -263,9 +265,9 @@ enum ...@@ -263,9 +265,9 @@ enum
MOTION_HOMOGRAPHY = 3 MOTION_HOMOGRAPHY = 3
}; };
/** @example image_alignment.cpp /** @example samples/cpp/image_alignment.cpp
An example using the image alignment ECC algorithm An example using the image alignment ECC algorithm
*/ */
/** @brief Finds the geometric transform (warp) between two images in terms of the ECC criterion @cite EP08 . /** @brief Finds the geometric transform (warp) between two images in terms of the ECC criterion @cite EP08 .
...@@ -322,9 +324,10 @@ CV_EXPORTS_W double findTransformECC( InputArray templateImage, InputArray input ...@@ -322,9 +324,10 @@ CV_EXPORTS_W double findTransformECC( InputArray templateImage, InputArray input
TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 50, 0.001), TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 50, 0.001),
InputArray inputMask = noArray()); InputArray inputMask = noArray());
/** @example kalman.cpp /** @example samples/cpp/kalman.cpp
An example using the standard Kalman filter An example using the standard Kalman filter
*/ */
/** @brief Kalman filter class. /** @brief Kalman filter class.
The class implements a standard Kalman filter <http://en.wikipedia.org/wiki/Kalman_filter>, The class implements a standard Kalman filter <http://en.wikipedia.org/wiki/Kalman_filter>,
......
...@@ -815,13 +815,18 @@ protected: ...@@ -815,13 +815,18 @@ protected:
class IVideoWriter; class IVideoWriter;
/** @example videowriter_basic.cpp /** @example samples/cpp/tutorial_code/videoio/video-write/video-write.cpp
Check @ref tutorial_video_write "the corresponding tutorial" for more details
*/
/** @example samples/cpp/videowriter_basic.cpp
An example using VideoCapture and VideoWriter class An example using VideoCapture and VideoWriter class
*/ */
/** @brief Video writer class. /** @brief Video writer class.
The class provides C++ API for writing video files or image sequences. The class provides C++ API for writing video files or image sequences.
*/ */
class CV_EXPORTS_W VideoWriter class CV_EXPORTS_W VideoWriter
{ {
public: public:
......
#include <opencv2/core/utility.hpp> #include <opencv2/core/utility.hpp>
#include "opencv2/imgproc.hpp" #include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp" #include "opencv2/imgcodecs.hpp"
...@@ -32,44 +33,29 @@ static void on_trackbar(int, void*) ...@@ -32,44 +33,29 @@ static void on_trackbar(int, void*)
imshow( "Connected Components", dst ); imshow( "Connected Components", dst );
} }
static void help()
{
cout << "\n This program demonstrates connected components and use of the trackbar\n"
"Usage: \n"
" ./connected_components <image(../data/stuff.jpg as default)>\n"
"The image is converted to grayscale and displayed, another image has a trackbar\n"
"that controls thresholding and thereby the extracted contours which are drawn in color\n";
}
const char* keys =
{
"{help h||}{@image|../data/stuff.jpg|image for converting to a grayscale}"
};
int main( int argc, const char** argv ) int main( int argc, const char** argv )
{ {
CommandLineParser parser(argc, argv, keys); CommandLineParser parser(argc, argv, "{@image|../data/stuff.jpg|image for converting to a grayscale}");
if (parser.has("help")) parser.about("\nThis program demonstrates connected components and use of the trackbar\n");
{ parser.printMessage();
help(); cout << "\nThe image is converted to grayscale and displayed, another image has a trackbar\n"
return 0; "that controls thresholding and thereby the extracted contours which are drawn in color\n";
}
string inputImage = parser.get<string>(0); String inputImage = parser.get<string>(0);
img = imread(inputImage.c_str(), 0); img = imread(inputImage, IMREAD_GRAYSCALE);
if(img.empty()) if(img.empty())
{ {
cout << "Could not read input image file: " << inputImage << endl; cout << "Could not read input image file: " << inputImage << endl;
return -1; return EXIT_FAILURE;
} }
namedWindow( "Image", 1 );
imshow( "Image", img ); imshow( "Image", img );
namedWindow( "Connected Components", 1 ); namedWindow( "Connected Components", WINDOW_AUTOSIZE);
createTrackbar( "Threshold", "Connected Components", &threshval, 255, on_trackbar ); createTrackbar( "Threshold", "Connected Components", &threshval, 255, on_trackbar );
on_trackbar(threshval, 0); on_trackbar(threshval, 0);
waitKey(0); waitKey(0);
return 0; return EXIT_SUCCESS;
} }
// The "Square Detector" program. // The "Square Detector" program.
// It loads several images sequentially and tries to find squares in // It loads several images sequentially and tries to find squares in
// each image // each image
...@@ -8,22 +9,18 @@ ...@@ -8,22 +9,18 @@
#include "opencv2/highgui.hpp" #include "opencv2/highgui.hpp"
#include <iostream> #include <iostream>
#include <math.h>
#include <string.h>
using namespace cv; using namespace cv;
using namespace std; using namespace std;
static void help() static void help(const char* programName)
{ {
cout << cout <<
"\nA program using pyramid scaling, Canny, contours, contour simpification and\n" "\nA program using pyramid scaling, Canny, contours and contour simplification\n"
"memory storage (it's got it all folks) to find\n" "to find squares in a list of images (pic1-6.png)\n"
"squares in a list of images pic1-6.png\n"
"Returns sequence of squares detected on the image.\n" "Returns sequence of squares detected on the image.\n"
"the sequence is stored in the specified memory storage\n"
"Call:\n" "Call:\n"
"./squares [file_name (optional)]\n" "./" << programName << " [file_name (optional)]\n"
"Using OpenCV version " << CV_VERSION << "\n" << endl; "Using OpenCV version " << CV_VERSION << "\n" << endl;
} }
...@@ -44,7 +41,6 @@ static double angle( Point pt1, Point pt2, Point pt0 ) ...@@ -44,7 +41,6 @@ static double angle( Point pt1, Point pt2, Point pt0 )
} }
// returns sequence of squares detected on the image. // returns sequence of squares detected on the image.
// the sequence is stored in the specified memory storage
static void findSquares( const Mat& image, vector<vector<Point> >& squares ) static void findSquares( const Mat& image, vector<vector<Point> >& squares )
{ {
squares.clear(); squares.clear();
...@@ -93,7 +89,7 @@ static void findSquares( const Mat& image, vector<vector<Point> >& squares ) ...@@ -93,7 +89,7 @@ static void findSquares( const Mat& image, vector<vector<Point> >& squares )
{ {
// approximate contour with accuracy proportional // approximate contour with accuracy proportional
// to the contour perimeter // to the contour perimeter
approxPolyDP(Mat(contours[i]), approx, arcLength(Mat(contours[i]), true)*0.02, true); approxPolyDP(contours[i], approx, arcLength(contours[i], true)*0.02, true);
// square contours should have 4 vertices after approximation // square contours should have 4 vertices after approximation
// relatively large area (to filter out noisy contours) // relatively large area (to filter out noisy contours)
...@@ -102,8 +98,8 @@ static void findSquares( const Mat& image, vector<vector<Point> >& squares ) ...@@ -102,8 +98,8 @@ static void findSquares( const Mat& image, vector<vector<Point> >& squares )
// area may be positive or negative - in accordance with the // area may be positive or negative - in accordance with the
// contour orientation // contour orientation
if( approx.size() == 4 && if( approx.size() == 4 &&
fabs(contourArea(Mat(approx))) > 1000 && fabs(contourArea(approx)) > 1000 &&
isContourConvex(Mat(approx)) ) isContourConvex(approx) )
{ {
double maxCosine = 0; double maxCosine = 0;
...@@ -144,7 +140,7 @@ int main(int argc, char** argv) ...@@ -144,7 +140,7 @@ int main(int argc, char** argv)
{ {
static const char* names[] = { "../data/pic1.png", "../data/pic2.png", "../data/pic3.png", static const char* names[] = { "../data/pic1.png", "../data/pic2.png", "../data/pic3.png",
"../data/pic4.png", "../data/pic5.png", "../data/pic6.png", 0 }; "../data/pic4.png", "../data/pic5.png", "../data/pic6.png", 0 };
help(); help(argv[0]);
if( argc > 1) if( argc > 1)
{ {
...@@ -152,12 +148,11 @@ int main(int argc, char** argv) ...@@ -152,12 +148,11 @@ int main(int argc, char** argv)
names[1] = "0"; names[1] = "0";
} }
namedWindow( wndname, 1 );
vector<vector<Point> > squares; vector<vector<Point> > squares;
for( int i = 0; names[i] != 0; i++ ) for( int i = 0; names[i] != 0; i++ )
{ {
Mat image = imread(names[i], 1); Mat image = imread(names[i], IMREAD_COLOR);
if( image.empty() ) if( image.empty() )
{ {
cout << "Couldn't load " << names[i] << endl; cout << "Couldn't load " << names[i] << endl;
...@@ -167,7 +162,7 @@ int main(int argc, char** argv) ...@@ -167,7 +162,7 @@ int main(int argc, char** argv)
findSquares(image, squares); findSquares(image, squares);
drawSquares(image, squares); drawSquares(image, squares);
char c = (char)waitKey(); int c = waitKey();
if( c == 27 ) if( c == 27 )
break; break;
} }
......
...@@ -20,8 +20,9 @@ int parseCmdArgs(int argc, char** argv); ...@@ -20,8 +20,9 @@ int parseCmdArgs(int argc, char** argv);
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
int retval = parseCmdArgs(argc, argv); int retval = parseCmdArgs(argc, argv);
if (retval) return -1; if (retval) return EXIT_FAILURE;
//![stitching]
Mat pano; Mat pano;
Ptr<Stitcher> stitcher = Stitcher::create(mode, try_use_gpu); Ptr<Stitcher> stitcher = Stitcher::create(mode, try_use_gpu);
Stitcher::Status status = stitcher->stitch(imgs, pano); Stitcher::Status status = stitcher->stitch(imgs, pano);
...@@ -29,12 +30,13 @@ int main(int argc, char* argv[]) ...@@ -29,12 +30,13 @@ int main(int argc, char* argv[])
if (status != Stitcher::OK) if (status != Stitcher::OK)
{ {
cout << "Can't stitch images, error code = " << int(status) << endl; cout << "Can't stitch images, error code = " << int(status) << endl;
return -1; return EXIT_FAILURE;
} }
//![stitching]
imwrite(result_name, pano); imwrite(result_name, pano);
cout << "stitching completed successfully\n" << result_name << " saved!"; cout << "stitching completed successfully\n" << result_name << " saved!";
return 0; return EXIT_SUCCESS;
} }
...@@ -63,7 +65,7 @@ int parseCmdArgs(int argc, char** argv) ...@@ -63,7 +65,7 @@ int parseCmdArgs(int argc, char** argv)
if (argc == 1) if (argc == 1)
{ {
printUsage(argv); printUsage(argv);
return -1; return EXIT_FAILURE;
} }
for (int i = 1; i < argc; ++i) for (int i = 1; i < argc; ++i)
...@@ -71,7 +73,7 @@ int parseCmdArgs(int argc, char** argv) ...@@ -71,7 +73,7 @@ int parseCmdArgs(int argc, char** argv)
if (string(argv[i]) == "--help" || string(argv[i]) == "/?") if (string(argv[i]) == "--help" || string(argv[i]) == "/?")
{ {
printUsage(argv); printUsage(argv);
return -1; return EXIT_FAILURE;
} }
else if (string(argv[i]) == "--try_use_gpu") else if (string(argv[i]) == "--try_use_gpu")
{ {
...@@ -82,7 +84,7 @@ int parseCmdArgs(int argc, char** argv) ...@@ -82,7 +84,7 @@ int parseCmdArgs(int argc, char** argv)
else else
{ {
cout << "Bad --try_use_gpu flag value\n"; cout << "Bad --try_use_gpu flag value\n";
return -1; return EXIT_FAILURE;
} }
i++; i++;
} }
...@@ -104,7 +106,7 @@ int parseCmdArgs(int argc, char** argv) ...@@ -104,7 +106,7 @@ int parseCmdArgs(int argc, char** argv)
else else
{ {
cout << "Bad --mode flag value\n"; cout << "Bad --mode flag value\n";
return -1; return EXIT_FAILURE;
} }
i++; i++;
} }
...@@ -114,7 +116,7 @@ int parseCmdArgs(int argc, char** argv) ...@@ -114,7 +116,7 @@ int parseCmdArgs(int argc, char** argv)
if (img.empty()) if (img.empty())
{ {
cout << "Can't read image '" << argv[i] << "'\n"; cout << "Can't read image '" << argv[i] << "'\n";
return -1; return EXIT_FAILURE;
} }
if (divide_images) if (divide_images)
...@@ -130,5 +132,5 @@ int parseCmdArgs(int argc, char** argv) ...@@ -130,5 +132,5 @@ int parseCmdArgs(int argc, char** argv)
imgs.push_back(img); imgs.push_back(img);
} }
} }
return 0; return EXIT_SUCCESS;
} }
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//
//M*/
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
......
...@@ -33,7 +33,7 @@ void Morphology_Operations( int, void* ); ...@@ -33,7 +33,7 @@ void Morphology_Operations( int, void* );
int main( int argc, char** argv ) int main( int argc, char** argv )
{ {
//![load] //![load]
CommandLineParser parser( argc, argv, "{@input | ../data/LinuxLogo.jpg | input image}" ); CommandLineParser parser( argc, argv, "{@input | ../data/baboon.jpg | input image}" );
src = imread( parser.get<String>( "@input" ), IMREAD_COLOR ); src = imread( parser.get<String>( "@input" ), IMREAD_COLOR );
if (src.empty()) if (src.empty())
{ {
......
// The "Square Detector" program.
// It loads several images sequentially and tries to find squares in
// each image
#include "opencv2/core.hpp" #include "opencv2/core.hpp"
#include "opencv2/core/ocl.hpp" #include "opencv2/core/ocl.hpp"
...@@ -9,7 +6,6 @@ ...@@ -9,7 +6,6 @@
#include "opencv2/imgcodecs.hpp" #include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp" #include "opencv2/highgui.hpp"
#include <iostream> #include <iostream>
#include <string.h>
using namespace cv; using namespace cv;
using namespace std; using namespace std;
...@@ -31,7 +27,6 @@ static double angle( Point pt1, Point pt2, Point pt0 ) ...@@ -31,7 +27,6 @@ static double angle( Point pt1, Point pt2, Point pt0 )
// returns sequence of squares detected on the image. // returns sequence of squares detected on the image.
// the sequence is stored in the specified memory storage
static void findSquares( const UMat& image, vector<vector<Point> >& squares ) static void findSquares( const UMat& image, vector<vector<Point> >& squares )
{ {
squares.clear(); squares.clear();
...@@ -66,7 +61,7 @@ static void findSquares( const UMat& image, vector<vector<Point> >& squares ) ...@@ -66,7 +61,7 @@ static void findSquares( const UMat& image, vector<vector<Point> >& squares )
{ {
// apply threshold if l!=0: // apply threshold if l!=0:
// tgray(x,y) = gray(x,y) < (l+1)*255/N ? 255 : 0 // tgray(x,y) = gray(x,y) < (l+1)*255/N ? 255 : 0
cv::threshold(gray0, gray, (l+1)*255/N, 255, THRESH_BINARY); threshold(gray0, gray, (l+1)*255/N, 255, THRESH_BINARY);
} }
// find contours and store them all as a list // find contours and store them all as a list
...@@ -80,7 +75,7 @@ static void findSquares( const UMat& image, vector<vector<Point> >& squares ) ...@@ -80,7 +75,7 @@ static void findSquares( const UMat& image, vector<vector<Point> >& squares )
// approximate contour with accuracy proportional // approximate contour with accuracy proportional
// to the contour perimeter // to the contour perimeter
approxPolyDP(Mat(contours[i]), approx, arcLength(Mat(contours[i]), true)*0.02, true); approxPolyDP(contours[i], approx, arcLength(contours[i], true)*0.02, true);
// square contours should have 4 vertices after approximation // square contours should have 4 vertices after approximation
// relatively large area (to filter out noisy contours) // relatively large area (to filter out noisy contours)
...@@ -89,8 +84,8 @@ static void findSquares( const UMat& image, vector<vector<Point> >& squares ) ...@@ -89,8 +84,8 @@ static void findSquares( const UMat& image, vector<vector<Point> >& squares )
// area may be positive or negative - in accordance with the // area may be positive or negative - in accordance with the
// contour orientation // contour orientation
if( approx.size() == 4 && if( approx.size() == 4 &&
fabs(contourArea(Mat(approx))) > 1000 && fabs(contourArea(approx)) > 1000 &&
isContourConvex(Mat(approx)) ) isContourConvex(approx) )
{ {
double maxCosine = 0; double maxCosine = 0;
...@@ -150,7 +145,7 @@ int main(int argc, char** argv) ...@@ -150,7 +145,7 @@ int main(int argc, char** argv)
if(cmd.has("help")) if(cmd.has("help"))
{ {
cout << "Usage : squares [options]" << endl; cout << "Usage : " << argv[0] << " [options]" << endl;
cout << "Available options:" << endl; cout << "Available options:" << endl;
cmd.printMessage(); cmd.printMessage();
return EXIT_SUCCESS; return EXIT_SUCCESS;
...@@ -158,7 +153,7 @@ int main(int argc, char** argv) ...@@ -158,7 +153,7 @@ int main(int argc, char** argv)
if (cmd.has("cpu_mode")) if (cmd.has("cpu_mode"))
{ {
ocl::setUseOpenCL(false); ocl::setUseOpenCL(false);
std::cout << "OpenCL was disabled" << std::endl; cout << "OpenCL was disabled" << endl;
} }
string inputName = cmd.get<string>("i"); string inputName = cmd.get<string>("i");
...@@ -185,11 +180,11 @@ int main(int argc, char** argv) ...@@ -185,11 +180,11 @@ int main(int argc, char** argv)
do do
{ {
int64 t_start = cv::getTickCount(); int64 t_start = getTickCount();
findSquares(image, squares); findSquares(image, squares);
t_cpp += cv::getTickCount() - t_start; t_cpp += cv::getTickCount() - t_start;
t_start = cv::getTickCount(); t_start = getTickCount();
cout << "run loop: " << j << endl; cout << "run loop: " << j << endl;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment