diff --git a/cmake/templates/vpConfig.h.in b/cmake/templates/vpConfig.h.in index 1c0e2955b0..34d1a4a82e 100644 --- a/cmake/templates/vpConfig.h.in +++ b/cmake/templates/vpConfig.h.in @@ -121,6 +121,9 @@ #define END_VISP_NAMESPACE } // Create an empty namespace to ensure that "using VISP_NAMESPACE_NAME;" does not raise an error namespace VISP_NAMESPACE_NAME {} + +// Create an alias for compatibility with older versions of ViSP +namespace vp = VISP_NAMESPACE_NAME; #else #define VISP_NAMESPACE_ADDRESSING #define BEGIN_VISP_NAMESPACE diff --git a/modules/core/include/visp3/core/vpEigenConversion.h b/modules/core/include/visp3/core/vpEigenConversion.h index 0d04be4dbe..ac07ffc791 100644 --- a/modules/core/include/visp3/core/vpEigenConversion.h +++ b/modules/core/include/visp3/core/vpEigenConversion.h @@ -40,14 +40,7 @@ #endif #include -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) -// The following macro forces us to us -#define VISP_EIGEN_CONVERSION_NAMESPACE vp -#else -#define VISP_EIGEN_CONVERSION_NAMESPACE VISP_NAMESPACE_NAME -#endif - -namespace VISP_EIGEN_CONVERSION_NAMESPACE +namespace VISP_NAMESPACE_NAME { #ifdef VISP_HAVE_EIGEN3 /* Eigen to ViSP */ @@ -102,5 +95,5 @@ VISP_EXPORT void visp2eigen(const VISP_NAMESPACE_ADDRESSING vpColVector &src, Ei VISP_EXPORT void visp2eigen(const VISP_NAMESPACE_ADDRESSING vpRowVector &src, Eigen::RowVectorXd &dst); #endif -} // namespace vp +} // namespace VISP_NAMESPACE_NAME #endif diff --git a/modules/core/src/math/matrix/vpEigenConversion.cpp b/modules/core/src/math/matrix/vpEigenConversion.cpp index bf2236cfa7..87e63b3736 100644 --- a/modules/core/src/math/matrix/vpEigenConversion.cpp +++ b/modules/core/src/math/matrix/vpEigenConversion.cpp @@ -35,7 +35,7 @@ #include -namespace VISP_EIGEN_CONVERSION_NAMESPACE +namespace VISP_NAMESPACE_NAME { #ifdef VISP_HAVE_EIGEN3 /* Eigen to ViSP */ @@ -91,4 +91,4 @@ void visp2eigen(const VISP_NAMESPACE_ADDRESSING vpRowVector &src, Eigen::RowVect dst = Eigen::RowVectorXd::Map(src.data, src.size()); } #endif -} // namespace vp +} // namespace VISP_NAMESPACE_NAME diff --git a/modules/core/test/math/testEigenConversion.cpp b/modules/core/test/math/testEigenConversion.cpp index 88a9204165..4bd11c6232 100644 --- a/modules/core/test/math/testEigenConversion.cpp +++ b/modules/core/test/math/testEigenConversion.cpp @@ -74,11 +74,11 @@ TEST_CASE("vpMatrix <--> Eigen::MatrixXd/Matrix3Xd conversion", "[eigen_conversi { Eigen::MatrixXd eigen_m; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_m, eigen_m); + VISP_NAMESPACE_NAME::visp2eigen(visp_m, eigen_m); std::cout << "Eigen MatrixXd:\n" << eigen_m << std::endl; vpMatrix visp_m2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_m, visp_m2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_m, visp_m2); std::cout << "ViSP vpMatrix:\n" << visp_m2 << std::endl; REQUIRE(visp_m == visp_m2); @@ -86,11 +86,11 @@ TEST_CASE("vpMatrix <--> Eigen::MatrixXd/Matrix3Xd conversion", "[eigen_conversi } { Eigen::Matrix3Xd eigen_m; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_m, eigen_m); + VISP_NAMESPACE_NAME::visp2eigen(visp_m, eigen_m); std::cout << "Eigen Matrix3Xd:\n" << eigen_m << std::endl; vpMatrix visp_m2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_m, visp_m2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_m, visp_m2); std::cout << "ViSP vpMatrix:\n" << visp_m2 << std::endl; REQUIRE(visp_m == visp_m2); @@ -114,15 +114,15 @@ TEST_CASE("Eigen::MatrixXd <--> vpMatrix conversion", "[eigen_conversion]") std::cout << "Eigen Matrix (row major: " << eigen_m.IsRowMajor << "):\n" << eigen_m << std::endl; vpMatrix visp_m; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_m, visp_m); + VISP_NAMESPACE_NAME::eigen2visp(eigen_m, visp_m); std::cout << "ViSP vpMatrix:\n" << visp_m << std::endl; Eigen::MatrixXd eigen_m2; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_m, eigen_m2); + VISP_NAMESPACE_NAME::visp2eigen(visp_m, eigen_m2); std::cout << "Eigen MatrixXd (row major: " << eigen_m2.IsRowMajor << "):\n" << eigen_m2 << std::endl; vpMatrix visp_m2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_m2, visp_m2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_m2, visp_m2); REQUIRE(visp_m == visp_m2); std::cout << std::endl; } @@ -143,15 +143,15 @@ TEST_CASE("Eigen::MatrixX4d <--> vpMatrix conversion", "[eigen_conversion]") std::cout << "Eigen MatrixX4d (row major: " << eigen_m.IsRowMajor << "):\n" << eigen_m << std::endl; vpMatrix visp_m; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_m, visp_m); + VISP_NAMESPACE_NAME::eigen2visp(eigen_m, visp_m); std::cout << "ViSP vpMatrix:\n" << visp_m << std::endl; Eigen::MatrixX4d eigen_m2; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_m, eigen_m2); + VISP_NAMESPACE_NAME::visp2eigen(visp_m, eigen_m2); std::cout << "Eigen MatrixX4d (row major: " << eigen_m2.IsRowMajor << "):\n" << eigen_m2 << std::endl; vpMatrix visp_m2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_m2, visp_m2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_m2, visp_m2); REQUIRE(visp_m == visp_m2); std::cout << std::endl; } @@ -172,15 +172,15 @@ TEST_CASE("Eigen::Matrix <--> vpMatrix conve std::cout << "Eigen Matrix (RowMajor):\n" << eigen_m << std::endl; vpMatrix visp_m; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_m, visp_m); + VISP_NAMESPACE_NAME::eigen2visp(eigen_m, visp_m); std::cout << "ViSP vpMatrix:\n" << visp_m << std::endl; Eigen::MatrixXd eigen_m2; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_m, eigen_m2); + VISP_NAMESPACE_NAME::visp2eigen(visp_m, eigen_m2); std::cout << "Eigen MatrixXd (row major: " << eigen_m2.IsRowMajor << "):\n" << eigen_m2 << std::endl; vpMatrix visp_m2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_m2, visp_m2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_m2, visp_m2); REQUIRE(visp_m == visp_m2); std::cout << std::endl; } @@ -201,15 +201,15 @@ TEST_CASE("Eigen::Matrix <--> vpMatrix conve std::cout << "Eigen Matrix (ColMajor):\n" << eigen_m << std::endl; vpMatrix visp_m; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_m, visp_m); + VISP_NAMESPACE_NAME::eigen2visp(eigen_m, visp_m); std::cout << "ViSP vpMatrix:\n" << visp_m << std::endl; Eigen::MatrixXd eigen_m2; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_m, eigen_m2); + VISP_NAMESPACE_NAME::visp2eigen(visp_m, eigen_m2); std::cout << "Eigen MatrixXd (row major: " << eigen_m2.IsRowMajor << "):\n" << eigen_m2 << std::endl; vpMatrix visp_m2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_m2, visp_m2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_m2, visp_m2); REQUIRE(visp_m == visp_m2); std::cout << std::endl; } @@ -218,11 +218,11 @@ TEST_CASE("vpHomogeneousMatrix <--> Eigen::Matrix4d conversion", "[eigen_convers { vpHomogeneousMatrix visp_cMo(0.1, 0.2, 0.3, 0.1, 0.2, 0.3); Eigen::Matrix4d eigen_cMo; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_cMo, eigen_cMo); + VISP_NAMESPACE_NAME::visp2eigen(visp_cMo, eigen_cMo); std::cout << "Eigen Matrix4d cMo:\n" << eigen_cMo << std::endl; vpHomogeneousMatrix visp_cMo2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_cMo, visp_cMo2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_cMo, visp_cMo2); std::cout << "ViSP vpHomogeneousMatrix cMo:\n" << visp_cMo2 << std::endl; REQUIRE(visp_cMo == visp_cMo2); std::cout << std::endl; @@ -232,12 +232,12 @@ TEST_CASE("vpHomogeneousMatrix <--> Eigen::Matrix4f + double casting conversion" { vpHomogeneousMatrix visp_cMo; // identity for float to double casting Eigen::Matrix4d eigen_cMo_tmp; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_cMo, eigen_cMo_tmp); + VISP_NAMESPACE_NAME::visp2eigen(visp_cMo, eigen_cMo_tmp); Eigen::Matrix4f eigen_cMo = eigen_cMo_tmp.cast(); std::cout << "Eigen Matrix4f cMo:\n" << eigen_cMo << std::endl; vpHomogeneousMatrix visp_cMo2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_cMo.cast(), visp_cMo2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_cMo.cast(), visp_cMo2); std::cout << "ViSP vpHomogeneousMatrix cMo:\n" << visp_cMo2 << std::endl; REQUIRE(visp_cMo == visp_cMo2); std::cout << std::endl; @@ -247,11 +247,11 @@ TEST_CASE("vpQuaternionVector <--> Eigen::Quaternionf conversion", "[eigen_conve { vpQuaternionVector visp_quaternion(0, 1, 2, 3); Eigen::Quaternionf eigen_quaternion; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_quaternion, eigen_quaternion); + VISP_NAMESPACE_NAME::visp2eigen(visp_quaternion, eigen_quaternion); std::cout << "Eigen quaternion: " << eigen_quaternion << std::endl; vpQuaternionVector visp_quaternion2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_quaternion, visp_quaternion2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_quaternion, visp_quaternion2); std::cout << "ViSP quaternion: " << visp_quaternion2.t() << std::endl; REQUIRE(visp_quaternion == visp_quaternion2); std::cout << std::endl; @@ -261,11 +261,11 @@ TEST_CASE("vpThetaUVector <--> Eigen::AngleAxisf conversion", "[eigen_conversion { vpThetaUVector visp_thetau(0, 1, 2); Eigen::AngleAxisf eigen_angle_axis; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_thetau, eigen_angle_axis); + VISP_NAMESPACE_NAME::visp2eigen(visp_thetau, eigen_angle_axis); std::cout << "Eigen AngleAxis: " << eigen_angle_axis << std::endl; vpThetaUVector visp_thetau2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_angle_axis, visp_thetau2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_angle_axis, visp_thetau2); std::cout << "ViSP AngleAxis: " << visp_thetau2.t() << std::endl; REQUIRE(visp_thetau == visp_thetau2); std::cout << std::endl; @@ -276,11 +276,11 @@ TEST_CASE("vpColVector <--> Eigen::VectorXd conversion", "[eigen_conversion]") vpColVector visp_col(4, 4); visp_col = 10; Eigen::VectorXd eigen_col; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_col, eigen_col); + VISP_NAMESPACE_NAME::visp2eigen(visp_col, eigen_col); std::cout << "Eigen VectorXd: " << eigen_col.transpose() << std::endl; vpColVector visp_col2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_col, visp_col2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_col, visp_col2); std::cout << "ViSP vpColVector: " << visp_col2.t() << std::endl; REQUIRE(visp_col == visp_col2); std::cout << std::endl; @@ -291,11 +291,11 @@ TEST_CASE("vpRowVector <--> Eigen::RowVectorXd conversion", "[eigen_conversion]" vpRowVector visp_row(4, 10); visp_row = 10; Eigen::RowVectorXd eigen_row; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_row, eigen_row); + VISP_NAMESPACE_NAME::visp2eigen(visp_row, eigen_row); std::cout << "Eigen RowVectorXd: " << eigen_row << std::endl; vpRowVector visp_row2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_row, visp_row2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_row, visp_row2); std::cout << "ViSP vpRowVector: " << visp_row2 << std::endl; REQUIRE(visp_row == visp_row2); std::cout << std::endl; @@ -306,15 +306,15 @@ TEST_CASE("Eigen::RowVector4d <--> vpRowVector conversion", "[eigen_conversion]" Eigen::RowVector4d eigen_row; eigen_row << 9, 8, 7, 6; vpRowVector visp_row; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_row, visp_row); + VISP_NAMESPACE_NAME::eigen2visp(eigen_row, visp_row); std::cout << "ViSP vpRowVector: " << visp_row << std::endl; Eigen::RowVector4d eigen_row2; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_row, eigen_row2); + VISP_NAMESPACE_NAME::visp2eigen(visp_row, eigen_row2); std::cout << "Eigen RowVector4d: " << eigen_row2 << std::endl; vpRowVector visp_row2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_row2, visp_row2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_row2, visp_row2); REQUIRE(visp_row == visp_row2); std::cout << std::endl; } @@ -324,11 +324,11 @@ TEST_CASE("vpRowVector <--> Eigen::RowVector4d conversion", "[eigen_conversion]" vpRowVector visp_row(4, 10); visp_row = 10; Eigen::RowVector4d eigen_row; - VISP_EIGEN_CONVERSION_NAMESPACE::visp2eigen(visp_row, eigen_row); + VISP_NAMESPACE_NAME::visp2eigen(visp_row, eigen_row); std::cout << "Eigen RowVector4d: " << eigen_row << std::endl; vpRowVector visp_row2; - VISP_EIGEN_CONVERSION_NAMESPACE::eigen2visp(eigen_row, visp_row2); + VISP_NAMESPACE_NAME::eigen2visp(eigen_row, visp_row2); std::cout << "ViSP vpRowVector: " << visp_row2 << std::endl; REQUIRE(visp_row == visp_row2); std::cout << std::endl; diff --git a/modules/imgproc/include/visp3/imgproc/vpContours.h b/modules/imgproc/include/visp3/imgproc/vpContours.h index bd1d422684..fa60f10c9e 100644 --- a/modules/imgproc/include/visp3/imgproc/vpContours.h +++ b/modules/imgproc/include/visp3/imgproc/vpContours.h @@ -74,13 +74,7 @@ #include #include -#ifdef VISP_BUILD_DEPRECATED_FUNCTIONS -#define VISP_CONTOURS_NAMESPACE vp -#else -#define VISP_CONTOURS_NAMESPACE VISP_NAMESPACE_NAME -#endif - -namespace VISP_CONTOURS_NAMESPACE +namespace VISP_NAMESPACE_NAME { /*! diff --git a/modules/imgproc/include/visp3/imgproc/vpImgproc.h b/modules/imgproc/include/visp3/imgproc/vpImgproc.h index b0bf57ed12..c476fc4608 100644 --- a/modules/imgproc/include/visp3/imgproc/vpImgproc.h +++ b/modules/imgproc/include/visp3/imgproc/vpImgproc.h @@ -45,13 +45,7 @@ #include #include -#ifdef VISP_BUILD_DEPRECATED_FUNCTIONS -#define VISP_IMGPROC_NAMESPACE vp -#else -#define VISP_IMGPROC_NAMESPACE VISP_NAMESPACE_NAME -#endif - -namespace VISP_IMGPROC_NAMESPACE +namespace VISP_NAMESPACE_NAME { #define USE_OLD_FILL_HOLE 0 diff --git a/modules/imgproc/src/vpCLAHE.cpp b/modules/imgproc/src/vpCLAHE.cpp index 32720c800f..1a9aeaa484 100644 --- a/modules/imgproc/src/vpCLAHE.cpp +++ b/modules/imgproc/src/vpCLAHE.cpp @@ -79,17 +79,9 @@ #include #include -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) -namespace vp -#else namespace VISP_NAMESPACE_NAME -#endif { -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) && defined(ENABLE_VISP_NAMESPACE) -using namespace VISP_NAMESPACE_NAME; -#endif - int fastRound(float value) { return static_cast(value + 0.5f); } void clipHistogram(const std::vector &hist, std::vector &clippedHist, int limit) @@ -405,7 +397,7 @@ void clahe(const vpImage &I1, vpImage &I2, int blo ++hist[fastRound((I1[yi][xi] / 255.0f) * bins)]; } } - } + } else { hist = prev_hist; @@ -454,9 +446,9 @@ void clahe(const vpImage &I1, vpImage &I2, int blo int limit = static_cast(((slope * n) / bins) + 0.5f); I2[y][x] = fastRound(transferValue(v, hist, clippedHist, limit) * 255.0f); } + } } } -} void clahe(const vpImage &I1, vpImage &I2, int blockRadius, int bins, float slope, bool fast) { diff --git a/modules/imgproc/src/vpConnectedComponents.cpp b/modules/imgproc/src/vpConnectedComponents.cpp index 7e6350ce98..0eaff447f8 100644 --- a/modules/imgproc/src/vpConnectedComponents.cpp +++ b/modules/imgproc/src/vpConnectedComponents.cpp @@ -39,15 +39,8 @@ #include #include -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) -namespace vp -#else namespace VISP_NAMESPACE_NAME -#endif { -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) && defined(ENABLE_VISP_NAMESPACE) -using namespace VISP_NAMESPACE_NAME; -#endif void getNeighbors(const vpImage &I, std::queue &listOfNeighbors, unsigned int i, unsigned int j, const vpImageMorphology::vpConnexityType &connexity) diff --git a/modules/imgproc/src/vpContours.cpp b/modules/imgproc/src/vpContours.cpp index c89002e704..aed9cc035e 100644 --- a/modules/imgproc/src/vpContours.cpp +++ b/modules/imgproc/src/vpContours.cpp @@ -70,11 +70,7 @@ #include #include -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) -namespace vp -#else namespace VISP_NAMESPACE_NAME -#endif { #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) && defined(ENABLE_VISP_NAMESPACE) using namespace VISP_NAMESPACE_NAME; diff --git a/modules/imgproc/src/vpFloodFill.cpp b/modules/imgproc/src/vpFloodFill.cpp index ae92fc0638..e89bbc6510 100644 --- a/modules/imgproc/src/vpFloodFill.cpp +++ b/modules/imgproc/src/vpFloodFill.cpp @@ -66,15 +66,8 @@ #include #include -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) -namespace vp -#else namespace VISP_NAMESPACE_NAME -#endif { -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) && defined(ENABLE_VISP_NAMESPACE) -using namespace VISP_NAMESPACE_NAME; -#endif void floodFill(vpImage &I, const vpImagePoint &seedPoint, const unsigned char oldValue, const unsigned char newValue, const vpImageMorphology::vpConnexityType &connexity) diff --git a/modules/imgproc/src/vpImgproc.cpp b/modules/imgproc/src/vpImgproc.cpp index 6d3480f2ed..5a82a3ace3 100644 --- a/modules/imgproc/src/vpImgproc.cpp +++ b/modules/imgproc/src/vpImgproc.cpp @@ -64,7 +64,7 @@ #include #include -namespace VISP_IMGPROC_NAMESPACE +namespace VISP_NAMESPACE_NAME { #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) && defined(ENABLE_VISP_NAMESPACE) using namespace VISP_NAMESPACE_NAME; diff --git a/modules/imgproc/src/vpMorph.cpp b/modules/imgproc/src/vpMorph.cpp index 16b50d2a95..500563f593 100644 --- a/modules/imgproc/src/vpMorph.cpp +++ b/modules/imgproc/src/vpMorph.cpp @@ -39,15 +39,8 @@ #include #include -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) -namespace vp -#else namespace VISP_NAMESPACE_NAME -#endif { -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) && defined(ENABLE_VISP_NAMESPACE) -using namespace VISP_NAMESPACE_NAME; -#endif void fillHoles(vpImage &I #if USE_OLD_FILL_HOLE @@ -97,8 +90,8 @@ void fillHoles(vpImage &I for (unsigned int i = 0; i < I.getHeight(); ++i) { for (unsigned int j = 0; j < I.getWidth(); ++j) { I[i][j] = 255 - I_reconstruct[i + 1][j + 1]; + } } -} #else // Create flood fill mask vpImage flood_fill_mask(I.getHeight() + 2, I.getWidth() + 2, 0); diff --git a/modules/imgproc/src/vpRetinex.cpp b/modules/imgproc/src/vpRetinex.cpp index b4ce7dd61a..6df8890bcb 100644 --- a/modules/imgproc/src/vpRetinex.cpp +++ b/modules/imgproc/src/vpRetinex.cpp @@ -88,19 +88,11 @@ #include #include -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) -namespace vp -#else namespace VISP_NAMESPACE_NAME -#endif { #define MAX_RETINEX_SCALES 8 -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) && defined(ENABLE_VISP_NAMESPACE) -using namespace VISP_NAMESPACE_NAME; -#endif - std::vector retinexScalesDistribution(int scaleDiv, int level, int scale) { std::vector scales(MAX_RETINEX_SCALES); diff --git a/modules/imgproc/src/vpThreshold.cpp b/modules/imgproc/src/vpThreshold.cpp index 157c945859..d8365d0f22 100644 --- a/modules/imgproc/src/vpThreshold.cpp +++ b/modules/imgproc/src/vpThreshold.cpp @@ -40,15 +40,8 @@ #include #include -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) -namespace vp -#else namespace VISP_NAMESPACE_NAME -#endif { -#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) && defined(ENABLE_VISP_NAMESPACE) -using namespace VISP_NAMESPACE_NAME; -#endif bool isBimodal(const std::vector &hist_float) { diff --git a/modules/imgproc/test/with-dataset/testAutoThreshold.cpp b/modules/imgproc/test/with-dataset/testAutoThreshold.cpp index c4b0cad733..f9aba1768c 100644 --- a/modules/imgproc/test/with-dataset/testAutoThreshold.cpp +++ b/modules/imgproc/test/with-dataset/testAutoThreshold.cpp @@ -252,7 +252,7 @@ int main(int argc, const char **argv) // Huang double t = vpTime::measureTimeMs(); - double threshold = VISP_IMGPROC_NAMESPACE::autoThreshold(I_thresh, VISP_IMGPROC_NAMESPACE::AUTO_THRESHOLD_HUANG); + double threshold = VISP_NAMESPACE_NAME::autoThreshold(I_thresh, VISP_NAMESPACE_NAME::AUTO_THRESHOLD_HUANG); t = vpTime::measureTimeMs() - t; std::cout << "\nAutomatic thresholding (Huang): " << threshold << " ; t=" << t << " ms" << std::endl; @@ -263,7 +263,7 @@ int main(int argc, const char **argv) // Intermodes I_thresh = I; t = vpTime::measureTimeMs(); - threshold = VISP_IMGPROC_NAMESPACE::autoThreshold(I_thresh, VISP_IMGPROC_NAMESPACE::AUTO_THRESHOLD_INTERMODES); + threshold = VISP_NAMESPACE_NAME::autoThreshold(I_thresh, VISP_NAMESPACE_NAME::AUTO_THRESHOLD_INTERMODES); t = vpTime::measureTimeMs() - t; std::cout << "\nAutomatic thresholding (Intermodes): " << threshold << " ; t=" << t << " ms" << std::endl; @@ -274,7 +274,7 @@ int main(int argc, const char **argv) // IsoData I_thresh = I; t = vpTime::measureTimeMs(); - threshold = VISP_IMGPROC_NAMESPACE::autoThreshold(I_thresh, VISP_IMGPROC_NAMESPACE::AUTO_THRESHOLD_ISODATA); + threshold = VISP_NAMESPACE_NAME::autoThreshold(I_thresh, VISP_NAMESPACE_NAME::AUTO_THRESHOLD_ISODATA); t = vpTime::measureTimeMs() - t; std::cout << "\nAutomatic thresholding (IsoData): " << threshold << " ; t=" << t << " ms" << std::endl; @@ -285,7 +285,7 @@ int main(int argc, const char **argv) // Mean I_thresh = I; t = vpTime::measureTimeMs(); - threshold = VISP_IMGPROC_NAMESPACE::autoThreshold(I_thresh, VISP_IMGPROC_NAMESPACE::AUTO_THRESHOLD_MEAN); + threshold = VISP_NAMESPACE_NAME::autoThreshold(I_thresh, VISP_NAMESPACE_NAME::AUTO_THRESHOLD_MEAN); t = vpTime::measureTimeMs() - t; std::cout << "\nAutomatic thresholding (Mean): " << threshold << " ; t=" << t << " ms" << std::endl; @@ -296,7 +296,7 @@ int main(int argc, const char **argv) // Otsu I_thresh = I; t = vpTime::measureTimeMs(); - threshold = VISP_IMGPROC_NAMESPACE::autoThreshold(I_thresh, VISP_IMGPROC_NAMESPACE::AUTO_THRESHOLD_OTSU); + threshold = VISP_NAMESPACE_NAME::autoThreshold(I_thresh, VISP_NAMESPACE_NAME::AUTO_THRESHOLD_OTSU); t = vpTime::measureTimeMs() - t; std::cout << "\nAutomatic thresholding (Otsu): " << threshold << " ; t=" << t << " ms" << std::endl; @@ -307,7 +307,7 @@ int main(int argc, const char **argv) // Triangle I_thresh = I; t = vpTime::measureTimeMs(); - threshold = VISP_IMGPROC_NAMESPACE::autoThreshold(I_thresh, VISP_IMGPROC_NAMESPACE::AUTO_THRESHOLD_TRIANGLE); + threshold = VISP_NAMESPACE_NAME::autoThreshold(I_thresh, VISP_NAMESPACE_NAME::AUTO_THRESHOLD_TRIANGLE); t = vpTime::measureTimeMs() - t; std::cout << "\nAutomatic thresholding (Triangle): " << threshold << " ; t=" << t << " ms" << std::endl; diff --git a/modules/imgproc/test/with-dataset/testConnectedComponents.cpp b/modules/imgproc/test/with-dataset/testConnectedComponents.cpp index 6c06ac98ea..d0c8ac64d2 100644 --- a/modules/imgproc/test/with-dataset/testConnectedComponents.cpp +++ b/modules/imgproc/test/with-dataset/testConnectedComponents.cpp @@ -295,7 +295,7 @@ int main(int argc, const char **argv) vpImage labels_connex4; int nbComponents = 0; double t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::connectedComponents(I, labels_connex4, nbComponents, vpImageMorphology::CONNEXITY_4); + VISP_NAMESPACE_NAME::connectedComponents(I, labels_connex4, nbComponents, vpImageMorphology::CONNEXITY_4); t = vpTime::measureTimeMs() - t; std::cout << "\n4-connexity connected components:" << std::endl; std::cout << "Time: " << t << " ms" << std::endl; @@ -303,7 +303,7 @@ int main(int argc, const char **argv) vpImage labels_connex8; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::connectedComponents(I, labels_connex8, nbComponents, vpImageMorphology::CONNEXITY_8); + VISP_NAMESPACE_NAME::connectedComponents(I, labels_connex8, nbComponents, vpImageMorphology::CONNEXITY_8); t = vpTime::measureTimeMs() - t; std::cout << "\n8-connexity connected components:" << std::endl; std::cout << "Time: " << t << " ms" << std::endl; diff --git a/modules/imgproc/test/with-dataset/testContours.cpp b/modules/imgproc/test/with-dataset/testContours.cpp index 439135cc8f..9d11831de4 100644 --- a/modules/imgproc/test/with-dataset/testContours.cpp +++ b/modules/imgproc/test/with-dataset/testContours.cpp @@ -171,15 +171,15 @@ void printImage(const vpImage &I, const std::string &name) } } -void displayContourInfo(const VISP_CONTOURS_NAMESPACE::vpContour &contour, int level) +void displayContourInfo(const VISP_NAMESPACE_NAME::vpContour &contour, int level) { std::cout << "\nContour:" << std::endl; std::cout << "\tlevel: " << level << std::endl; - std::cout << "\tcontour type: " << (contour.m_contourType == VISP_CONTOURS_NAMESPACE::CONTOUR_OUTER ? "outer contour" : "hole contour") + std::cout << "\tcontour type: " << (contour.m_contourType == VISP_NAMESPACE_NAME::CONTOUR_OUTER ? "outer contour" : "hole contour") << std::endl; std::cout << "\tnb children: " << contour.m_children.size() << std::endl; - for (std::vector::const_iterator it = contour.m_children.begin(); it != contour.m_children.end(); + for (std::vector::const_iterator it = contour.m_children.begin(); it != contour.m_children.end(); ++it) { displayContourInfo(**it, level + 1); } @@ -279,10 +279,10 @@ int main(int argc, const char **argv) std::cout << "Test with image data:" << std::endl; printImage(I_test_data, "I_test_data"); - VISP_CONTOURS_NAMESPACE::vpContour vp_contours; + VISP_NAMESPACE_NAME::vpContour vp_contours; std::vector > contours; double t = vpTime::measureTimeMs(); - VISP_CONTOURS_NAMESPACE::findContours(I_test_data, vp_contours, contours); + VISP_NAMESPACE_NAME::findContours(I_test_data, vp_contours, contours); t = vpTime::measureTimeMs() - t; displayContourInfo(vp_contours, 0); @@ -304,7 +304,7 @@ int main(int argc, const char **argv) vpImageIo::write(I2, filename); t = vpTime::measureTimeMs(); - VISP_CONTOURS_NAMESPACE::findContours(I, vp_contours, contours); + VISP_NAMESPACE_NAME::findContours(I, vp_contours, contours); t = vpTime::measureTimeMs() - t; displayContourInfo(vp_contours, 0); @@ -313,50 +313,50 @@ int main(int argc, const char **argv) // Draw and save vpImage I_draw_contours(I2.getHeight(), I2.getWidth(), 0); - VISP_CONTOURS_NAMESPACE::drawContours(I_draw_contours, contours); + VISP_NAMESPACE_NAME::drawContours(I_draw_contours, contours); filename = vpIoTools::createFilePath(opath, "Klimt_contours_extracted.pgm"); vpImageIo::write(I_draw_contours, filename); vpImage I_draw_contours_color(I2.getHeight(), I2.getWidth(), vpRGBa(0, 0, 0)); - VISP_CONTOURS_NAMESPACE::drawContours(I_draw_contours_color, contours, vpColor::red); + VISP_NAMESPACE_NAME::drawContours(I_draw_contours_color, contours, vpColor::red); filename = vpIoTools::createFilePath(opath, "Klimt_contours_extracted_color.ppm"); vpImageIo::write(I_draw_contours_color, filename); // Test retrieve list - VISP_CONTOURS_NAMESPACE::findContours(I, vp_contours, contours, VISP_CONTOURS_NAMESPACE::CONTOUR_RETR_LIST); + VISP_NAMESPACE_NAME::findContours(I, vp_contours, contours, VISP_NAMESPACE_NAME::CONTOUR_RETR_LIST); vpImage I_draw_contours_list(I2.getHeight(), I2.getWidth(), 0); vpImage I_tmp_list(I.getHeight(), I.getWidth(), 0); - VISP_CONTOURS_NAMESPACE::drawContours(I_tmp_list, contours); + VISP_NAMESPACE_NAME::drawContours(I_tmp_list, contours); contours.clear(); - for (std::vector::const_iterator it = vp_contours.m_children.begin(); + for (std::vector::const_iterator it = vp_contours.m_children.begin(); it != vp_contours.m_children.end(); ++it) { contours.push_back((*it)->m_points); } - VISP_CONTOURS_NAMESPACE::drawContours(I_draw_contours_list, contours); + VISP_NAMESPACE_NAME::drawContours(I_draw_contours_list, contours); std::cout << "(I_tmp_list == I_draw_contours_list)? " << (I_tmp_list == I_draw_contours_list) << std::endl; filename = vpIoTools::createFilePath(opath, "Klimt_contours_extracted_list.pgm"); vpImageIo::write(I_draw_contours_list, filename); // Test retrieve external - VISP_CONTOURS_NAMESPACE::findContours(I, vp_contours, contours, VISP_CONTOURS_NAMESPACE::CONTOUR_RETR_EXTERNAL); + VISP_NAMESPACE_NAME::findContours(I, vp_contours, contours, VISP_NAMESPACE_NAME::CONTOUR_RETR_EXTERNAL); vpImage I_draw_contours_external(I2.getHeight(), I2.getWidth(), 0); vpImage I_tmp_external(I.getHeight(), I.getWidth(), 0); - VISP_CONTOURS_NAMESPACE::drawContours(I_tmp_external, contours); + VISP_NAMESPACE_NAME::drawContours(I_tmp_external, contours); contours.clear(); - for (std::vector::const_iterator it = vp_contours.m_children.begin(); + for (std::vector::const_iterator it = vp_contours.m_children.begin(); it != vp_contours.m_children.end(); ++it) { contours.push_back((*it)->m_points); } - VISP_CONTOURS_NAMESPACE::drawContours(I_draw_contours_external, contours); + VISP_NAMESPACE_NAME::drawContours(I_draw_contours_external, contours); std::cout << "(I_tmp_external == I_draw_contours_external)? " << (I_tmp_external == I_draw_contours_external) << std::endl; @@ -369,7 +369,7 @@ int main(int argc, const char **argv) (unsigned char)255); t = vpTime::measureTimeMs(); - VISP_CONTOURS_NAMESPACE::fillHoles(I_holes); + VISP_NAMESPACE_NAME::fillHoles(I_holes); t = vpTime::measureTimeMs() - t; std::cout << "\nFill Holes: " << t << " ms" << std::endl; diff --git a/modules/imgproc/test/with-dataset/testFloodFill.cpp b/modules/imgproc/test/with-dataset/testFloodFill.cpp index 3078d69496..f8b6d4be96 100644 --- a/modules/imgproc/test/with-dataset/testFloodFill.cpp +++ b/modules/imgproc/test/with-dataset/testFloodFill.cpp @@ -279,21 +279,21 @@ int main(int argc, const char **argv) vpImage I_check_8_connexity(image_data_check_8_connexity, 8, 8, true); // Test flood fill on test data 4-connexity - VISP_IMGPROC_NAMESPACE::floodFill(I_test_flood_fill_4_connexity, vpImagePoint(2, 2), 0, 1, vpImageMorphology::CONNEXITY_4); + VISP_NAMESPACE_NAME::floodFill(I_test_flood_fill_4_connexity, vpImagePoint(2, 2), 0, 1, vpImageMorphology::CONNEXITY_4); printImage(I_test_flood_fill_4_connexity, "I_test_flood_fill_4_connexity"); if (I_test_flood_fill_4_connexity != I_check_4_connexity) { - throw vpException(vpException::fatalError, "Problem with VISP_IMGPROC_NAMESPACE::floodFill() and 4-connexity!"); + throw vpException(vpException::fatalError, "Problem with VISP_NAMESPACE_NAME::floodFill() and 4-connexity!"); } std::cout << "\n(I_test_flood_fill_4_connexity == I_check_4_connexity)? " << (I_test_flood_fill_4_connexity == I_check_4_connexity) << std::endl; // Test flood fill on test data 8-connexity - VISP_IMGPROC_NAMESPACE::floodFill(I_test_flood_fill_8_connexity, vpImagePoint(2, 2), 0, 1, vpImageMorphology::CONNEXITY_8); + VISP_NAMESPACE_NAME::floodFill(I_test_flood_fill_8_connexity, vpImagePoint(2, 2), 0, 1, vpImageMorphology::CONNEXITY_8); printImage(I_test_flood_fill_8_connexity, "I_test_flood_fill_8_connexity"); if (I_test_flood_fill_8_connexity != I_check_8_connexity) { - throw vpException(vpException::fatalError, "Problem with VISP_IMGPROC_NAMESPACE::floodFill() and 8-connexity!"); + throw vpException(vpException::fatalError, "Problem with VISP_NAMESPACE_NAME::floodFill() and 8-connexity!"); } std::cout << "\n(I_test_flood_fill_8_connexity == I_check_8_connexity)? " << (I_test_flood_fill_8_connexity == I_check_8_connexity) << std::endl; @@ -313,7 +313,7 @@ int main(int argc, const char **argv) vpImage I_klimt_flood_fill_4_connexity = I_klimt; double t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::floodFill(I_klimt_flood_fill_4_connexity, vpImagePoint(seed_y, seed_x), 0, 255, vpImageMorphology::CONNEXITY_4); + VISP_NAMESPACE_NAME::floodFill(I_klimt_flood_fill_4_connexity, vpImagePoint(seed_y, seed_x), 0, 255, vpImageMorphology::CONNEXITY_4); t = vpTime::measureTimeMs() - t; std::cout << "Flood fill on Klimt image (4-connexity): " << t << " ms" << std::endl; @@ -322,7 +322,7 @@ int main(int argc, const char **argv) vpImage I_klimt_flood_fill_8_connexity = I_klimt; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::floodFill(I_klimt_flood_fill_8_connexity, vpImagePoint(seed_y, seed_x), 0, 255, vpImageMorphology::CONNEXITY_8); + VISP_NAMESPACE_NAME::floodFill(I_klimt_flood_fill_8_connexity, vpImagePoint(seed_y, seed_x), 0, 255, vpImageMorphology::CONNEXITY_8); t = vpTime::measureTimeMs() - t; std::cout << "Flood fill on Klimt image (8-connexity): " << t << " ms" << std::endl; filename = vpIoTools::createFilePath(opath, "Klimt_flood_fill_8_connexity.pgm"); diff --git a/modules/imgproc/test/with-dataset/testImgproc.cpp b/modules/imgproc/test/with-dataset/testImgproc.cpp index 8cbf71bcab..6af19a1427 100644 --- a/modules/imgproc/test/with-dataset/testImgproc.cpp +++ b/modules/imgproc/test/with-dataset/testImgproc.cpp @@ -256,7 +256,7 @@ int main(int argc, const char **argv) double alpha = 1.5, beta = -10.0; vpImage I_color_adjust; double t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::adjust(I_color, I_color_adjust, alpha, beta); + VISP_NAMESPACE_NAME::adjust(I_color, I_color_adjust, alpha, beta); t = vpTime::measureTimeMs() - t; std::cout << "Time to do color adjust: " << t << " ms" << std::endl; @@ -267,7 +267,7 @@ int main(int argc, const char **argv) // Equalize Histogram vpImage I_color_equalize_histogram; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::equalizeHistogram(I_color, I_color_equalize_histogram); + VISP_NAMESPACE_NAME::equalizeHistogram(I_color, I_color_equalize_histogram); t = vpTime::measureTimeMs() - t; std::cout << "Time to do color histogram equalization: " << t << " ms" << std::endl; @@ -279,7 +279,7 @@ int main(int argc, const char **argv) vpImage I_color_gamma_correction; float gamma = 2.2f; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::gammaCorrection(I_color, I_color_gamma_correction, gamma); + VISP_NAMESPACE_NAME::gammaCorrection(I_color, I_color_gamma_correction, gamma); t = vpTime::measureTimeMs() - t; std::cout << "Time to do color gamma correction: " << t << " ms" << std::endl; @@ -290,7 +290,7 @@ int main(int argc, const char **argv) // Retinex vpImage I_color_retinex; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::retinex(I_color, I_color_retinex); + VISP_NAMESPACE_NAME::retinex(I_color, I_color_retinex); t = vpTime::measureTimeMs() - t; std::cout << "Time to do color retinex: " << t << " ms" << std::endl; @@ -301,7 +301,7 @@ int main(int argc, const char **argv) // Stretch contrast vpImage I_color_stretch_contrast; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::stretchContrast(I_color, I_color_stretch_contrast); + VISP_NAMESPACE_NAME::stretchContrast(I_color, I_color_stretch_contrast); t = vpTime::measureTimeMs() - t; std::cout << "Time to do color contrast stretching: " << t << " ms" << std::endl; @@ -312,7 +312,7 @@ int main(int argc, const char **argv) // Stretch Contrast HSV vpImage I_color_stretch_contrast_HSV; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::stretchContrastHSV(I_color, I_color_stretch_contrast_HSV); + VISP_NAMESPACE_NAME::stretchContrastHSV(I_color, I_color_stretch_contrast_HSV); t = vpTime::measureTimeMs() - t; std::cout << "Time to do color HSV contrast stretching: " << t << " ms" << std::endl; @@ -324,7 +324,7 @@ int main(int argc, const char **argv) vpImage I_color_unsharp_mask; const float sigma = 1.0f; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::unsharpMask(I_color, I_color_unsharp_mask, sigma); + VISP_NAMESPACE_NAME::unsharpMask(I_color, I_color_unsharp_mask, sigma); t = vpTime::measureTimeMs() - t; std::cout << "Time to do color unsharp mask: " << t << " ms" << std::endl; @@ -335,7 +335,7 @@ int main(int argc, const char **argv) // CLAHE vpImage I_color_clahe; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::clahe(I_color, I_color_clahe, 50); + VISP_NAMESPACE_NAME::clahe(I_color, I_color_clahe, 50); t = vpTime::measureTimeMs() - t; std::cout << "Time to do color CLAHE: " << t << " ms" << std::endl; @@ -359,7 +359,7 @@ int main(int argc, const char **argv) vpImage I_adjust; beta = -20.0; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::adjust(I, I_adjust, alpha, beta); + VISP_NAMESPACE_NAME::adjust(I, I_adjust, alpha, beta); t = vpTime::measureTimeMs() - t; std::cout << "Time to do grayscale adjust: " << t << " ms" << std::endl; @@ -370,7 +370,7 @@ int main(int argc, const char **argv) // Equalize Histogram vpImage I_equalize_histogram; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::equalizeHistogram(I, I_equalize_histogram); + VISP_NAMESPACE_NAME::equalizeHistogram(I, I_equalize_histogram); t = vpTime::measureTimeMs() - t; std::cout << "Time to do grayscale histogram equalization: " << t << " ms" << std::endl; @@ -382,7 +382,7 @@ int main(int argc, const char **argv) vpImage I_gamma_correction; gamma = 1.8f; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::gammaCorrection(I, I_gamma_correction, gamma); + VISP_NAMESPACE_NAME::gammaCorrection(I, I_gamma_correction, gamma); t = vpTime::measureTimeMs() - t; std::cout << "Time to do grayscale gamma correction: " << t << " ms" << std::endl; @@ -393,7 +393,7 @@ int main(int argc, const char **argv) // Stretch contrast vpImage I_stretch_contrast; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::stretchContrast(I, I_stretch_contrast); + VISP_NAMESPACE_NAME::stretchContrast(I, I_stretch_contrast); t = vpTime::measureTimeMs() - t; std::cout << "Time to do grayscale contrast stretching: " << t << " ms" << std::endl; @@ -404,7 +404,7 @@ int main(int argc, const char **argv) // Unsharp Mask vpImage I_unsharp_mask; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::unsharpMask(I, I_unsharp_mask, sigma); + VISP_NAMESPACE_NAME::unsharpMask(I, I_unsharp_mask, sigma); t = vpTime::measureTimeMs() - t; std::cout << "Time to do grayscale unsharp mask: " << t << " ms" << std::endl; @@ -415,7 +415,7 @@ int main(int argc, const char **argv) // CLAHE vpImage I_clahe; t = vpTime::measureTimeMs(); - VISP_IMGPROC_NAMESPACE::clahe(I, I_clahe, 50); + VISP_NAMESPACE_NAME::clahe(I, I_clahe, 50); t = vpTime::measureTimeMs() - t; std::cout << "Time to do grayscale CLAHE: " << t << " ms" << std::endl; diff --git a/tutorial/imgproc/autothreshold/tutorial-autothreshold.cpp b/tutorial/imgproc/autothreshold/tutorial-autothreshold.cpp index 1c5b0072b0..3ac894922d 100644 --- a/tutorial/imgproc/autothreshold/tutorial-autothreshold.cpp +++ b/tutorial/imgproc/autothreshold/tutorial-autothreshold.cpp @@ -56,37 +56,37 @@ int main(int argc, const char **argv) //! [Huang] vpImage I_huang = I; - VISP_IMGPROC_NAMESPACE::autoThreshold(I_huang, VISP_IMGPROC_NAMESPACE::AUTO_THRESHOLD_HUANG); + VISP_NAMESPACE_NAME::autoThreshold(I_huang, VISP_NAMESPACE_NAME::AUTO_THRESHOLD_HUANG); //! [Huang] I_res.insert(I_huang, vpImagePoint()); //! [Intermodes] vpImage I_intermodes = I; - VISP_IMGPROC_NAMESPACE::autoThreshold(I_intermodes, VISP_IMGPROC_NAMESPACE::AUTO_THRESHOLD_INTERMODES); + VISP_NAMESPACE_NAME::autoThreshold(I_intermodes, VISP_NAMESPACE_NAME::AUTO_THRESHOLD_INTERMODES); //! [Intermodes] I_res.insert(I_intermodes, vpImagePoint(0, I.getWidth())); //! [IsoData] vpImage I_isodata = I; - VISP_IMGPROC_NAMESPACE::autoThreshold(I_isodata, VISP_IMGPROC_NAMESPACE::AUTO_THRESHOLD_ISODATA); + VISP_NAMESPACE_NAME::autoThreshold(I_isodata, VISP_NAMESPACE_NAME::AUTO_THRESHOLD_ISODATA); //! [IsoData] I_res.insert(I_isodata, vpImagePoint(0, 2 * I.getWidth())); //! [Mean] vpImage I_mean = I; - VISP_IMGPROC_NAMESPACE::autoThreshold(I_mean, VISP_IMGPROC_NAMESPACE::AUTO_THRESHOLD_MEAN); + VISP_NAMESPACE_NAME::autoThreshold(I_mean, VISP_NAMESPACE_NAME::AUTO_THRESHOLD_MEAN); //! [Mean] I_res.insert(I_mean, vpImagePoint(I.getHeight(), 0)); //! [Otsu] vpImage I_otsu = I; - VISP_IMGPROC_NAMESPACE::autoThreshold(I_otsu, VISP_IMGPROC_NAMESPACE::AUTO_THRESHOLD_OTSU); + VISP_NAMESPACE_NAME::autoThreshold(I_otsu, VISP_NAMESPACE_NAME::AUTO_THRESHOLD_OTSU); //! [Otsu] I_res.insert(I_otsu, vpImagePoint(I.getHeight(), 2 * I.getWidth())); //! [Triangle] vpImage I_triangle = I; - VISP_IMGPROC_NAMESPACE::autoThreshold(I_triangle, VISP_IMGPROC_NAMESPACE::AUTO_THRESHOLD_TRIANGLE); + VISP_NAMESPACE_NAME::autoThreshold(I_triangle, VISP_NAMESPACE_NAME::AUTO_THRESHOLD_TRIANGLE); //! [Triangle] I_res.insert(I_triangle, vpImagePoint(2 * I.getHeight(), 0)); diff --git a/tutorial/imgproc/brightness/tutorial-brightness-adjustment.cpp b/tutorial/imgproc/brightness/tutorial-brightness-adjustment.cpp index 509eb9d544..f9e63c37c6 100644 --- a/tutorial/imgproc/brightness/tutorial-brightness-adjustment.cpp +++ b/tutorial/imgproc/brightness/tutorial-brightness-adjustment.cpp @@ -30,8 +30,8 @@ int main(int argc, const char **argv) std::string input_filename = "Sample_low_brightness.png"; double alpha = 10.0, beta = 50.0; double gamma = 3.5; - VISP_IMGPROC_NAMESPACE::vpGammaMethod method = VISP_IMGPROC_NAMESPACE::GAMMA_MANUAL; - VISP_IMGPROC_NAMESPACE::vpGammaColorHandling colorHandling = VISP_IMGPROC_NAMESPACE::GAMMA_HSV; + VISP_NAMESPACE_NAME::vpGammaMethod method = VISP_NAMESPACE_NAME::GAMMA_MANUAL; + VISP_NAMESPACE_NAME::vpGammaColorHandling colorHandling = VISP_NAMESPACE_NAME::GAMMA_HSV; int scale = 240, scaleDiv = 3, level = 0, kernelSize = -1; double dynamic = 3.0; @@ -50,11 +50,11 @@ int main(int argc, const char **argv) } else if ((std::string(argv[i]) == "--gamma-color-handling") && ((i + 1) < argc)) { ++i; - colorHandling = VISP_IMGPROC_NAMESPACE::vpGammaColorHandlingFromString(argv[i]); + colorHandling = VISP_NAMESPACE_NAME::vpGammaColorHandlingFromString(argv[i]); } else if ((std::string(argv[i]) == "--gamma-method") && ((i + 1) < argc)) { ++i; - method = VISP_IMGPROC_NAMESPACE::vpGammaMethodFromString(argv[i]); + method = VISP_NAMESPACE_NAME::vpGammaMethodFromString(argv[i]); } else if (std::string(argv[i]) == "--scale" && i + 1 < argc) { scale = atoi(argv[i + 1]); @@ -74,16 +74,16 @@ int main(int argc, const char **argv) else if (std::string(argv[i]) == "--help" || std::string(argv[i]) == "-h") { std::cout << "Usage: " << argv[0] << " [--input ]" - " [--alpha ] [--beta ]" - " [--gamma ]" - " [--gamma-color-handling " << VISP_IMGPROC_NAMESPACE::vpGammaColorHandlingList() << "]" - " [--gamma-method " << VISP_IMGPROC_NAMESPACE::vpGammaMethodList() << "]" - " [--scale [--scaleDiv for " - "VISP_IMGPROC_NAMESPACE::retinex()]" - " [--level [--kernelSize " - "]" - " [--dynamic ] [--help]" + " [--alpha ] [--beta ]" + " [--gamma ]" + " [--gamma-color-handling " << VISP_NAMESPACE_NAME::vpGammaColorHandlingList() << "]" + " [--gamma-method " << VISP_NAMESPACE_NAME::vpGammaMethodList() << "]" + " [--scale [--scaleDiv for " + "VISP_NAMESPACE_NAME::retinex()]" + " [--level [--kernelSize " + "]" + " [--dynamic ] [--help]" << std::endl; return EXIT_SUCCESS; } @@ -111,7 +111,7 @@ int main(int argc, const char **argv) //! [Brightness contrast adjustment] vpImage I_color_adjust; - VISP_IMGPROC_NAMESPACE::adjust(I_color, I_color_adjust, alpha, beta); + VISP_NAMESPACE_NAME::adjust(I_color, I_color_adjust, alpha, beta); //! [Brightness contrast adjustment] I_color_res.insert(I_color_adjust, vpImagePoint(0, I_color.getWidth())); std::stringstream ss; @@ -124,19 +124,19 @@ int main(int argc, const char **argv) vpDisplay::getClick(I_color_res); //! [Gamma correction] - if (method != VISP_IMGPROC_NAMESPACE::GAMMA_MANUAL) { + if (method != VISP_NAMESPACE_NAME::GAMMA_MANUAL) { // If the user wants to use an automatic method, the gamma factor must be negative. gamma = -1.; } if (gamma > 0.) { // If the user wants to set a constant user-defined gamma factor, the method must be set to manual. - method = VISP_IMGPROC_NAMESPACE::GAMMA_MANUAL; + method = VISP_NAMESPACE_NAME::GAMMA_MANUAL; } vpImage I_gray_gamma_correction; - VISP_IMGPROC_NAMESPACE::gammaCorrection(I_gray, I_gray_gamma_correction, static_cast(gamma), method); + VISP_NAMESPACE_NAME::gammaCorrection(I_gray, I_gray_gamma_correction, static_cast(gamma), method); vpImage I_color_gamma_correction; - VISP_IMGPROC_NAMESPACE::gammaCorrection(I_color, I_color_gamma_correction, static_cast(gamma), colorHandling, method); + VISP_NAMESPACE_NAME::gammaCorrection(I_color, I_color_gamma_correction, static_cast(gamma), colorHandling, method); //! [Gamma correction] I_gray_res.insert(I_gray_gamma_correction, vpImagePoint(0, I_gray.getWidth())); ss.str(""); @@ -160,7 +160,7 @@ int main(int argc, const char **argv) //! [Histogram equalization] vpImage I_color_equalize_histogram; - VISP_IMGPROC_NAMESPACE::equalizeHistogram(I_color, I_color_equalize_histogram); + VISP_NAMESPACE_NAME::equalizeHistogram(I_color, I_color_equalize_histogram); //! [Histogram equalization] I_color_res.insert(I_color_equalize_histogram, vpImagePoint(0, I_color.getWidth())); ss.str(""); @@ -174,7 +174,7 @@ int main(int argc, const char **argv) //! [Retinex] vpImage I_color_retinex; - VISP_IMGPROC_NAMESPACE::retinex(I_color, I_color_retinex, scale, scaleDiv, level, dynamic, kernelSize); + VISP_NAMESPACE_NAME::retinex(I_color, I_color_retinex, scale, scaleDiv, level, dynamic, kernelSize); //! [Retinex] I_color_res.insert(I_color_retinex, vpImagePoint(0, I_color.getWidth())); diff --git a/tutorial/imgproc/connected-components/tutorial-connected-components.cpp b/tutorial/imgproc/connected-components/tutorial-connected-components.cpp index 892bae7d73..d903c52eaa 100644 --- a/tutorial/imgproc/connected-components/tutorial-connected-components.cpp +++ b/tutorial/imgproc/connected-components/tutorial-connected-components.cpp @@ -61,7 +61,7 @@ int main(int argc, const char **argv) //! [Connected components] vpImage labels; int nbComponents = 0; - VISP_IMGPROC_NAMESPACE::connectedComponents(I, labels, nbComponents, connexity); + VISP_NAMESPACE_NAME::connectedComponents(I, labels, nbComponents, connexity); std::cout << "nbComponents=" << nbComponents << std::endl; //! [Connected components] diff --git a/tutorial/imgproc/contour/tutorial-contour.cpp b/tutorial/imgproc/contour/tutorial-contour.cpp index 44b93872b4..0ba278de63 100644 --- a/tutorial/imgproc/contour/tutorial-contour.cpp +++ b/tutorial/imgproc/contour/tutorial-contour.cpp @@ -21,16 +21,16 @@ using namespace VISP_NAMESPACE_NAME; namespace { //! [Print contours hierarchy func] -void displayContourInfo(const VISP_CONTOURS_NAMESPACE::vpContour &contour, int level) +void displayContourInfo(const VISP_NAMESPACE_NAME::vpContour &contour, int level) { std::cout << "\nContour:" << std::endl; std::cout << "\tlevel: " << level << std::endl; - std::cout << "\tcontour type: " << (contour.m_contourType == VISP_CONTOURS_NAMESPACE::CONTOUR_OUTER ? "outer contour" : "hole contour") + std::cout << "\tcontour type: " << (contour.m_contourType == VISP_NAMESPACE_NAME::CONTOUR_OUTER ? "outer contour" : "hole contour") << std::endl; std::cout << "\tcontour size: " << contour.m_points.size() << std::endl; std::cout << "\tnb children: " << contour.m_children.size() << std::endl; - for (std::vector::const_iterator it = contour.m_children.begin(); it != contour.m_children.end(); + for (std::vector::const_iterator it = contour.m_children.begin(); it != contour.m_children.end(); ++it) { displayContourInfo(**it, level + 1); } @@ -38,13 +38,13 @@ void displayContourInfo(const VISP_CONTOURS_NAMESPACE::vpContour &contour, int l //! [Print contours hierarchy func] //! [Draw contours hierarchical func] -void drawContoursTree(vpImage &I, const VISP_CONTOURS_NAMESPACE::vpContour &contour) +void drawContoursTree(vpImage &I, const VISP_NAMESPACE_NAME::vpContour &contour) { std::vector > contours; contours.push_back(contour.m_points); - VISP_CONTOURS_NAMESPACE::drawContours(I, contours, contour.m_contourType == VISP_CONTOURS_NAMESPACE::CONTOUR_OUTER ? vpColor::red : vpColor::green); + VISP_NAMESPACE_NAME::drawContours(I, contours, contour.m_contourType == VISP_NAMESPACE_NAME::CONTOUR_OUTER ? vpColor::red : vpColor::green); - for (std::vector::const_iterator it = contour.m_children.begin(); it != contour.m_children.end(); + for (std::vector::const_iterator it = contour.m_children.begin(); it != contour.m_children.end(); ++it) { drawContoursTree(I, **it); } @@ -61,7 +61,7 @@ int main(int argc, const char **argv) //! std::string input_filename = "grid36-03.pgm"; bool white_foreground = false; - VISP_CONTOURS_NAMESPACE::vpContourRetrievalType extraction_method = VISP_CONTOURS_NAMESPACE::CONTOUR_RETR_TREE; + VISP_NAMESPACE_NAME::vpContourRetrievalType extraction_method = VISP_NAMESPACE_NAME::CONTOUR_RETR_TREE; for (int i = 1; i < argc; i++) { if (std::string(argv[i]) == "--input" && i + 1 < argc) { @@ -71,7 +71,7 @@ int main(int argc, const char **argv) white_foreground = true; } else if (std::string(argv[i]) == "--method" && i + 1 < argc) { - extraction_method = (VISP_CONTOURS_NAMESPACE::vpContourRetrievalType)atoi(argv[i + 1]); + extraction_method = (VISP_NAMESPACE_NAME::vpContourRetrievalType)atoi(argv[i + 1]); } else if (std::string(argv[i]) == "--help" || std::string(argv[i]) == "-h") { std::cout << "Usage: " << argv[0] @@ -103,20 +103,20 @@ int main(int argc, const char **argv) d2.init(I_draw_contours, I_bin.getWidth(), 10, "Contours"); //! [Otsu] - VISP_CONTOURS_NAMESPACE::autoThreshold(I, VISP_CONTOURS_NAMESPACE::AUTO_THRESHOLD_OTSU, white_foreground ? 0 : 1, white_foreground ? 1 : 0); + VISP_NAMESPACE_NAME::autoThreshold(I, VISP_NAMESPACE_NAME::AUTO_THRESHOLD_OTSU, white_foreground ? 0 : 1, white_foreground ? 1 : 0); //! [Otsu] for (unsigned int i = 0; i < I_bin.getSize(); i++) { I_bin.bitmap[i] = 255 * I.bitmap[i]; } //! [Find contours] - VISP_CONTOURS_NAMESPACE::vpContour vp_contours; + VISP_NAMESPACE_NAME::vpContour vp_contours; std::vector > contours; - VISP_CONTOURS_NAMESPACE::findContours(I, vp_contours, contours, extraction_method); + VISP_NAMESPACE_NAME::findContours(I, vp_contours, contours, extraction_method); //! [Find contours] //! [Draw contours] - VISP_CONTOURS_NAMESPACE::drawContours(I_draw_contours, contours, vpColor::red); + VISP_NAMESPACE_NAME::drawContours(I_draw_contours, contours, vpColor::red); //! [Draw contours] vpDisplay::display(I_bin); diff --git a/tutorial/imgproc/contrast-sharpening/tutorial-contrast-sharpening.cpp b/tutorial/imgproc/contrast-sharpening/tutorial-contrast-sharpening.cpp index 097c3fbd81..97a568b551 100644 --- a/tutorial/imgproc/contrast-sharpening/tutorial-contrast-sharpening.cpp +++ b/tutorial/imgproc/contrast-sharpening/tutorial-contrast-sharpening.cpp @@ -80,31 +80,31 @@ int main(int argc, const char **argv) //! [Stretch contrast] vpImage I_stretch; - VISP_IMGPROC_NAMESPACE::stretchContrast(I_color, I_stretch); + VISP_NAMESPACE_NAME::stretchContrast(I_color, I_stretch); //! [Stretch contrast] d2.init(I_stretch, I_color.getWidth(), 10, "Stretch contrast"); //! [Stretch contrast HSV] vpImage I_stretch_hsv; - VISP_IMGPROC_NAMESPACE::stretchContrastHSV(I_color, I_stretch_hsv); + VISP_NAMESPACE_NAME::stretchContrastHSV(I_color, I_stretch_hsv); //! [Stretch contrast HSV] d3.init(I_stretch_hsv, 0, I_color.getHeight() + 80, "Stretch contrast HSV"); //! [Histogram equalization] vpImage I_hist_eq; - VISP_IMGPROC_NAMESPACE::equalizeHistogram(I_color, I_hist_eq); + VISP_NAMESPACE_NAME::equalizeHistogram(I_color, I_hist_eq); //! [Histogram equalization] d4.init(I_hist_eq, I_color.getWidth(), I_color.getHeight() + 80, "Histogram equalization"); //! [CLAHE] vpImage I_clahe; - VISP_IMGPROC_NAMESPACE::clahe(I_color, I_clahe, blockRadius, bins, slope); + VISP_NAMESPACE_NAME::clahe(I_color, I_clahe, blockRadius, bins, slope); //! [CLAHE] d5.init(I_clahe, 0, 2 * I_color.getHeight() + 80, "CLAHE"); //! [Unsharp mask] vpImage I_unsharp; - VISP_IMGPROC_NAMESPACE::unsharpMask(I_clahe, I_unsharp, sigma, weight); + VISP_NAMESPACE_NAME::unsharpMask(I_clahe, I_unsharp, sigma, weight); //! [Unsharp mask] d6.init(I_unsharp, I_color.getWidth(), 2 * I_color.getHeight() + 80, "Unsharp mask"); diff --git a/tutorial/imgproc/count-coins/tutorial-count-coins.cpp b/tutorial/imgproc/count-coins/tutorial-count-coins.cpp index e84b640fab..8437818eb7 100644 --- a/tutorial/imgproc/count-coins/tutorial-count-coins.cpp +++ b/tutorial/imgproc/count-coins/tutorial-count-coins.cpp @@ -27,7 +27,7 @@ int main(int argc, char *argv[]) #endif std::string input_filename = "coins1.jpg"; - VISP_IMGPROC_NAMESPACE::vpAutoThresholdMethod method = VISP_IMGPROC_NAMESPACE::AUTO_THRESHOLD_OTSU; + VISP_NAMESPACE_NAME::vpAutoThresholdMethod method = VISP_NAMESPACE_NAME::AUTO_THRESHOLD_OTSU; bool white_foreground = false; for (int i = 1; i < argc; i++) { @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) input_filename = std::string(argv[i + 1]); } else if (std::string(argv[i]) == "--method" && i + 1 < argc) { - method = (VISP_IMGPROC_NAMESPACE::vpAutoThresholdMethod)atoi(argv[i + 1]); + method = static_cast(atoi(argv[i + 1])); } else if (std::string(argv[i]) == "--white_foreground") { white_foreground = true; @@ -69,13 +69,13 @@ int main(int argc, char *argv[]) vpImage I_bin, I_fill; //! [Binarisation] I_bin = I; - VISP_IMGPROC_NAMESPACE::autoThreshold(I_bin, method, white_foreground ? 0 : 255, white_foreground ? 255 : 0); + VISP_NAMESPACE_NAME::autoThreshold(I_bin, method, white_foreground ? 0 : 255, white_foreground ? 255 : 0); //! [Binarisation] d2.init(I_bin, I.getWidth(), 0, "Binarisation"); //! [Fill holes] I_fill = I_bin; - VISP_IMGPROC_NAMESPACE::fillHoles(I_fill); + VISP_NAMESPACE_NAME::fillHoles(I_fill); //! [Fill holes] d3.init(I_fill, 0, I.getHeight() + 80, "Fill holes"); @@ -97,14 +97,14 @@ int main(int argc, char *argv[]) for (unsigned int cpt = 0; cpt < I_close.getSize(); cpt++) I_contours.bitmap[cpt] = I_close.bitmap[cpt] ? 1 : 0; - VISP_CONTOURS_NAMESPACE::vpContour vp_contours; + VISP_NAMESPACE_NAME::vpContour vp_contours; std::vector > contours; - VISP_CONTOURS_NAMESPACE::findContours(I_contours, vp_contours, contours, VISP_CONTOURS_NAMESPACE::CONTOUR_RETR_EXTERNAL); + VISP_NAMESPACE_NAME::findContours(I_contours, vp_contours, contours, VISP_NAMESPACE_NAME::CONTOUR_RETR_EXTERNAL); //! [Find contours] //! [Draw contours] vpImage I_draw_contours(I_contours.getHeight(), I_contours.getWidth(), vpRGBa()); - VISP_CONTOURS_NAMESPACE::drawContours(I_draw_contours, contours, vpColor::red); + VISP_NAMESPACE_NAME::drawContours(I_draw_contours, contours, vpColor::red); //! [Draw contours] d5.init(I_draw_contours, 0, 2 * I.getHeight() + 80, "Contours"); diff --git a/tutorial/imgproc/flood-fill/tutorial-flood-fill.cpp b/tutorial/imgproc/flood-fill/tutorial-flood-fill.cpp index 87e2bf4833..4cc1ff452b 100644 --- a/tutorial/imgproc/flood-fill/tutorial-flood-fill.cpp +++ b/tutorial/imgproc/flood-fill/tutorial-flood-fill.cpp @@ -256,7 +256,7 @@ int main() switch (button) { case vpMouseButton::button1: //! [Flood fill] - VISP_IMGPROC_NAMESPACE::floodFill(mask, ip, 0, 255, vpImageMorphology::CONNEXITY_4); + VISP_NAMESPACE_NAME::floodFill(mask, ip, 0, 255, vpImageMorphology::CONNEXITY_4); //! [Flood fill] //! [Bucket fill]