Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quality rules 11 #1418

Merged
merged 14 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ VP_CHECK_PACKAGE(Log1p)
# We use CDash set through CTestConfig.cmake file
# Dashboards are sent to https://cdash-ci.inria.fr/index.php?project=ViSP
#----------------------------------------------------------------------
if(BUILD_TESTS)
if(BUILD_TESTS OR BUILD_EXAMPLES OR BUILD_DEMOS)
enable_testing()
mark_as_advanced(DART_ROOT)
mark_as_advanced(BUILD_TESTING)
Expand Down Expand Up @@ -1283,6 +1283,10 @@ if(VISP_DATASET_FOUND)
set(VISP_HAVE_DATASET_VERSION "(${VISP_DATASET_VERSION_MAJOR}<<16 | ${VISP_DATASET_VERSION_MINOR}<<8 | ${VISP_DATASET_VERSION_PATCH})") # for vpConfig.h
endif()

if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/vision/include/visp3/vision/vpHomography.h")
set(VISP_HAVE_HOMOGRAPHY TRUE)
endif()

# libraries for Pioneer mobile robots
if(USE_ARIA AND UNIX)
if(ARIA_FOUND AND USE_THREADS AND RT_FOUND AND DL_FOUND)
Expand Down
1 change: 1 addition & 0 deletions cmake/templates/VISPConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ set(VISP_HAVE_FT_IIT_SDK "@VISP_HAVE_FT_IIT_SDK@")
set(VISP_HAVE_GDI "@VISP_HAVE_GDI@")
set(VISP_HAVE_GTK "@VISP_HAVE_GTK@")
set(VISP_HAVE_GSL "@VISP_HAVE_GSL@")
set(VISP_HAVE_HOMOGRAPHY "@VISP_HAVE_HOMOGRAPHY@")
set(VISP_HAVE_JACOSDK "@VISP_HAVE_JACOSDK@")
set(VISP_HAVE_JPEG "@VISP_HAVE_JPEG@")
set(VISP_HAVE_LAPACK "@VISP_HAVE_LAPACK@")
Expand Down
3 changes: 3 additions & 0 deletions cmake/templates/vpConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,9 @@ namespace vp = VISP_NAMESPACE_NAME;
// Defined if nullptr is available
#cmakedefine VISP_HAVE_NULLPTR

// Defined if vpHomography is available
#cmakedefine VISP_HAVE_HOMOGRAPHY

// Emulate nullptr when not available when cxx98 is enabled
// Note that on ubuntu 12.04 __cplusplus is equal to 1 that's why in the next line we consider __cplusplus <= 199711L
// and not __cplusplus == 199711L
Expand Down
1 change: 1 addition & 0 deletions doc/config-doxygen.in
Original file line number Diff line number Diff line change
Expand Up @@ -2383,6 +2383,7 @@ PREDEFINED = @DOXYGEN_SHOULD_SKIP_THIS@ \
VISP_HAVE_GTK \
VISP_HAVE_GSL \
VISP_HAVE_FUNC_INET_NTOP \
VISP_HAVE_HOMOGRAPHY \
VISP_HAVE_JACOSDK \
VISP_HAVE_JPEG \
VISP_HAVE_LAPACK \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned char> &, vpContour &, std::vector<std::vector<vpImagePoint> > &, const vpContourRetrievalType&):
The function to call is findContours(const vpImage<unsigned char> &, vpContour &, std::vector<std::vector<vpImagePoint> > &, 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.

Expand All @@ -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

Expand All @@ -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
Expand All @@ -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:

Expand All @@ -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:

<blockquote>
Contour:\n
Expand Down Expand Up @@ -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:

<blockquote>
Contour:\n
Expand Down Expand Up @@ -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:

<blockquote>
Contour:\n
Expand Down
9 changes: 4 additions & 5 deletions example/tracking/trackMeCircle.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/****************************************************************************
*
/*
* ViSP, open source Visual Servoing Platform software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
* Copyright (C) 2005 - 2024 by Inria. All rights reserved.
*
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -30,8 +29,7 @@
*
* Description:
* Tracking of an ellipse.
*
*****************************************************************************/
*/

/*!
\file trackMeCircle.cpp
Expand All @@ -46,6 +44,7 @@
*/

#include <visp3/core/vpConfig.h>
#include <visp3/core/vpDebug.h>

#include <iomanip>
#include <sstream>
Expand Down
6 changes: 3 additions & 3 deletions modules/ar/include/visp3/ar/vpPanda3DBaseRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class VISP_EXPORT vpPanda3DBaseRenderer
* @param framework
* @param window
*/
void initFromParent(std::shared_ptr<PandaFramework> framework, PT(WindowFramework) window);
void initFromParent(std::shared_ptr<PandaFramework> framework, std::shared_ptr<WindowFramework> window);


virtual void renderFrame();
Expand Down Expand Up @@ -281,10 +281,10 @@ class VISP_EXPORT vpPanda3DBaseRenderer
const std::string m_name; //! name of the renderer
int m_renderOrder; //! Rendering priority for this renderer and its buffers. A lower value will be rendered first. Should be used when calling make_output in setupRenderTarget()
std::shared_ptr<PandaFramework> m_framework; //! Pointer to the active panda framework
PT(WindowFramework) m_window; //! Pointer to owning window, which can create buffers etc. It is not necessarily visible.
std::shared_ptr<WindowFramework> m_window; //! Pointer to owning window, which can create buffers etc. It is not necessarily visible.
vpPanda3DRenderParameters m_renderParameters; //! Rendering parameters
NodePath m_renderRoot; //! Node containing all the objects and the camera for this renderer
PT(Camera) m_camera;
PointerTo<Camera> m_camera;
NodePath m_cameraPath; //! NodePath of the camera
std::vector<GraphicsOutput *> m_buffers; //! Set of buffers that this renderer uses. This storage contains weak refs to those buffers and should not deallocate them.
};
Expand Down
2 changes: 1 addition & 1 deletion modules/ar/include/visp3/ar/vpPanda3DPostProcessFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class VISP_EXPORT vpPanda3DPostProcessFilter : public vpPanda3DBaseRenderer
std::shared_ptr<vpPanda3DBaseRenderer> m_inputRenderer;
bool m_isOutput; //! Whether this filter is an output to be used and should be copied to ram
std::string m_fragmentShader;
PT(Shader) m_shader;
PointerTo<Shader> m_shader;
Texture *m_texture;
GraphicsOutput *m_buffer;

