From 9c1368800c4fede2108151105184cc7d0d202783 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Thu, 7 Nov 2024 17:00:32 +0100 Subject: [PATCH] Fix build when visp namespace is enabled --- .../visp3/ar/vpPanda3DPostProcessFilter.h | 3 ++- .../vpPanda3DRendererSet.cpp | 2 ++ .../include/visp3/core/vpCannyEdgeDetection.h | 4 +++- modules/core/include/visp3/core/vpColormap.h | 7 +++--- modules/core/include/visp3/core/vpFont.h | 3 ++- .../core/include/visp3/core/vpFrameGrabber.h | 3 ++- .../core/include/visp3/core/vpImageCircle.h | 3 ++- .../core/include/visp3/core/vpMomentArea.h | 5 ++-- .../include/visp3/core/vpMomentCentered.h | 24 +++++++++---------- .../include/visp3/core/vpUnscentedKalman.h | 3 ++- modules/core/src/display/vpDisplay.cpp | 3 ++- modules/core/src/display/vpDisplay_rgba.cpp | 16 ++++++------- .../core/src/image/vpCannyEdgeDetection.cpp | 5 ++-- .../tracking/forward-projection/vpCircle.cpp | 3 ++- .../forward-projection/vpCylinder.cpp | 3 ++- modules/io/src/image/vpImageIo.cpp | 4 ++++ .../visual-feature/vpFeatureMomentAlpha.cpp | 7 +++++- .../vpFeatureMomentCentered.cpp | 2 ++ 18 files changed, 62 insertions(+), 38 deletions(-) diff --git a/modules/ar/include/visp3/ar/vpPanda3DPostProcessFilter.h b/modules/ar/include/visp3/ar/vpPanda3DPostProcessFilter.h index f988b3778d..c4743ddf00 100644 --- a/modules/ar/include/visp3/ar/vpPanda3DPostProcessFilter.h +++ b/modules/ar/include/visp3/ar/vpPanda3DPostProcessFilter.h @@ -42,10 +42,11 @@ #include "cardMaker.h" #include "orthographicLens.h" +BEGIN_VISP_NAMESPACE + class vpRGBf; template class vpImage; -BEGIN_VISP_NAMESPACE /** * \ingroup group_ar_renderer_panda3d_filters * \brief Base class for postprocessing filters that map the result of a vpPanda3DBaseRenderer to a new image. diff --git a/modules/ar/src/panda3d-simulator/vpPanda3DRendererSet.cpp b/modules/ar/src/panda3d-simulator/vpPanda3DRendererSet.cpp index a9730e0f90..576c9bf5f3 100644 --- a/modules/ar/src/panda3d-simulator/vpPanda3DRendererSet.cpp +++ b/modules/ar/src/panda3d-simulator/vpPanda3DRendererSet.cpp @@ -194,6 +194,8 @@ void vpPanda3DRendererSet::enableSharedDepthBuffer(vpPanda3DBaseRenderer &source } } +END_VISP_NAMESPACE + #elif !defined(VISP_BUILD_SHARED_LIBS) // Work around to avoid warning: libvisp_ar.a(vpPanda3DRendererSet.cpp.o) has no symbols void dummy_vpPanda3DRendererSet() { }; diff --git a/modules/core/include/visp3/core/vpCannyEdgeDetection.h b/modules/core/include/visp3/core/vpCannyEdgeDetection.h index 3505f09cc8..f168892403 100644 --- a/modules/core/include/visp3/core/vpCannyEdgeDetection.h +++ b/modules/core/include/visp3/core/vpCannyEdgeDetection.h @@ -51,7 +51,6 @@ #include #include -class vpRGBa; #ifdef HAVE_OPENCV_CORE namespace cv { class Mat; } #endif @@ -62,6 +61,9 @@ namespace cv { class Mat; } #endif BEGIN_VISP_NAMESPACE + +class vpRGBa; + /** * \brief Class that implements the Canny's edge detector. * It is possible to use a boolean mask to ignore some pixels of diff --git a/modules/core/include/visp3/core/vpColormap.h b/modules/core/include/visp3/core/vpColormap.h index 226ab2609f..6d08d45c71 100644 --- a/modules/core/include/visp3/core/vpColormap.h +++ b/modules/core/include/visp3/core/vpColormap.h @@ -38,16 +38,17 @@ * \brief Colormap tool to have a mapping between 256 values and RGB values. */ -#ifndef _vpColormap_h_ -#define _vpColormap_h_ +#ifndef VP_COLORMAP_H +#define VP_COLORMAP_H #include +BEGIN_VISP_NAMESPACE + class vpRGBa; class vpRGBf; template class vpImage; -BEGIN_VISP_NAMESPACE /*! * \class vpColormap * diff --git a/modules/core/include/visp3/core/vpFont.h b/modules/core/include/visp3/core/vpFont.h index e88ec2723a..56ee33c8d9 100644 --- a/modules/core/include/visp3/core/vpFont.h +++ b/modules/core/include/visp3/core/vpFont.h @@ -45,11 +45,12 @@ #include #include +BEGIN_VISP_NAMESPACE + class vpColor; class vpRGBa; template class vpImage; -BEGIN_VISP_NAMESPACE /*! \class vpFont diff --git a/modules/core/include/visp3/core/vpFrameGrabber.h b/modules/core/include/visp3/core/vpFrameGrabber.h index f3f43884d9..c579c6c8d8 100644 --- a/modules/core/include/visp3/core/vpFrameGrabber.h +++ b/modules/core/include/visp3/core/vpFrameGrabber.h @@ -42,10 +42,11 @@ #include +BEGIN_VISP_NAMESPACE + class vpRGBa; template class vpImage; -BEGIN_VISP_NAMESPACE /*! * \class vpFrameGrabber * diff --git a/modules/core/include/visp3/core/vpImageCircle.h b/modules/core/include/visp3/core/vpImageCircle.h index d3af3a270e..f1f52f723c 100644 --- a/modules/core/include/visp3/core/vpImageCircle.h +++ b/modules/core/include/visp3/core/vpImageCircle.h @@ -47,9 +47,10 @@ #include // for Vec3f #endif +BEGIN_VISP_NAMESPACE + template class vpImage; -BEGIN_VISP_NAMESPACE /** * \brief Class that defines a 2D circle in an image. */ diff --git a/modules/core/include/visp3/core/vpMomentArea.h b/modules/core/include/visp3/core/vpMomentArea.h index 556d65d419..c66f98c22e 100644 --- a/modules/core/include/visp3/core/vpMomentArea.h +++ b/modules/core/include/visp3/core/vpMomentArea.h @@ -30,15 +30,14 @@ * Description: * Just the area m00 = mu00 */ -#ifndef _vpMomentArea_h_ -#define _vpMomentArea_h_ +#ifndef VP_MOMENT_AREA_H +#define VP_MOMENT_AREA_H #include #include BEGIN_VISP_NAMESPACE class vpMomentObject; -class vpMomentCentered; // Required for discrete case of vpMomentObject /*! * \class vpMomentArea diff --git a/modules/core/include/visp3/core/vpMomentCentered.h b/modules/core/include/visp3/core/vpMomentCentered.h index 579799dafb..c0f6232535 100644 --- a/modules/core/include/visp3/core/vpMomentCentered.h +++ b/modules/core/include/visp3/core/vpMomentCentered.h @@ -36,8 +36,8 @@ \brief Centered moment descriptor (also referred as \f$\mu_{ij}\f$). */ -#ifndef _vpMomentCentered_h_ -#define _vpMomentCentered_h_ +#ifndef VP_MOMENT_CENTERED_H +#define VP_MOMENT_CENTERED_H #include #include @@ -97,22 +97,22 @@ class VISP_EXPORT vpMomentCentered : public vpMoment /*! Returns all centered moment values \f$\mu_{ij}\f$ with \f$i+j \leq order\f$ -where order is the object's order. + where order is the object's order. \return Vector of moment values. To access \f$\mu_{ij}\f$, you have to read -vpMomentObject::get()[j*order+i]. + vpMomentObject::get()[j*order+i]. For example, if the maximal order is 3, the following values are provided: \code -u00 u10 u20 u01 u11 u21 u02 u12 u12 u30 u03 + u00 u10 u20 u01 u11 u21 u02 u12 u12 u30 u03 \endcode To have a better reading of the moments you can picture them as a triangular matrix: \code -u00 u10 u20 u30 u01 u11 u21 x u02 u12 x x u30 x x x + u00 u10 u20 u30 u01 u11 u21 x u02 u12 x x u30 x x x \endcode The moments of the same order are on each of the matrix reverse diagonals. @@ -120,12 +120,12 @@ u00 u10 u20 u30 u01 u11 u21 x u02 u12 x x u30 x x x this kind of code: \code -vpMomentCentered mc; -//[...] -mc.compute(); -double mu12; -mu12 = mc.get()[2*(obj.getOrder()+1)+1]; // i=1 and j=2 -mu12 = mc.get(1,2); // the same + vpMomentCentered mc; + //[...] + mc.compute(); + double mu12; + mu12 = mc.get()[2*(obj.getOrder()+1)+1]; // i=1 and j=2 + mu12 = mc.get(1,2); // the same \endcode */ inline const std::vector &vpMomentCentered::get() const { return vpMoment::get(); } diff --git a/modules/core/include/visp3/core/vpUnscentedKalman.h b/modules/core/include/visp3/core/vpUnscentedKalman.h index 37e5176963..466983b22f 100644 --- a/modules/core/include/visp3/core/vpUnscentedKalman.h +++ b/modules/core/include/visp3/core/vpUnscentedKalman.h @@ -47,9 +47,10 @@ #include // for vpMatrix #include // for vpException +BEGIN_VISP_NAMESPACE + class vpUKSigmaDrawerAbstract; -BEGIN_VISP_NAMESPACE /*! \class vpUnscentedKalman \ingroup group_core_kalman diff --git a/modules/core/src/display/vpDisplay.cpp b/modules/core/src/display/vpDisplay.cpp index b8f17c28b7..f9e89f09c9 100644 --- a/modules/core/src/display/vpDisplay.cpp +++ b/modules/core/src/display/vpDisplay.cpp @@ -46,9 +46,10 @@ #include // for vpImageConvert #include // for vpImage::operator= +BEGIN_VISP_NAMESPACE + class vpRGBa; -BEGIN_VISP_NAMESPACE /*! Default constructor. */ diff --git a/modules/core/src/display/vpDisplay_rgba.cpp b/modules/core/src/display/vpDisplay_rgba.cpp index b70b5084a5..b123e6dbad 100644 --- a/modules/core/src/display/vpDisplay_rgba.cpp +++ b/modules/core/src/display/vpDisplay_rgba.cpp @@ -44,14 +44,6 @@ #include #include -class vpCameraParameters; -class vpColor; -class vpHomogeneousMatrix; -class vpPolygon; -class vpRGBa; -class vpRect; - - #include "vpDisplay_impl.h" //************************************************************************ @@ -59,6 +51,14 @@ class vpRect; // files that implement other types (unsigned char, vpRGB, vpRGBa) //************************************************************************ BEGIN_VISP_NAMESPACE + +class vpCameraParameters; +class vpColor; +class vpHomogeneousMatrix; +class vpPolygon; +class vpRGBa; +class vpRect; + /*! Close the display attached to I. */ diff --git a/modules/core/src/image/vpCannyEdgeDetection.cpp b/modules/core/src/image/vpCannyEdgeDetection.cpp index 8155819175..850beb516c 100644 --- a/modules/core/src/image/vpCannyEdgeDetection.cpp +++ b/modules/core/src/image/vpCannyEdgeDetection.cpp @@ -66,8 +66,6 @@ namespace cv { class Mat; } #endif #endif -class vpRGBa; - #ifdef VISP_USE_MSVC #pragma comment(linker, "/STACK:65532000") // Increase max recursion depth #endif @@ -95,6 +93,9 @@ static void scaleFilter( #endif BEGIN_VISP_NAMESPACE + +class vpRGBa; + #ifdef VISP_HAVE_NLOHMANN_JSON void from_json(const nlohmann::json &j, vpCannyEdgeDetection &detector) { diff --git a/modules/core/src/tracking/forward-projection/vpCircle.cpp b/modules/core/src/tracking/forward-projection/vpCircle.cpp index 6a386a5853..31789805fc 100644 --- a/modules/core/src/tracking/forward-projection/vpCircle.cpp +++ b/modules/core/src/tracking/forward-projection/vpCircle.cpp @@ -44,11 +44,12 @@ #include // for vpMath #include // for vpColVector +BEGIN_VISP_NAMESPACE + class vpColor; class vpRGBa; template class vpImage; -BEGIN_VISP_NAMESPACE void vpCircle::init() { oP.resize(7); diff --git a/modules/core/src/tracking/forward-projection/vpCylinder.cpp b/modules/core/src/tracking/forward-projection/vpCylinder.cpp index 7151e48f51..f5f82a49d6 100644 --- a/modules/core/src/tracking/forward-projection/vpCylinder.cpp +++ b/modules/core/src/tracking/forward-projection/vpCylinder.cpp @@ -41,12 +41,13 @@ #include // for vpHomogeneousMatrix #include // for vpColVector +BEGIN_VISP_NAMESPACE + class vpCameraParameters; class vpColor; class vpRGBa; template class vpImage; -BEGIN_VISP_NAMESPACE void vpCylinder::init() { oP.resize(7); diff --git a/modules/io/src/image/vpImageIo.cpp b/modules/io/src/image/vpImageIo.cpp index 40ab802b81..a0a17dfdd8 100644 --- a/modules/io/src/image/vpImageIo.cpp +++ b/modules/io/src/image/vpImageIo.cpp @@ -50,10 +50,14 @@ #include // for HAVE_OPENCV_IMGCODECS, HAVE... #endif +BEGIN_VISP_NAMESPACE + class vpRGBa; class vpRGBf; template class vpImage; +END_VISP_NAMESPACE + #ifdef ENABLE_VISP_NAMESPACE using namespace VISP_NAMESPACE_NAME; #endif diff --git a/modules/visual_features/src/visual-feature/vpFeatureMomentAlpha.cpp b/modules/visual_features/src/visual-feature/vpFeatureMomentAlpha.cpp index 311cbd9090..6dcd098872 100644 --- a/modules/visual_features/src/visual-feature/vpFeatureMomentAlpha.cpp +++ b/modules/visual_features/src/visual-feature/vpFeatureMomentAlpha.cpp @@ -38,7 +38,6 @@ #include // for vpMomentCent... #include // for vpMomentGrav... #include // for vpMomentObject -#include // for vpFeatureMom... #include // for vpArray2D #include // for vpColVector #include // for BEGIN_VISP_N... @@ -47,6 +46,12 @@ #include // for vpMoment #include // for vpMomentData... #include // for vpBasicFeature +#include // for vpFeatureMom... + +#ifdef VISP_MOMENTS_COMBINE_MATRICES +#include // for vpFeatureMom... +#include // for vpFeatureMom... +#endif BEGIN_VISP_NAMESPACE #ifdef VISP_MOMENTS_COMBINE_MATRICES diff --git a/modules/visual_features/src/visual-feature/vpFeatureMomentCentered.cpp b/modules/visual_features/src/visual-feature/vpFeatureMomentCentered.cpp index 5136c29cb2..53f87e4895 100644 --- a/modules/visual_features/src/visual-feature/vpFeatureMomentCentered.cpp +++ b/modules/visual_features/src/visual-feature/vpFeatureMomentCentered.cpp @@ -43,6 +43,8 @@ #include // for vpMomentO... #include // for vpFeature... #include // for vpFeature... +#include // for vpFeature... +#include // for vpFeature... #include // for vpArray2D #include // for vpException #include // for vpMath