diff --git a/CMakeLists.txt b/CMakeLists.txt index 67b4f47663..37e316435c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -539,7 +539,7 @@ VP_OPTION(ENABLE_TEST_WITHOUT_DISPLAY "" "" "Don't use display feature when VP_OPTION(ENABLE_FULL_DOC "" "" "Build doc with internal classes that are by default not part of the doc" "" OFF) # Allow introduction of "visp" namespace. By default disabled to keep compat with previous versions -VP_OPTION(ENABLE_VISP_NAMESPACE "" "" "Enable visp namespace" "" OFF) +VP_OPTION(ENABLE_VISP_NAMESPACE "" "" "Enable visp namespace" "" ON) # Allow introduction of "explicit" keyword. By default disabled to keep compat with previous versions VP_OPTION(ENABLE_EXPLICIT_KEYWORD "" "" "Enable c++ explicit keyword" "" OFF) # Enable the vpImageTools::warp() methods diff --git a/modules/ar/include/visp3/ar/vpPanda3DFrameworkManager.h b/modules/ar/include/visp3/ar/vpPanda3DFrameworkManager.h index 49f0b6a850..2650e6d8e6 100644 --- a/modules/ar/include/visp3/ar/vpPanda3DFrameworkManager.h +++ b/modules/ar/include/visp3/ar/vpPanda3DFrameworkManager.h @@ -38,9 +38,9 @@ #include #include +BEGIN_VISP_NAMESPACE class vpPanda3DBaseRenderer; -BEGIN_VISP_NAMESPACE /** * \ingroup group_ar_renderer_panda3d * diff --git a/modules/core/include/visp3/core/vpImageTools.h b/modules/core/include/visp3/core/vpImageTools.h index 814ebbccf1..3188fef91a 100644 --- a/modules/core/include/visp3/core/vpImageTools.h +++ b/modules/core/include/visp3/core/vpImageTools.h @@ -1528,9 +1528,10 @@ inline void vpImageTools::resize(const vpImage &I, vpImage &Ires } #endif +END_VISP_NAMESPACE + #ifdef ENABLE_IMAGE_TOOLS_WARP #include #endif -END_VISP_NAMESPACE #endif diff --git a/modules/core/include/visp3/core/vpImageTools_warp.h b/modules/core/include/visp3/core/vpImageTools_warp.h index b6826a32b5..710e72251e 100644 --- a/modules/core/include/visp3/core/vpImageTools_warp.h +++ b/modules/core/include/visp3/core/vpImageTools_warp.h @@ -37,6 +37,7 @@ // Warning: this file shouldn't be included by the user. Internal usage only to reduce length of vpImage.h #include +BEGIN_VISP_NAMESPACE /*! Apply a warping (affine or perspective) transformation to an image. @@ -730,5 +731,6 @@ inline void vpImageTools::warpLinear(const vpImage &src, const vpMatrix } } } +END_VISP_NAMESPACE #endif diff --git a/modules/core/include/visp3/core/vpMunkres.h b/modules/core/include/visp3/core/vpMunkres.h index fb38a33fe6..882f12b106 100644 --- a/modules/core/include/visp3/core/vpMunkres.h +++ b/modules/core/include/visp3/core/vpMunkres.h @@ -69,8 +69,9 @@ class VISP_EXPORT vpMunkres static std::vector > run(std::vector > costs); private: - enum ZERO_T : unsigned int; - enum STEP_T : unsigned int; + enum ZERO_T : unsigned int { NA = 0, STARRED = 1, PRIMED = 2 }; + + enum STEP_T : unsigned int { ENTRY = 0, ONE = 1, TWO = 2, THREE = 3, FOUR = 4, FIVE = 5, SIX = 6, DONE }; // Init template static void padCostMatrix(std::vector > &costs); @@ -116,10 +117,6 @@ class VISP_EXPORT vpMunkres static constexpr auto ZeroEpsilon { 1e-6 }; }; -enum vpMunkres::ZERO_T : unsigned int { NA = 0, STARRED = 1, PRIMED = 2 }; - -enum vpMunkres::STEP_T : unsigned int { ENTRY = 0, ONE = 1, TWO = 2, THREE = 3, FOUR = 4, FIVE = 5, SIX = 6, DONE }; - /*! * Ensure that the cost matrix is square by the addition of dummy rows/columns. * diff --git a/modules/gui/include/visp3/gui/vpD3DRenderer.h b/modules/gui/include/visp3/gui/vpD3DRenderer.h index 47417ea3d5..7d5154d296 100644 --- a/modules/gui/include/visp3/gui/vpD3DRenderer.h +++ b/modules/gui/include/visp3/gui/vpD3DRenderer.h @@ -204,9 +204,9 @@ class VISP_EXPORT vpD3DRenderer : public vpWin32Renderer unsigned int supPowerOf2(unsigned int n); }; +END_VISP_NAMESPACE #endif -END_VISP_NAMESPACE #endif #endif diff --git a/modules/python/bindings/include/blob.hpp b/modules/python/bindings/include/blob.hpp index 99b7d50039..9d51a4233d 100644 --- a/modules/python/bindings/include/blob.hpp +++ b/modules/python/bindings/include/blob.hpp @@ -43,8 +43,12 @@ namespace py = pybind11; -void bindings_vpDot2(py::class_, vpTracker> &pyDot2) +void bindings_vpDot2(py::class_, VISP_NAMESPACE_ADDRESSING vpTracker> &pyDot2) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif + pyDot2.def_static("defineDots", [](std::vector &dots, const std::string &dotFile, vpImage &I, diff --git a/modules/python/bindings/include/core/arrays.hpp b/modules/python/bindings/include/core/arrays.hpp index 33f7559ad6..398e28ac24 100644 --- a/modules/python/bindings/include/core/arrays.hpp +++ b/modules/python/bindings/include/core/arrays.hpp @@ -55,50 +55,50 @@ template py::buffer_info get_buffer_info(T &) = delete; template class Array, - typename std::enable_if, Array>::value, bool>::type = true> + typename std::enable_if, Array>::value, bool>::type = true> py::buffer_info get_buffer_info(Array &array) { return make_array_buffer(array.data, { array.getRows(), array.getCols() }, false); } template<> -py::buffer_info get_buffer_info(vpMatrix &array) +py::buffer_info get_buffer_info(VISP_NAMESPACE_ADDRESSING vpMatrix &array) { return make_array_buffer(array.data, { array.getRows(), array.getCols() }, false); } template<> -py::buffer_info get_buffer_info(vpColVector &array) +py::buffer_info get_buffer_info(VISP_NAMESPACE_ADDRESSING vpColVector &array) { return make_array_buffer(array.data, { array.getRows() }, false); } template<> -py::buffer_info get_buffer_info(vpRowVector &array) +py::buffer_info get_buffer_info(VISP_NAMESPACE_ADDRESSING vpRowVector &array) { return make_array_buffer(array.data, { array.getCols() }, false); } template<> -py::buffer_info get_buffer_info(vpTranslationVector &array) +py::buffer_info get_buffer_info(VISP_NAMESPACE_ADDRESSING vpTranslationVector &array) { return make_array_buffer(array.data, { 3 }, false); } template<> -py::buffer_info get_buffer_info(vpPoseVector &array) +py::buffer_info get_buffer_info(VISP_NAMESPACE_ADDRESSING vpPoseVector &array) { return make_array_buffer(array.data, { 6 }, false); } template<> -py::buffer_info get_buffer_info(vpRotationVector &array) +py::buffer_info get_buffer_info(VISP_NAMESPACE_ADDRESSING vpRotationVector &array) { return make_array_buffer(array.data, { array.getRows() }, false); } template<> -py::buffer_info get_buffer_info(vpRotationMatrix &array) +py::buffer_info get_buffer_info(VISP_NAMESPACE_ADDRESSING vpRotationMatrix &array) { return make_array_buffer(array.data, { array.getRows(), array.getCols() }, true); } template<> -py::buffer_info get_buffer_info(vpHomogeneousMatrix &array) +py::buffer_info get_buffer_info(VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix &array) { return make_array_buffer(array.data, { array.getRows(), array.getCols() }, true); } @@ -419,8 +419,11 @@ const char *numpy_fn_doc_nonwritable = R"doc( )doc"; template -void bindings_vpArray2D(py::class_, std::shared_ptr>> &pyArray2D) +void bindings_vpArray2D(py::class_, std::shared_ptr>> &pyArray2D) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif pyArray2D.def_buffer(&get_buffer_info); pyArray2D.def("numpy", [](vpArray2D &self) -> np_array_cf { @@ -453,14 +456,17 @@ It cannot be resized. )doc", py::arg("np_array"), py::keep_alive<0, 1>()); - define_get_item_2d_array, std::shared_ptr>>, vpArray2D, T>(pyArray2D); - define_set_item_2d_array, std::shared_ptr>>, vpArray2D, T>(pyArray2D); + define_get_item_2d_array, std::shared_ptr< vpArray2D>>, vpArray2D, T>(pyArray2D); + define_set_item_2d_array, std::shared_ptr< vpArray2D>>, vpArray2D, T>(pyArray2D); } -void bindings_vpMatrix(py::class_, vpArray2D> &pyMatrix) +void bindings_vpMatrix(py::class_, VISP_NAMESPACE_ADDRESSING vpArray2D> &pyMatrix) { - pyMatrix.def_buffer(&get_buffer_info); +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif + pyMatrix.def_buffer(&get_buffer_info< vpMatrix>); pyMatrix.def("numpy", [](vpMatrix &self) -> np_array_cf { return py::cast(self).cast>(); @@ -497,15 +503,17 @@ It cannot be resized. add_print_helper(pyMatrix, &vpMatrix::matlabPrint, "strMatlab", matlab_str_help); add_cpp_print_helper(pyMatrix, &vpMatrix::cppPrint); - define_get_item_2d_array, vpArray2D>, vpMatrix, double>(pyMatrix); - define_set_item_2d_array, vpArray2D>, vpMatrix, double>(pyMatrix); + define_get_item_2d_array, vpArray2D>, vpMatrix, double>(pyMatrix); + define_set_item_2d_array, vpArray2D>, vpMatrix, double>(pyMatrix); } -void bindings_vpRotationMatrix(py::class_, vpArray2D> &pyRotationMatrix) +void bindings_vpRotationMatrix(py::class_, VISP_NAMESPACE_ADDRESSING vpArray2D> &pyRotationMatrix) { - - pyRotationMatrix.def_buffer(&get_buffer_info); +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif + pyRotationMatrix.def_buffer(&get_buffer_info< vpRotationMatrix>); pyRotationMatrix.def("numpy", [](vpRotationMatrix &self) -> np_array_cf { return py::cast(self).cast>(); }, numpy_fn_doc_nonwritable, py::keep_alive<0, 1>()); @@ -531,12 +539,15 @@ If it is not a rotation matrix, an exception will be raised. :param np_array: The numpy 1D array to copy. )doc", py::arg("np_array")); - define_get_item_2d_array, vpArray2D>, vpRotationMatrix, double>(pyRotationMatrix); + define_get_item_2d_array, vpArray2D>, vpRotationMatrix, double>(pyRotationMatrix); } -void bindings_vpHomogeneousMatrix(py::class_, vpArray2D> &pyHomogeneousMatrix) +void bindings_vpHomogeneousMatrix(py::class_, VISP_NAMESPACE_ADDRESSING vpArray2D> &pyHomogeneousMatrix) { - pyHomogeneousMatrix.def_buffer(get_buffer_info); +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif + pyHomogeneousMatrix.def_buffer(get_buffer_info< vpHomogeneousMatrix>); pyHomogeneousMatrix.def("numpy", [](vpHomogeneousMatrix &self) -> np_array_cf { return py::cast(self).cast>(); }, numpy_fn_doc_nonwritable, py::keep_alive<0, 1>()); @@ -563,14 +574,17 @@ If it is not a homogeneous matrix, an exception will be raised. :param np_array: The numpy 1D array to copy. )doc", py::arg("np_array")); - define_get_item_2d_array, vpArray2D>, vpHomogeneousMatrix, double>(pyHomogeneousMatrix); + define_get_item_2d_array, vpArray2D>, vpHomogeneousMatrix, double>(pyHomogeneousMatrix); } -void bindings_vpTranslationVector(py::class_, vpArray2D> &pyTranslationVector) +void bindings_vpTranslationVector(py::class_, VISP_NAMESPACE_ADDRESSING vpArray2D> &pyTranslationVector) { - pyTranslationVector.def_buffer(&get_buffer_info); +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif + pyTranslationVector.def_buffer(&get_buffer_info< vpTranslationVector>); pyTranslationVector.def("numpy", [](vpTranslationVector &self) -> np_array_cf { return py::cast(self).cast>(); @@ -589,14 +603,17 @@ Construct a Translation vector by **copying** a 1D numpy array of size 3. :param np_array: The numpy 1D array to copy. )doc", py::arg("np_array")); - define_get_item_1d_array, vpArray2D>, vpTranslationVector, double>(pyTranslationVector); - define_set_item_1d_array, vpArray2D>, vpTranslationVector, double>(pyTranslationVector); + define_get_item_1d_array, vpArray2D>, vpTranslationVector, double>(pyTranslationVector); + define_set_item_1d_array, vpArray2D>, vpTranslationVector, double>(pyTranslationVector); } -void bindings_vpColVector(py::class_, vpArray2D> &pyColVector) +void bindings_vpColVector(py::class_, VISP_NAMESPACE_ADDRESSING vpArray2D> &pyColVector) { - pyColVector.def_buffer(&get_buffer_info); +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif + pyColVector.def_buffer(&get_buffer_info< vpColVector>); pyColVector.def("numpy", [](vpColVector &self) -> np_array_cf { return py::cast(self).cast>(); @@ -628,8 +645,8 @@ It cannot be resized. )doc", py::arg("np_array"), py::keep_alive<0, 1>()); - define_get_item_1d_array, vpArray2D>, vpColVector, double>(pyColVector); - define_set_item_1d_array, vpArray2D>, vpColVector, double>(pyColVector); + define_get_item_1d_array, vpArray2D>, vpColVector, double>(pyColVector); + define_set_item_1d_array, vpArray2D>, vpColVector, double>(pyColVector); add_print_helper(pyColVector, &vpColVector::csvPrint, "strCsv", csv_str_help); add_print_helper(pyColVector, &vpColVector::maplePrint, "strMaple", maple_str_help); @@ -638,11 +655,14 @@ It cannot be resized. } -void bindings_vpRowVector(py::class_, vpArray2D> &pyRowVector) +void bindings_vpRowVector(py::class_, VISP_NAMESPACE_ADDRESSING vpArray2D> &pyRowVector) { - pyRowVector.def_buffer(&get_buffer_info); +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif + pyRowVector.def_buffer(&get_buffer_info< vpRowVector>); pyRowVector.def("numpy", [](vpRowVector &self) -> np_array_cf { - return np_array_cf(get_buffer_info(self), py::cast(self)); + return np_array_cf(get_buffer_info< vpRowVector>(self), py::cast(self)); }, numpy_fn_doc_writable, py::keep_alive<0, 1>()); pyRowVector.def(py::init([](np_array_cf np_array) { verify_array_shape_and_dims(np_array, 1, "ViSP row vector"); @@ -670,8 +690,8 @@ It cannot be resized. )doc", py::arg("np_array"), py::keep_alive<0, 1>()); - define_get_item_1d_array, vpArray2D>, vpRowVector, double>(pyRowVector); - define_set_item_1d_array, vpArray2D>, vpRowVector, double>(pyRowVector); + define_get_item_1d_array, vpArray2D>, vpRowVector, double>(pyRowVector); + define_set_item_1d_array, vpArray2D>, vpRowVector, double>(pyRowVector); add_print_helper(pyRowVector, &vpRowVector::csvPrint, "strCsv", csv_str_help); add_print_helper(pyRowVector, &vpRowVector::maplePrint, "strMaple", maple_str_help); @@ -679,9 +699,12 @@ It cannot be resized. add_cpp_print_helper(pyRowVector, &vpRowVector::cppPrint); } -void bindings_vpPoseVector(py::class_, vpArray2D> &pyPoseVector) +void bindings_vpPoseVector(py::class_, VISP_NAMESPACE_ADDRESSING vpArray2D> &pyPoseVector) { - pyPoseVector.def_buffer(&get_buffer_info); +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif + pyPoseVector.def_buffer(&get_buffer_info< vpPoseVector>); pyPoseVector.def("numpy", [](vpPoseVector &self) -> np_array_cf { return py::cast(self).cast>(); @@ -699,12 +722,16 @@ Construct a pose vector by **copying** a 1D numpy array. :param np_array: The numpy 1D array to copy. )doc", py::arg("np_array")); - define_get_item_1d_array, vpArray2D>, vpPoseVector, double>(pyPoseVector); - define_set_item_1d_array, vpArray2D>, vpPoseVector, double>(pyPoseVector); + define_get_item_1d_array, vpArray2D>, vpPoseVector, double>(pyPoseVector); + define_set_item_1d_array, vpArray2D>, vpPoseVector, double>(pyPoseVector); } -void bindings_vpRotationVector(py::class_, vpArray2D> &pyRotationVector) +void bindings_vpRotationVector(py::class_, VISP_NAMESPACE_ADDRESSING vpArray2D> &pyRotationVector) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif + pyRotationVector.def_buffer(&get_buffer_info); pyRotationVector.def("numpy", [](vpRotationVector &self) -> np_array_cf { @@ -723,8 +750,8 @@ Construct a rotaiton vector by **copying** a 1D numpy array. :param np_array: The numpy 1D array to copy. )doc", py::arg("np_array")); - define_get_item_1d_array, vpArray2D>, vpPoseVector, double>(pyRotationVector); - define_set_item_1d_array, vpArray2D>, vpPoseVector, double>(pyRotationVector); + define_get_item_1d_array, vpArray2D>, vpPoseVector, double>(pyRotationVector); + define_set_item_1d_array, vpArray2D>, vpPoseVector, double>(pyRotationVector); } diff --git a/modules/python/bindings/include/core/display.hpp b/modules/python/bindings/include/core/display.hpp index c5ab28a751..71b55800fe 100644 --- a/modules/python/bindings/include/core/display.hpp +++ b/modules/python/bindings/include/core/display.hpp @@ -43,9 +43,11 @@ namespace py = pybind11; -void bindings_vpDisplay(py::class_> &pyDisplay) +void bindings_vpDisplay(py::class_> &pyDisplay) { - +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif pyDisplay.def_static("displayCrosses", [](const vpImage &I, const py::array_t &is, diff --git a/modules/python/bindings/include/core/image_conversions.hpp b/modules/python/bindings/include/core/image_conversions.hpp index 3cc971490f..423d9c80d3 100644 --- a/modules/python/bindings/include/core/image_conversions.hpp +++ b/modules/python/bindings/include/core/image_conversions.hpp @@ -116,7 +116,7 @@ struct SimpleConversionStruct unsigned int srcBytesPerPixel; unsigned int destBytesPerPixel; - void add_conversion_binding(py::class_> &pyImageConvert) + void add_conversion_binding(py::class_> &pyImageConvert) { pyImageConvert.def_static(name.c_str(), [*this](py::array_t &src, @@ -142,7 +142,7 @@ struct SimpleConversionStruct unsigned int srcBytesPerPixel; unsigned int destBytesPerPixel; - void add_conversion_binding(py::class_> &pyImageConvert) + void add_conversion_binding(py::class_> &pyImageConvert) { pyImageConvert.def_static(name.c_str(), [*this](py::array_t &src, py::array_t &dest, bool flip) { @@ -167,7 +167,7 @@ struct SimpleConversionStruct unsigned int srcBytesPerPixel; unsigned int destBytesPerPixel; - void add_conversion_binding(py::class_> &pyImageConvert) + void add_conversion_binding(py::class_> &pyImageConvert) { pyImageConvert.def_static(name.c_str(), [*this](py::array_t &src, py::array_t &dest, bool flip, unsigned int threads) { @@ -192,7 +192,7 @@ struct SimpleConversionStruct unsigned int srcBytesPerPixel; unsigned int destBytesPerPixel; - void add_conversion_binding(py::class_> &pyImageConvert) + void add_conversion_binding(py::class_> &pyImageConvert) { pyImageConvert.def_static(name.c_str(), [*this](py::array_t &src, py::array_t &dest, unsigned int threads) { @@ -218,7 +218,7 @@ struct ConversionFromYUVLike unsigned int destBytesPerPixel; - void add_conversion_binding(py::class_> &pyImageConvert) + void add_conversion_binding(py::class_> &pyImageConvert) { pyImageConvert.def_static(name.c_str(), [this](py::array_t &src, py::array_t &dest) { @@ -294,7 +294,7 @@ void rgb_or_rgba_to_hsv_verification(const py::buffer_info &bufsrc, const py::bu } } -void add_hsv_double_to_rgb_or_rgba_binding(py::class_> &pyImageConvert, +void add_hsv_double_to_rgb_or_rgba_binding(py::class_> &pyImageConvert, void (*fn)(const double *, const double *, const double *, unsigned char *, unsigned int), const char *name, const unsigned destBytes) { pyImageConvert.def_static(name, [fn, destBytes](py::array_t &src, @@ -313,7 +313,7 @@ void add_hsv_double_to_rgb_or_rgba_binding(py::class_> &pyImageConvert, +void add_hsv_uchar_to_rgb_or_rgba_binding(py::class_> &pyImageConvert, void (*fn)(const unsigned char *, const unsigned char *, const unsigned char *, unsigned char *, unsigned int, bool), const char *name, const unsigned destBytes) { pyImageConvert.def_static(name, [fn, destBytes](py::array_t &src, @@ -332,7 +332,7 @@ void add_hsv_uchar_to_rgb_or_rgba_binding(py::class_> &pyImageConvert, +void add_rgb_or_rgba_uchar_to_hsv_binding(py::class_> &pyImageConvert, void (*fn)(const unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned int, bool), const char *name, const unsigned destBytes) { pyImageConvert.def_static(name, [fn, destBytes](py::array_t &src, @@ -352,7 +352,7 @@ void add_rgb_or_rgba_uchar_to_hsv_binding(py::class_> &pyImageConvert, +void add_rgb_or_rgba_double_to_hsv_binding(py::class_> &pyImageConvert, void (*fn)(const unsigned char *, double *, double *, double *, unsigned int), const char *name, const unsigned destBytes) { pyImageConvert.def_static(name, [fn, destBytes](py::array_t &src, @@ -373,7 +373,7 @@ void add_rgb_or_rgba_double_to_hsv_binding(py::class_ -void add_demosaic_to_rgba_fn(py::class_> &pyImageConvert, void (*fn)(const DataType *, DataType *, unsigned int, unsigned int, unsigned int), const char *name) +void add_demosaic_to_rgba_fn(py::class_> &pyImageConvert, void (*fn)(const DataType *, DataType *, unsigned int, unsigned int, unsigned int), const char *name) { pyImageConvert.def_static(name, [fn](py::array_t &src, py::array_t &dest, @@ -407,8 +407,11 @@ void add_demosaic_to_rgba_fn(py::class_> &pyImageConvert) +void bindings_vpImageConvert(py::class_> &pyImageConvert) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif // Simple conversions where the size input is a single argument { std::vector> conversions = { diff --git a/modules/python/bindings/include/core/images.hpp b/modules/python/bindings/include/core/images.hpp index 7c2606a4af..e834981514 100644 --- a/modules/python/bindings/include/core/images.hpp +++ b/modules/python/bindings/include/core/images.hpp @@ -53,8 +53,12 @@ const char *numpy_fn_doc_image = R"doc( * Image 2D indexing */ template -void define_get_item_2d_image(py::class_, std::shared_ptr>> &pyClass) +void define_get_item_2d_image(py::class_, std::shared_ptr>> &pyClass) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif + pyClass.def("__getitem__", [](const vpImage &self, std::pair pair) -> T { int i = pair.first, j = pair.second; const int rows = (int)self.getRows(), cols = (int)self.getCols(); @@ -97,8 +101,11 @@ void define_get_item_2d_image(py::class_, std::shared_ptr> * Image 2D indexing */ template -void define_set_item_2d_image(py::class_, std::shared_ptr>> &pyClass, unsigned int componentsPerPixel) +void define_set_item_2d_image(py::class_, std::shared_ptr>> &pyClass, unsigned int componentsPerPixel) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif pyClass.def("__setitem__", [](vpImage &self, std::pair pair, const T &value) { int i = pair.first, j = pair.second; const int rows = (int)self.getRows(), cols = (int)self.getCols(); @@ -260,8 +267,11 @@ void define_set_item_2d_image(py::class_, std::shared_ptr> */ template typename std::enable_if::value, void>::type -bindings_vpImage(py::class_, std::shared_ptr>> &pyImage) +bindings_vpImage(py::class_, std::shared_ptr>> &pyImage) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif pyImage.def_buffer([](vpImage &image) -> py::buffer_info { return make_array_buffer(image.bitmap, { image.getHeight(), image.getWidth() }, false); }); @@ -300,9 +310,12 @@ Construct an image by **copying** a 2D numpy array. } template -typename std::enable_if::value, void>::type -bindings_vpImage(py::class_, std::shared_ptr>> &pyImage) +typename std::enable_if::value, void>::type +bindings_vpImage(py::class_, std::shared_ptr>> &pyImage) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif using NpRep = unsigned char; static_assert(sizeof(T) == 4 * sizeof(NpRep)); pyImage.def_buffer([](vpImage &image) -> py::buffer_info { @@ -346,9 +359,12 @@ where the 4 denotes the red, green, blue and alpha components of the image. } template -typename std::enable_if::value, void>::type -bindings_vpImage(py::class_, std::shared_ptr>> &pyImage) +typename std::enable_if::value, void>::type +bindings_vpImage(py::class_, std::shared_ptr>> &pyImage) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif using NpRep = float; static_assert(sizeof(T) == 3 * sizeof(NpRep)); pyImage.def_buffer([](vpImage &image) -> py::buffer_info { diff --git a/modules/python/bindings/include/core/pixel_meter.hpp b/modules/python/bindings/include/core/pixel_meter.hpp index 9d3bfb0c67..ee389c6546 100644 --- a/modules/python/bindings/include/core/pixel_meter.hpp +++ b/modules/python/bindings/include/core/pixel_meter.hpp @@ -44,8 +44,11 @@ #include "core/utils.hpp" -void bindings_vpPixelMeterConversion(py::class_> &pyPM) +void bindings_vpPixelMeterConversion(py::class_> &pyPM) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif pyPM.def_static("convertPoints", [](const vpCameraParameters &cam, const py::array_t &us, const py::array_t &vs) { py::buffer_info bufu = us.request(), bufv = vs.request(); if (bufu.ndim != bufv.ndim || bufu.shape != bufv.shape) { @@ -107,8 +110,11 @@ Example usage: )doc", py::arg("cam"), py::arg("us"), py::arg("vs")); } -void bindings_vpMeterPixelConversion(py::class_> &pyMP) +void bindings_vpMeterPixelConversion(py::class_> &pyMP) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif pyMP.def_static("convertPoints", [](const vpCameraParameters &cam, const py::array_t &xs, const py::array_t &ys) { py::buffer_info bufx = xs.request(), bufy = ys.request(); if (bufx.ndim != bufy.ndim || bufx.shape != bufy.shape) { diff --git a/modules/python/bindings/include/detection.hpp b/modules/python/bindings/include/detection.hpp index 92719c0651..56cb7b44a3 100644 --- a/modules/python/bindings/include/detection.hpp +++ b/modules/python/bindings/include/detection.hpp @@ -48,8 +48,12 @@ namespace py = pybind11; -void bindings_vpDetectorAprilTag(py::class_, vpDetectorBase> &pyAprilTag) +void bindings_vpDetectorAprilTag(py::class_, VISP_NAMESPACE_ADDRESSING vpDetectorBase> &pyAprilTag) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif + pyAprilTag.def("detect", [](vpDetectorAprilTag &self, const vpImage &I, double tagSize, const vpCameraParameters &cam) -> std::tuple> { std::vector cMos; diff --git a/modules/python/bindings/include/mbt.hpp b/modules/python/bindings/include/mbt.hpp index 203f53ad11..bb9d9e58ae 100644 --- a/modules/python/bindings/include/mbt.hpp +++ b/modules/python/bindings/include/mbt.hpp @@ -42,8 +42,12 @@ namespace py = pybind11; -void bindings_vpMbGenericTracker(py::class_, vpMbTracker> &pyMbGenericTracker) +void bindings_vpMbGenericTracker(py::class_, VISP_NAMESPACE_ADDRESSING vpMbTracker> &pyMbGenericTracker) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif + pyMbGenericTracker.def("track", [](vpMbGenericTracker &self, std::map *> &mapOfImages, std::map> &mapOfPointClouds) { std::map mapOfWidths, mapOfHeights; diff --git a/modules/python/bindings/include/rbt/drift.hpp b/modules/python/bindings/include/rbt/drift.hpp index c2f67ce692..527394b933 100644 --- a/modules/python/bindings/include/rbt/drift.hpp +++ b/modules/python/bindings/include/rbt/drift.hpp @@ -6,14 +6,14 @@ #include -class TrampolineRBDriftDetector : public vpRBDriftDetector +class TrampolineRBDriftDetector : public VISP_NAMESPACE_ADDRESSING vpRBDriftDetector { public: using vpRBDriftDetector::vpRBDriftDetector; TrampolineRBDriftDetector() : vpRBDriftDetector() { } - virtual void update(const vpRBFeatureTrackerInput &previousFrame, const vpRBFeatureTrackerInput &frame, const vpHomogeneousMatrix &cTo, const vpHomogeneousMatrix &cprevTo) VP_OVERRIDE + virtual void update(const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &previousFrame, const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &frame, const VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix &cTo, const VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix &cprevTo) VP_OVERRIDE { pybind11::gil_scoped_acquire gil; // Acquire the GIL while in this scope. // Try to look up the overridden method on the Python side. @@ -24,7 +24,7 @@ class TrampolineRBDriftDetector : public vpRBDriftDetector } } - virtual double score(const vpRBFeatureTrackerInput &frame, const vpHomogeneousMatrix &cTo) VP_OVERRIDE + virtual double score(const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &frame, const VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix &cTo) VP_OVERRIDE { pybind11::gil_scoped_acquire gil; // Acquire the GIL while in this scope. // Try to look up the overridden method on the Python side. @@ -63,11 +63,11 @@ class TrampolineRBDriftDetector : public vpRBDriftDetector ); } - virtual void display(const vpImage &I) VP_OVERRIDE + virtual void display(const VISP_NAMESPACE_ADDRESSING vpImage &I) VP_OVERRIDE { PYBIND11_OVERRIDE_PURE( void, /* Return type */ - vpRBDriftDetector, /* Parent class */ + VISP_NAMESPACE_ADDRESSING vpRBDriftDetector, /* Parent class */ display, /* Name of function in C++ (must match Python name) */ I ); diff --git a/modules/python/bindings/include/rbt/feature_tracker.hpp b/modules/python/bindings/include/rbt/feature_tracker.hpp index 9b00c66780..4939dec8ae 100644 --- a/modules/python/bindings/include/rbt/feature_tracker.hpp +++ b/modules/python/bindings/include/rbt/feature_tracker.hpp @@ -35,10 +35,10 @@ #include -class TrampolineRBFeatureTracker : public vpRBFeatureTracker +class TrampolineRBFeatureTracker : public VISP_NAMESPACE_ADDRESSING vpRBFeatureTracker { public: - using vpRBFeatureTracker::vpRBFeatureTracker; + using VISP_NAMESPACE_ADDRESSING vpRBFeatureTracker::vpRBFeatureTracker; TrampolineRBFeatureTracker() : vpRBFeatureTracker() { } @@ -69,7 +69,7 @@ class TrampolineRBFeatureTracker : public vpRBFeatureTracker ); } - virtual void onTrackingIterStart(const vpRBFeatureTrackerInput &frame, const vpHomogeneousMatrix &cMo) VP_OVERRIDE + virtual void onTrackingIterStart(const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &frame, const VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix &cMo) VP_OVERRIDE { PYBIND11_OVERRIDE_PURE( void, /* Return type */ @@ -80,7 +80,7 @@ class TrampolineRBFeatureTracker : public vpRBFeatureTracker ); } - virtual void onTrackingIterEnd(const vpHomogeneousMatrix &cMo) VP_OVERRIDE + virtual void onTrackingIterEnd(const VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix &cMo) VP_OVERRIDE { PYBIND11_OVERRIDE_PURE( void, /* Return type */ @@ -90,7 +90,7 @@ class TrampolineRBFeatureTracker : public vpRBFeatureTracker ); } - virtual void extractFeatures(const vpRBFeatureTrackerInput &frame, const vpRBFeatureTrackerInput &previousFrame, const vpHomogeneousMatrix &cMo) + virtual void extractFeatures(const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &frame, const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &previousFrame, const VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix &cMo) VP_OVERRIDE { pybind11::gil_scoped_acquire gil; // Acquire the GIL while in this scope. @@ -102,7 +102,7 @@ class TrampolineRBFeatureTracker : public vpRBFeatureTracker } } - virtual void trackFeatures(const vpRBFeatureTrackerInput &frame, const vpRBFeatureTrackerInput &previousFrame, const vpHomogeneousMatrix &cMo) + virtual void trackFeatures(const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &frame, const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &previousFrame, const VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix &cMo) VP_OVERRIDE { pybind11::gil_scoped_acquire gil; // Acquire the GIL while in this scope. @@ -114,7 +114,7 @@ class TrampolineRBFeatureTracker : public vpRBFeatureTracker } } - virtual void initVVS(const vpRBFeatureTrackerInput &frame, const vpRBFeatureTrackerInput &previousFrame, const vpHomogeneousMatrix &cMo) VP_OVERRIDE + virtual void initVVS(const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &frame, const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &previousFrame, const VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix &cMo) VP_OVERRIDE { pybind11::gil_scoped_acquire gil; // Acquire the GIL while in this scope. // Try to look up the overridden method on the Python side. @@ -125,7 +125,7 @@ class TrampolineRBFeatureTracker : public vpRBFeatureTracker } } - virtual void computeVVSIter(const vpRBFeatureTrackerInput &frame, const vpHomogeneousMatrix &cMo, unsigned int iteration) VP_OVERRIDE + virtual void computeVVSIter(const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &frame, const VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix &cMo, unsigned int iteration) VP_OVERRIDE { pybind11::gil_scoped_acquire gil; // Acquire the GIL while in this scope. // Try to look up the overridden method on the Python side. @@ -145,7 +145,7 @@ class TrampolineRBFeatureTracker : public vpRBFeatureTracker ); } - virtual void display(const vpCameraParameters &cam, const vpImage &I, const vpImage &IRGB, const vpImage &depth) const VP_OVERRIDE + virtual void display(const VISP_NAMESPACE_ADDRESSING vpCameraParameters &cam, const VISP_NAMESPACE_ADDRESSING vpImage &I, const VISP_NAMESPACE_ADDRESSING vpImage &IRGB, const VISP_NAMESPACE_ADDRESSING vpImage &depth) const VP_OVERRIDE { pybind11::gil_scoped_acquire gil; // Acquire the GIL while in this scope. // Try to look up the overridden method on the Python side. @@ -156,10 +156,10 @@ class TrampolineRBFeatureTracker : public vpRBFeatureTracker } } - virtual const vpMatrix getCovariance() const VP_OVERRIDE + virtual const VISP_NAMESPACE_ADDRESSING vpMatrix getCovariance() const VP_OVERRIDE { PYBIND11_OVERRIDE( - vpMatrix, /* Return type */ + VISP_NAMESPACE_ADDRESSING vpMatrix, /* Return type */ vpRBFeatureTracker, /* Parent class */ getCovariance, /* Name of function in C++ (must match Python name) */ @@ -186,19 +186,19 @@ class TrampolineRBFeatureTracker : public vpRBFeatureTracker ); } - virtual vpMatrix getLTL() const VP_OVERRIDE + virtual VISP_NAMESPACE_ADDRESSING vpMatrix getLTL() const VP_OVERRIDE { PYBIND11_OVERRIDE( - vpMatrix, /* Return type */ + VISP_NAMESPACE_ADDRESSING vpMatrix, /* Return type */ vpRBFeatureTracker, /* Parent class */ getLTL, ); } - virtual vpColVector getLTR() const VP_OVERRIDE + virtual VISP_NAMESPACE_ADDRESSING vpColVector getLTR() const VP_OVERRIDE { PYBIND11_OVERRIDE( - vpColVector, /* Return type */ + VISP_NAMESPACE_ADDRESSING vpColVector, /* Return type */ vpRBFeatureTracker, /* Parent class */ getLTR, /* Name of function in C++ (must match Python name) */ ); diff --git a/modules/python/bindings/include/rbt/mask.hpp b/modules/python/bindings/include/rbt/mask.hpp index 6d96faffee..eaec4bfcee 100644 --- a/modules/python/bindings/include/rbt/mask.hpp +++ b/modules/python/bindings/include/rbt/mask.hpp @@ -7,16 +7,16 @@ #include -class TrampolineObjectMask : public vpObjectMask +class TrampolineObjectMask : public VISP_NAMESPACE_ADDRESSING vpObjectMask { public: using vpObjectMask::vpObjectMask; TrampolineObjectMask() : vpObjectMask() { } - virtual void updateMask(const vpRBFeatureTrackerInput &frame, - const vpRBFeatureTrackerInput &previousFrame, - vpImage &mask) VP_OVERRIDE + virtual void updateMask(const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &frame, + const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &previousFrame, + VISP_NAMESPACE_ADDRESSING vpImage &mask) VP_OVERRIDE { pybind11::gil_scoped_acquire gil; // Acquire the GIL while in this scope. // Try to look up the overridden method on the Python side. @@ -26,7 +26,7 @@ class TrampolineObjectMask : public vpObjectMask } } - virtual void display(const vpImage &mask, vpImage &Imask) const VP_OVERRIDE + virtual void display(const VISP_NAMESPACE_ADDRESSING vpImage &mask, VISP_NAMESPACE_ADDRESSING vpImage &Imask) const VP_OVERRIDE { PYBIND11_OVERRIDE( void, /* Return type */ diff --git a/modules/python/bindings/include/rbt/vo.hpp b/modules/python/bindings/include/rbt/vo.hpp index a5c8eceabf..9f30de0c92 100644 --- a/modules/python/bindings/include/rbt/vo.hpp +++ b/modules/python/bindings/include/rbt/vo.hpp @@ -5,14 +5,14 @@ #include #include -class TrampolineRBVisualOdometry : public vpRBVisualOdometry +class TrampolineRBVisualOdometry : public VISP_NAMESPACE_ADDRESSING vpRBVisualOdometry { public: using vpRBVisualOdometry::vpRBVisualOdometry; TrampolineRBVisualOdometry() : vpRBVisualOdometry() { } - virtual void compute(const vpRBFeatureTrackerInput &frame, const vpRBFeatureTrackerInput &previousFrame) VP_OVERRIDE + virtual void compute(const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &frame, const VISP_NAMESPACE_ADDRESSING vpRBFeatureTrackerInput &previousFrame) VP_OVERRIDE { pybind11::gil_scoped_acquire gil; // Acquire the GIL while in this scope. // Try to look up the overridden method on the Python side. @@ -23,20 +23,20 @@ class TrampolineRBVisualOdometry : public vpRBVisualOdometry } } - virtual vpHomogeneousMatrix getCameraMotion() const VP_OVERRIDE + virtual VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix getCameraMotion() const VP_OVERRIDE { PYBIND11_OVERRIDE_PURE( - vpHomogeneousMatrix, /* Return type */ + VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix, /* Return type */ vpRBVisualOdometry, /* Parent class */ getCameraMotion, /* Name of function in C++ (must match Python name) */ ); } - virtual vpHomogeneousMatrix getCameraPose() const VP_OVERRIDE + virtual VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix getCameraPose() const VP_OVERRIDE { PYBIND11_OVERRIDE_PURE( - vpHomogeneousMatrix, /* Return type */ + VISP_NAMESPACE_ADDRESSING vpHomogeneousMatrix, /* Return type */ vpRBVisualOdometry, /* Parent class */ getCameraPose, /* Name of function in C++ (must match Python name) */ diff --git a/modules/python/bindings/include/vision.hpp b/modules/python/bindings/include/vision.hpp index 4485787ee6..825a75497b 100644 --- a/modules/python/bindings/include/vision.hpp +++ b/modules/python/bindings/include/vision.hpp @@ -44,8 +44,12 @@ namespace py = pybind11; -void bindings_vpPose(py::class_> &pyPose) +void bindings_vpPose(py::class_> &pyPose) { +#ifdef ENABLE_VISP_NAMESPACE + using namespace VISP_NAMESPACE_NAME; +#endif + pyPose.def("computePose", [](vpPose &self, vpPose::vpPoseMethodType method, vpHomogeneousMatrix &cMo) -> bool { return self.computePose(method, cMo); diff --git a/modules/python/bindings/include/visual_features.hpp b/modules/python/bindings/include/visual_features.hpp index 019eca8d6a..1ad2665d3c 100644 --- a/modules/python/bindings/include/visual_features.hpp +++ b/modules/python/bindings/include/visual_features.hpp @@ -39,7 +39,7 @@ #include -class TrampolineBasicFeature : public vpBasicFeature +class TrampolineBasicFeature : public VISP_NAMESPACE_ADDRESSING vpBasicFeature { public: using vpBasicFeature::vpBasicFeature; @@ -48,8 +48,8 @@ class TrampolineBasicFeature : public vpBasicFeature TrampolineBasicFeature(const vpBasicFeature &f) : vpBasicFeature(f) { } - virtual void display(const vpCameraParameters &cam, const vpImage &I, - const vpColor &color = vpColor::green, unsigned int thickness = 1) const VP_OVERRIDE + virtual void display(const VISP_NAMESPACE_ADDRESSING vpCameraParameters &cam, const VISP_NAMESPACE_ADDRESSING vpImage &I, + const VISP_NAMESPACE_ADDRESSING vpColor &color = VISP_NAMESPACE_ADDRESSING vpColor::green, unsigned int thickness = 1) const VP_OVERRIDE { PYBIND11_OVERRIDE_PURE( void, /* Return type */ @@ -58,7 +58,7 @@ class TrampolineBasicFeature : public vpBasicFeature cam, I, color, thickness ); } - virtual void display(const vpCameraParameters &cam, const vpImage &I, const vpColor &color = vpColor::green, + virtual void display(const VISP_NAMESPACE_ADDRESSING vpCameraParameters &cam, const VISP_NAMESPACE_ADDRESSING vpImage &I, const VISP_NAMESPACE_ADDRESSING vpColor &color = VISP_NAMESPACE_ADDRESSING vpColor::green, unsigned int thickness = 1) const VP_OVERRIDE { PYBIND11_OVERRIDE_PURE( @@ -78,10 +78,10 @@ class TrampolineBasicFeature : public vpBasicFeature ); } - virtual vpColVector error(const vpBasicFeature &s_star, unsigned int select = FEATURE_ALL) VP_OVERRIDE + virtual VISP_NAMESPACE_ADDRESSING vpColVector error(const vpBasicFeature &s_star, unsigned int select = FEATURE_ALL) VP_OVERRIDE { PYBIND11_OVERRIDE( - vpColVector, /* Return type */ + VISP_NAMESPACE_ADDRESSING vpColVector, /* Return type */ vpBasicFeature, /* Parent class */ error, /* Name of function in C++ (must match Python name) */ s_star, /* Argument(s) */ @@ -90,10 +90,10 @@ class TrampolineBasicFeature : public vpBasicFeature } - virtual vpMatrix interaction(unsigned int select = FEATURE_ALL) VP_OVERRIDE + virtual VISP_NAMESPACE_ADDRESSING vpMatrix interaction(unsigned int select = FEATURE_ALL) VP_OVERRIDE { PYBIND11_OVERRIDE_PURE( - vpMatrix, /* Return type */ + VISP_NAMESPACE_ADDRESSING vpMatrix, /* Return type */ vpBasicFeature, /* Parent class */ interaction, /* Name of function in C++ (must match Python name) */ select /* Argument(s) */ diff --git a/modules/python/generator/visp_python_bindgen/generator.py b/modules/python/generator/visp_python_bindgen/generator.py index eb4c3ea7e0..c26ad30730 100644 --- a/modules/python/generator/visp_python_bindgen/generator.py +++ b/modules/python/generator/visp_python_bindgen/generator.py @@ -78,6 +78,9 @@ def main_str(submodule_fn_declarations, submodule_fn_calls): #include #include namespace py = pybind11; +#ifdef ENABLE_VISP_NAMESPACE +using namespace VISP_NAMESPACE_NAME; +#endif {submodule_fn_declarations} PYBIND11_MODULE(_visp, m) diff --git a/modules/python/generator/visp_python_bindgen/submodule.py b/modules/python/generator/visp_python_bindgen/submodule.py index c7e85534ed..27b082be1e 100644 --- a/modules/python/generator/visp_python_bindgen/submodule.py +++ b/modules/python/generator/visp_python_bindgen/submodule.py @@ -174,6 +174,9 @@ def generate(self) -> None: {includes_str} namespace py = pybind11; +#ifdef ENABLE_VISP_NAMESPACE +using namespace VISP_NAMESPACE_NAME; +#endif {publicists} diff --git a/modules/tracker/rbt/src/core/vpRBConvergenceMetric.cpp b/modules/tracker/rbt/src/core/vpRBConvergenceMetric.cpp index 268565fd36..70b75cd51a 100644 --- a/modules/tracker/rbt/src/core/vpRBConvergenceMetric.cpp +++ b/modules/tracker/rbt/src/core/vpRBConvergenceMetric.cpp @@ -33,6 +33,7 @@ #ifdef VISP_HAVE_NLOHMANN_JSON #include VISP_NLOHMANN_JSON(json_fwd.hpp) +BEGIN_VISP_NAMESPACE std::shared_ptr vpRBConvergenceMetric::loadFromJSON(const nlohmann::json &j) { const std::string key = j.at("type"); @@ -51,6 +52,8 @@ std::shared_ptr vpRBConvergenceMetric::loadFromJSON(const throw vpException(vpException::badValue, "Tried to parse an incorrect convergence metric type: %s", key.c_str()); } +#else +BEGIN_VISP_NAMESPACE #endif @@ -132,3 +135,4 @@ double vpRBConvergenceReprojectionMetric::operator()(const vpCameraParameters &c } return error / static_cast(uv1.getRows()); } +END_VISP_NAMESPACE