Expand Down
2 changes: 1 addition & 1 deletion modules/ar/include/visp3/ar/vpPanda3DRGBRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class VISP_EXPORT vpPanda3DRGBRenderer : public vpPanda3DBaseRenderer, public vp

NodePath m_backgroundImage;
DisplayRegion *m_display2d;
PT(Texture) m_backgroundTexture;
Texture* m_backgroundTexture;

};

Expand Down
1 change: 1 addition & 0 deletions modules/ar/src/coin-simulator/vpAR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#ifdef VISP_HAVE_COIN3D_AND_GUI

#include <visp3/ar/vpAR.h>
#include <visp3/core/vpDebug.h>
#include <visp3/core/vpTime.h>

/* Objets OIV. */
Expand Down
1 change: 1 addition & 0 deletions modules/ar/src/coin-simulator/vpSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#ifdef VISP_HAVE_COIN3D_AND_GUI

#include <visp3/ar/vpSimulator.h>
#include <visp3/core/vpDebug.h>
#include <visp3/core/vpTime.h>

#include <visp3/core/vpImage.h>
Expand Down
6 changes: 3 additions & 3 deletions modules/ar/src/panda3d-simulator/vpPanda3DBaseRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ void vpPanda3DBaseRenderer::initFramework()
WindowProperties winProps;
winProps.set_size(LVecBase2i(m_renderParameters.getImageWidth(), m_renderParameters.getImageHeight()));
int flags = GraphicsPipe::BF_refuse_window;
m_window = m_framework->open_window(winProps, flags);
m_window = std::shared_ptr<WindowFramework>(m_framework->open_window(winProps, flags));
// try and reopen with visible window
if (m_window == nullptr) {
winProps.set_minimized(true);
m_window = m_framework->open_window(winProps, 0);
m_window = std::shared_ptr<WindowFramework>(m_framework->open_window(winProps, 0));
}
if (m_window == nullptr) {
throw vpException(vpException::notInitialized,
Expand All @@ -74,7 +74,7 @@ void vpPanda3DBaseRenderer::initFramework()
//m_window->get_display_region_3d()->set_camera(m_cameraPath);
}

void vpPanda3DBaseRenderer::initFromParent(std::shared_ptr<PandaFramework> framework, PT(WindowFramework) window)
void vpPanda3DBaseRenderer::initFromParent(std::shared_ptr<PandaFramework> framework, std::shared_ptr<WindowFramework> window)
{
m_framework = framework;
m_window = window;
Expand Down
4 changes: 2 additions & 2 deletions modules/ar/src/panda3d-simulator/vpPanda3DRendererSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ void vpPanda3DRendererSet::initFramework()
WindowProperties winProps;
winProps.set_size(LVecBase2i(m_renderParameters.getImageWidth(), m_renderParameters.getImageHeight()));
int flags = GraphicsPipe::BF_refuse_window;
m_window = m_framework->open_window(winProps, flags);
m_window = std::shared_ptr<WindowFramework>(m_framework->open_window(winProps, flags));
if (m_window == nullptr) {
winProps.set_minimized(true);
m_window = m_framework->open_window(winProps, 0);
m_window = std::shared_ptr<WindowFramework>(m_framework->open_window(winProps, 0));
}
if (m_window == nullptr) {
throw vpException(vpException::fatalError, "Could not open Panda3D window (hidden or visible)");
Expand Down
Loading
Loading