From 565ce61b0500b013863ed5a9e335263c553c2223 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Thu, 20 Jun 2024 12:09:01 +0200 Subject: [PATCH] Improve doxygen doc --- ...ntour.dox => tutorial-imgproc-contour.dox} | 43 ++++++------- tutorial/image/drawingHelpers.cpp | 62 +++++++++---------- .../hough-transform/drawingHelpers.cpp | 22 +++---- 3 files changed, 60 insertions(+), 67 deletions(-) rename doc/tutorial/imgproc/{tutorial-imgproc-contour.doctutorial-imgproc-contour.dox => tutorial-imgproc-contour.dox} (76%) diff --git a/doc/tutorial/imgproc/tutorial-imgproc-contour.doctutorial-imgproc-contour.dox b/doc/tutorial/imgproc/tutorial-imgproc-contour.dox similarity index 76% rename from doc/tutorial/imgproc/tutorial-imgproc-contour.doctutorial-imgproc-contour.dox rename to doc/tutorial/imgproc/tutorial-imgproc-contour.dox index aeb8e8e536..8ef81cbba6 100644 --- a/doc/tutorial/imgproc/tutorial-imgproc-contour.doctutorial-imgproc-contour.dox +++ b/doc/tutorial/imgproc/tutorial-imgproc-contour.dox @@ -7,23 +7,23 @@ This tutorial will show you how to extract the contours from a binary image. The contour extraction algorithm is based on \cite articleSuzuki article and most of the implementation has been ported from \cite Hare:2011:OIJ:2072298.2072421 library. -The function to call is vp::findContours(const vpImage &, vpContour &, std::vector > &, const vpContourRetrievalType&): +The function to call is findContours(const vpImage &, vpContour &, std::vector > &, const vpContourRetrievalType &) - the first argument is the image where '0' pixel value means the background and '1' pixel value means the foreground. **Other values are not allowed.** -- the second argument is a vp::vpContour structure that contains the list of contours in a tree +- the second argument is a VISP_NAMESPACE_NAME::vpContour structure that contains the list of contours in a tree - the third argument is the list of contours -- the last argument is an option to choose the type of contour extraction, see vp::vpContourRetrievalType +- the last argument is an option to choose the type of contour extraction, see VISP_NAMESPACE_NAME::vpContourRetrievalType -The vp::vpContour structure is composed of: -- std::vector< \ref vp::vpContour * > m_children, the list of children contours for the current contour -- vp::vpContourType m_contourType, the type of contour (vp::CONTOUR_OUTER or vp::CONTOUR_HOLE) -- vp::vpContour * m_parent, the parent contour for the current contour +The vpContour structure is composed of: +- std::vector< VISP_NAMESPACE_NAME::vpContour * > m_children, the list of children contours for the current contour +- vpContourType m_contourType, the type of contour (VISP_NAMESPACE_NAME::CONTOUR_OUTER or VISP_NAMESPACE_NAME::CONTOUR_HOLE) +- VISP_NAMESPACE_NAME::vpContour * m_parent, the parent contour for the current contour - std::vector< \ref vpImagePoint > m_points, the list of contour points -- the first or top level contour is called the root contour (with vp::CONTOUR_HOLE type by default) and contains in \a m_children the list of contours +- the first or top level contour is called the root contour (with VISP_NAMESPACE_NAME::CONTOUR_HOLE type by default) and contains in \a m_children the list of contours The different contour extraction methods are: -- vp::CONTOUR_RETR_TREE, all the contours are extracted and stored in a hierarchical tree. -- vp::CONTOUR_RETR_LIST, all the contours are extracted and stored in a list. The top level contour contains in \a m_children the list of all the extracted contours. -- vp::CONTOUR_RETR_EXTERNAL, only the external contours are extracted and stored in a list. The top level contour contains in \a m_children the list of the external extracted contours. +- VISP_NAMESPACE_NAME::CONTOUR_RETR_TREE, all the contours are extracted and stored in a hierarchical tree. +- VISP_NAMESPACE_NAME::CONTOUR_RETR_LIST, all the contours are extracted and stored in a list. The top level contour contains in \a m_children the list of all the extracted contours. +- VISP_NAMESPACE_NAME::CONTOUR_RETR_EXTERNAL, only the external contours are extracted and stored in a list. The top level contour contains in \a m_children the list of the external extracted contours. The next section will provide a concrete example for better understanding. @@ -33,7 +33,7 @@ The following example also available in tutorial-contour.cpp will demonstrate on \include tutorial-contour.cpp -These functions are provided in a \a vp:: namespace and accessible using this include: +These functions are provided in a \a VISP_NAMESPACE_NAME namespace and accessible using this include: \snippet tutorial-contour.cpp Include @@ -44,21 +44,21 @@ The first steps are: \snippet tutorial-contour.cpp Otsu If the object of interest is in white in the image, the formula for the binarization is: \f[ - I_{bin}\left ( i,j \right ) = + I_{bin}\left ( i,j \right ) = \left \{ \begin{matrix} - 0 \text{ if } I_{src}\left ( i,j \right ) < \text{threshold} \\ + 0 \text{ if } I_{src}\left ( i,j \right ) < \text{threshold} \\ 1 \text{ otherwise} \end{matrix} \right. \f] If the object of interest is in black in the image, the formula for the binarization is: \f[ - I_{bin}\left ( i,j \right ) = + I_{bin}\left ( i,j \right ) = \left \{ \begin{matrix} - 1 \text{ if } I_{src}\left ( i,j \right ) < \text{threshold} \\ + 1 \text{ if } I_{src}\left ( i,j \right ) < \text{threshold} \\ 0 \text{ otherwise} \end{matrix} \right. \f] -- extract the contours (by default, it is the vp::CONTOUR_RETR_TREE method) +- extract the contours (by default, it is the VISP_NAMESPACE_NAME::CONTOUR_RETR_TREE method) \snippet tutorial-contour.cpp Find contours - draw the contours if wanted \snippet tutorial-contour.cpp Draw contours @@ -82,7 +82,8 @@ The image after binarisation: \image html img-tutorial-contour-binarisation2.png "Image after binarization using the Otsu method" -Instead of drawing all the contours with the same color, we can assign a first color for vp::CONTOUR_OUTER contour and a second color for vp::CONTOUR_HOLE contour. +Instead of drawing all the contours with the same color, we can assign a first color for +VISP_NAMESPACE_NAME::CONTOUR_OUTER contour and a second color for VISP_NAMESPACE_NAME::CONTOUR_HOLE contour. The function to navigate in the contour tree is the following: @@ -100,7 +101,7 @@ To display the hierarchy, we can use this function: \snippet tutorial-contour.cpp Print contours hierarchy func -For the vp::CONTOUR_RETR_TREE method, the output is: +For the VISP_NAMESPACE_NAME::CONTOUR_RETR_TREE method, the output is:
Contour:\n @@ -166,7 +167,7 @@ Contour:\n The top level contour is always the root contour with zero contour point and which contains the list of contours. -For the vp::CONTOUR_RETR_EXTERNAL method, the output is: +For the VISP_NAMESPACE_NAME::CONTOUR_RETR_EXTERNAL method, the output is:
Contour:\n @@ -198,7 +199,7 @@ The result image is: \image html img-tutorial-contour-draw-contours3.png "External contours extracted and displayed on a new image" -For the vp::CONTOUR_RETR_LIST method, the output is: +For the VISP_NAMESPACE_NAME::CONTOUR_RETR_LIST method, the output is:
Contour:\n diff --git a/tutorial/image/drawingHelpers.cpp b/tutorial/image/drawingHelpers.cpp index 2737a6cd9c..dd9e2630d0 100644 --- a/tutorial/image/drawingHelpers.cpp +++ b/tutorial/image/drawingHelpers.cpp @@ -32,44 +32,40 @@ #include -#ifdef ENABLE_VISP_NAMESPACE -using namespace VISP_NAMESPACE_NAME; -#endif - #if defined(VISP_HAVE_X11) -vpDisplayX drawingHelpers::d_Iinput; -vpDisplayX drawingHelpers::d_dIx; -vpDisplayX drawingHelpers::d_dIy; -vpDisplayX drawingHelpers::d_IcannyVisp; -vpDisplayX drawingHelpers::d_IcannyImgFilter; +VISP_NAMESPACE_ADDRESSING vpDisplayX drawingHelpers::d_Iinput; +VISP_NAMESPACE_ADDRESSING vpDisplayX drawingHelpers::d_dIx; +VISP_NAMESPACE_ADDRESSING vpDisplayX drawingHelpers::d_dIy; +VISP_NAMESPACE_ADDRESSING vpDisplayX drawingHelpers::d_IcannyVisp; +VISP_NAMESPACE_ADDRESSING vpDisplayX drawingHelpers::d_IcannyImgFilter; #elif defined(HAVE_OPENCV_HIGHGUI) -vpDisplayOpenCV drawingHelpers::d_Iinput; -vpDisplayOpenCV drawingHelpers::d_dIx; -vpDisplayOpenCV drawingHelpers::d_dIy; -vpDisplayOpenCV drawingHelpers::d_IcannyVisp; -vpDisplayOpenCV drawingHelpers::d_IcannyImgFilter; +VISP_NAMESPACE_ADDRESSING vpDisplayOpenCV drawingHelpers::d_Iinput; +VISP_NAMESPACE_ADDRESSING vpDisplayOpenCV drawingHelpers::d_dIx; +VISP_NAMESPACE_ADDRESSING vpDisplayOpenCV drawingHelpers::d_dIy; +VISP_NAMESPACE_ADDRESSING vpDisplayOpenCV drawingHelpers::d_IcannyVisp; +VISP_NAMESPACE_ADDRESSING vpDisplayOpenCV drawingHelpers::d_IcannyImgFilter; #elif defined(VISP_HAVE_GTK) -vpDisplayGTK drawingHelpers::d_Iinput; -vpDisplayGTK drawingHelpers::d_dIx; -vpDisplayGTK drawingHelpers::d_dIy; -vpDisplayGTK drawingHelpers::d_IcannyVisp; -vpDisplayGTK drawingHelpers::d_IcannyImgFilter; +VISP_NAMESPACE_ADDRESSING VISP_NAMESPACE_ADDRESSING vpDisplayGTK drawingHelpers::d_Iinput; +VISP_NAMESPACE_ADDRESSING vpDisplayGTK drawingHelpers::d_dIx; +VISP_NAMESPACE_ADDRESSING vpDisplayGTK drawingHelpers::d_dIy; +VISP_NAMESPACE_ADDRESSING vpDisplayGTK drawingHelpers::d_IcannyVisp; +VISP_NAMESPACE_ADDRESSING vpDisplayGTK drawingHelpers::d_IcannyImgFilter; #elif defined(VISP_HAVE_GDI) -vpDisplayGDI drawingHelpers::d_Iinput; -vpDisplayGDI drawingHelpers::d_dIx; -vpDisplayGDI drawingHelpers::d_dIy; -vpDisplayGDI drawingHelpers::d_IcannyVisp; -vpDisplayGDI drawingHelpers::d_IcannyImgFilter; +VISP_NAMESPACE_ADDRESSING vpDisplayGDI drawingHelpers::d_Iinput; +VISP_NAMESPACE_ADDRESSING vpDisplayGDI drawingHelpers::d_dIx; +VISP_NAMESPACE_ADDRESSING vpDisplayGDI drawingHelpers::d_dIy; +VISP_NAMESPACE_ADDRESSING vpDisplayGDI drawingHelpers::d_IcannyVisp; +VISP_NAMESPACE_ADDRESSING vpDisplayGDI drawingHelpers::d_IcannyImgFilter; #elif defined(VISP_HAVE_D3D9) -vpDisplayD3D drawingHelpers::d_Iinput; -vpDisplayD3D drawingHelpers::d_dIx; -vpDisplayD3D drawingHelpers::d_dIy; -vpDisplayD3D drawingHelpers::d_IcannyVisp; -vpDisplayD3D drawingHelpers::d_IcannyImgFilter; +VISP_NAMESPACE_ADDRESSING vpDisplayD3D drawingHelpers::d_Iinput; +VISP_NAMESPACE_ADDRESSING vpDisplayD3D drawingHelpers::d_dIx; +VISP_NAMESPACE_ADDRESSING vpDisplayD3D drawingHelpers::d_dIy; +VISP_NAMESPACE_ADDRESSING vpDisplayD3D drawingHelpers::d_IcannyVisp; +VISP_NAMESPACE_ADDRESSING vpDisplayD3D drawingHelpers::d_IcannyImgFilter; #endif -void drawingHelpers::init(vpImage &Iinput, vpImage &IcannyVisp, vpImage *p_dIx, - vpImage *p_dIy, vpImage *p_IcannyimgFilter) +void drawingHelpers::init(VISP_NAMESPACE_ADDRESSING vpImage &Iinput, VISP_NAMESPACE_ADDRESSING vpImage &IcannyVisp, VISP_NAMESPACE_ADDRESSING vpImage *p_dIx, + VISP_NAMESPACE_ADDRESSING vpImage *p_dIy, VISP_NAMESPACE_ADDRESSING vpImage *p_IcannyimgFilter) { #if defined(VISP_HAVE_DISPLAY) d_Iinput.init(Iinput, 10, 10); @@ -92,14 +88,14 @@ void drawingHelpers::init(vpImage &Iinput, vpImage #endif } -void drawingHelpers::display(vpImage &I, const std::string &title) +void drawingHelpers::display(VISP_NAMESPACE_ADDRESSING vpImage &I, const std::string &title) { vpDisplay::display(I); vpDisplay::setTitle(I, title); vpDisplay::flush(I); } -bool drawingHelpers::waitForClick(const vpImage &I, const bool &blockingMode) +bool drawingHelpers::waitForClick(VISP_NAMESPACE_ADDRESSING const vpImage &I, const bool &blockingMode) { vpDisplay::displayText(I, 15, 15, "Left click to continue...", vpColor::red); vpDisplay::displayText(I, 35, 15, "Right click to stop...", vpColor::red); diff --git a/tutorial/imgproc/hough-transform/drawingHelpers.cpp b/tutorial/imgproc/hough-transform/drawingHelpers.cpp index 69cad2121f..1c1d15db75 100644 --- a/tutorial/imgproc/hough-transform/drawingHelpers.cpp +++ b/tutorial/imgproc/hough-transform/drawingHelpers.cpp @@ -2,25 +2,21 @@ #include -#ifdef ENABLE_VISP_NAMESPACE -using namespace VISP_NAMESPACE_NAME; -#endif - #if defined(VISP_HAVE_X11) -vpDisplayX drawingHelpers::d; +VISP_NAMESPACE_ADDRESSING vpDisplayX drawingHelpers::d; #elif defined(VISP_HAVE_OPENCV) -vpDisplayOpenCV drawingHelpers::d; +VISP_NAMESPACE_ADDRESSING vpDisplayOpenCV drawingHelpers::d; #elif defined(VISP_HAVE_GTK) -vpDisplayGTK drawingHelpers::d; +VISP_NAMESPACE_ADDRESSING vpDisplayGTK drawingHelpers::d; #elif defined(VISP_HAVE_GDI) -vpDisplayGDI drawingHelpers::d; +VISP_NAMESPACE_ADDRESSING vpDisplayGDI drawingHelpers::d; #elif defined(VISP_HAVE_D3D9) -vpDisplayD3D drawingHelpers::d; +VISP_NAMESPACE_ADDRESSING vpDisplayD3D drawingHelpers::d; #endif -vpImage drawingHelpers::I_disp; +VISP_NAMESPACE_ADDRESSING vpImage drawingHelpers::I_disp; -bool drawingHelpers::display(vpImage &I, const std::string &title, const bool &blockingMode) +bool drawingHelpers::display(VISP_NAMESPACE_ADDRESSING vpImage &I, const std::string &title, const bool &blockingMode) { I_disp = I; #if defined(VISP_HAVE_DISPLAY) @@ -47,14 +43,14 @@ bool drawingHelpers::display(vpImage &I, const std::string &title, const return hasToContinue; } -bool drawingHelpers::display(vpImage &D, const std::string &title, const bool &blockingMode) +bool drawingHelpers::display(VISP_NAMESPACE_ADDRESSING vpImage &D, const std::string &title, const bool &blockingMode) { vpImage I; // Image to display vpImageConvert::convert(D, I); return display(I, title, blockingMode); } -bool drawingHelpers::display(vpImage &D, const std::string &title, const bool &blockingMode) +bool drawingHelpers::display(VISP_NAMESPACE_ADDRESSING vpImage &D, const std::string &title, const bool &blockingMode) { vpImage I; // Image to display vpImageConvert::convert(D, I);