From 8882f2b9a2dba53a4d80aa225f990acb4fa5a7e6 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Mon, 11 Sep 2023 11:59:36 +0200 Subject: [PATCH] Use 2 hex digits per version part --- CMakeLists.txt | 2 +- .../src/mainwindow.cpp | 6 +-- apps/mrpt-performance/perf-main.cpp | 6 +-- cmakemodules/UtilsMacros.cmake | 49 ++++++------------- cmakemodules/script_create_version_h.cmake | 31 ++---------- doc/source/doxygen-docs/changelog.md | 2 + .../src/CCascadeClassifierDetection.cpp | 10 ++-- .../mrpt/3rdparty/do_opencv_includes.h | 6 +-- libs/img/src/CImage.cpp | 2 +- libs/vision/src/CFeatureExtraction_AKAZE.cpp | 8 +-- libs/vision/src/CFeatureExtraction_FAST.cpp | 2 +- libs/vision/src/CFeatureExtraction_ORB.cpp | 4 +- libs/vision/src/CFeatureExtraction_SIFT.cpp | 12 ++--- libs/vision/src/CFeatureExtraction_SURF.cpp | 6 +-- .../src/CFeatureExtraction_logPolarImg.cpp | 4 +- .../src/CFeatureExtraction_polarImg.cpp | 4 +- libs/vision/src/pnp/pnp_unittest.cpp | 2 +- parse-files/version.h.in | 2 +- 18 files changed, 58 insertions(+), 100 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f11be5de4..6bcfbe1511 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ # For compiling instructions for all compilers and platforms, see # https://docs.mrpt.org/reference/latest/compiling.html # -# 2007-2021, Jose Luis Blanco +# 2007-2023, Jose Luis Blanco # ---------------------------------------------------------------------------- # ------------------------- diff --git a/apps/benchmarking-image-features/src/mainwindow.cpp b/apps/benchmarking-image-features/src/mainwindow.cpp index 30a467c114..d654ffd92a 100644 --- a/apps/benchmarking-image-features/src/mainwindow.cpp +++ b/apps/benchmarking-image-features/src/mainwindow.cpp @@ -187,7 +187,7 @@ void MainWindow::on_button_generate_clicked() xData.at(i) = i; yData.at(i) = distances(i, 0); } -#if MRPT_OPENCV_VERSION_NUM >= 0x330 +#if MRPT_OPENCV_VERSION_NUM >= 0x030300 plot = plot::Plot2d::create(xData, yData); #else plot = plot::createPlot2d(xData, yData); @@ -384,7 +384,7 @@ void MainWindow::on_button_generate_clicked() min_y = -1; } -#if MRPT_OPENCV_VERSION_NUM >= 0x330 +#if MRPT_OPENCV_VERSION_NUM >= 0x030300 plot = plot::Plot2d::create(xData, yData); #else plot = plot::createPlot2d(xData, yData); @@ -439,7 +439,7 @@ void MainWindow::on_button_generate_clicked() else yData.at(i) = v2_surf.at(i); } -#if MRPT_OPENCV_VERSION_NUM >= 0x330 +#if MRPT_OPENCV_VERSION_NUM >= 0x030300 plot = plot::Plot2d::create(xData, yData); #else plot = plot::createPlot2d(xData, yData); diff --git a/apps/mrpt-performance/perf-main.cpp b/apps/mrpt-performance/perf-main.cpp index 913a4a8f5f..95549e1672 100644 --- a/apps/mrpt-performance/perf-main.cpp +++ b/apps/mrpt-performance/perf-main.cpp @@ -269,9 +269,9 @@ int main(int argc, char** argv) const string fil_name = PERF_DATA_DIR + mrpt::format("/perf-results-%i.%i.%i%s-%s-%ibit.dat", - int((MRPT_VERSION >> 8) & 0x0F), - int((MRPT_VERSION >> 4) & 0x0F), - int((MRPT_VERSION >> 0) & 0x0F), version_postfix, + int((MRPT_VERSION >> 16) & 0xFF), + int((MRPT_VERSION >> 8) & 0xFF), + int((MRPT_VERSION >> 0) & 0xFF), version_postfix, compiler_name, int(MRPT_WORD_SIZE)); cout << "Saving perf-data to: " << fil_name << endl; CFileOutputStream f(fil_name); diff --git a/cmakemodules/UtilsMacros.cmake b/cmakemodules/UtilsMacros.cmake index 247f03ae87..d94747b1e1 100644 --- a/cmakemodules/UtilsMacros.cmake +++ b/cmakemodules/UtilsMacros.cmake @@ -57,42 +57,21 @@ macro(pkgconfig_parse _FLAGS _OUT_PREFIX) endforeach(str) endmacro(pkgconfig_parse ) -# Convert a decimal value [0,15] to hexadecimal -# From: http://stackoverflow.com/questions/26182289/convert-from-decimal-to-hexadecimal-in-cmake -macro(DECCHAR2HEX VAR VAL) - if (${VAL} LESS 10) - set(${VAR} ${VAL}) - elseif(${VAL} EQUAL 10) - set(${VAR} "A") - elseif(${VAL} EQUAL 11) - set(${VAR} "B") - elseif(${VAL} EQUAL 12) - set(${VAR} "C") - elseif(${VAL} EQUAL 13) - set(${VAR} "D") - elseif(${VAL} EQUAL 14) - set(${VAR} "E") - elseif(${VAL} EQUAL 15) - set(${VAR} "F") - else(${VAL} LESS 10) - message(FATAL_ERROR "Invalid format for hexidecimal character") - endif(${VAL} LESS 10) -endmacro(DECCHAR2HEX) - -# Converts a version like "1.2.3" into a string "0x123" +# Converts a version like "1.2.3" into a string "0x10203", +# or "3.4.19" into "0x30413". # Usage: VERSION_TO_HEXADECIMAL(TARGET_VAR "1.2.3") -macro(VERSION_TO_HEXADECIMAL OUT_VAR IN_VERSION) - string(REGEX MATCHALL "[0-9]+" VERSION_PARTS "${IN_VERSION}") - list(GET VERSION_PARTS 0 VERSION_NUMBER_MAJOR) - list(GET VERSION_PARTS 1 VERSION_NUMBER_MINOR) - list(GET VERSION_PARTS 2 VERSION_NUMBER_PATCH) - # Convert each part to hex: - DECCHAR2HEX(VERSION_NUMBER_MAJOR_HEX ${VERSION_NUMBER_MAJOR}) - DECCHAR2HEX(VERSION_NUMBER_MINOR_HEX ${VERSION_NUMBER_MINOR}) - DECCHAR2HEX(VERSION_NUMBER_PATCH_HEX ${VERSION_NUMBER_PATCH}) - # Concat version string: - set(${OUT_VAR} "0x${VERSION_NUMBER_MAJOR_HEX}${VERSION_NUMBER_MINOR_HEX}${VERSION_NUMBER_PATCH_HEX}") -endmacro(VERSION_TO_HEXADECIMAL) +macro(VERSION_TO_HEXADECIMAL OUT_VAR IN_VERSION) + string(REGEX MATCHALL "[0-9]+" VERSION_PARTS "${IN_VERSION}") + list(GET VERSION_PARTS 0 VERSION_NUMBER_MAJOR) + list(GET VERSION_PARTS 1 VERSION_NUMBER_MINOR) + list(GET VERSION_PARTS 2 VERSION_NUMBER_PATCH) + + # Convert each part to hex: + math(EXPR ${OUT_VAR} + "(${VERSION_NUMBER_MAJOR} << 16) + \ + (${VERSION_NUMBER_MINOR} << 8) + \ + (${VERSION_NUMBER_PATCH})" OUTPUT_FORMAT HEXADECIMAL ) +endmacro() # GOOD & BAD are single strings, INPUT is a list wrapped in string diff --git a/cmakemodules/script_create_version_h.cmake b/cmakemodules/script_create_version_h.cmake index fc2d332625..8006d02d17 100644 --- a/cmakemodules/script_create_version_h.cmake +++ b/cmakemodules/script_create_version_h.cmake @@ -5,31 +5,8 @@ # ---------------------------------------------------------------------------- set(CMAKE_MRPT_COMPLETE_NAME "MRPT ${CMAKE_MRPT_VERSION_NUMBER_MAJOR}.${CMAKE_MRPT_VERSION_NUMBER_MINOR}.${CMAKE_MRPT_VERSION_NUMBER_PATCH}") -# There is no built-in support for dec to hex in cmake, sigh... -function(digit_to_hex DIGIT RET) - if (NOT ${DIGIT} GREATER 9) - set(${RET} ${DIGIT} PARENT_SCOPE) - elseif (${DIGIT} MATCHES "10") - set(${RET} "A" PARENT_SCOPE) - elseif (${DIGIT} MATCHES "11") - set(${RET} "B" PARENT_SCOPE) - elseif (${DIGIT} MATCHES "12") - set(${RET} "C" PARENT_SCOPE) - elseif (${DIGIT} MATCHES "13") - set(${RET} "D" PARENT_SCOPE) - elseif (${DIGIT} MATCHES "14") - set(${RET} "E" PARENT_SCOPE) - elseif (${DIGIT} MATCHES "15") - set(${RET} "F" PARENT_SCOPE) - endif() -endfunction() - -digit_to_hex(${CMAKE_MRPT_VERSION_NUMBER_MAJOR} CMAKE_MRPT_VERSION_NUMBER_MAJOR_HEX) -digit_to_hex(${CMAKE_MRPT_VERSION_NUMBER_MINOR} CMAKE_MRPT_VERSION_NUMBER_MINOR_HEX) -digit_to_hex(${CMAKE_MRPT_VERSION_NUMBER_PATCH} CMAKE_MRPT_VERSION_NUMBER_PATCH_HEX) - -# Build a three digits version code, eg. 0.5.1 -> 051, 1.2.0 -> 120 -set(CMAKE_MRPT_VERSION_CODE "0x${CMAKE_MRPT_VERSION_NUMBER_MAJOR_HEX}${CMAKE_MRPT_VERSION_NUMBER_MINOR_HEX}${CMAKE_MRPT_VERSION_NUMBER_PATCH_HEX}") +# Build a six digits hex version code, eg. 1.2.0 -> 0x010200 +VERSION_TO_HEXADECIMAL(CMAKE_MRPT_VERSION_CODE ${CMAKE_MRPT_COMPLETE_NAME}) # SOURCE_DATE_EPOCH: See Specs in https://reproducible-builds.org/specs/source-date-epoch/ # Take its value from: @@ -80,6 +57,6 @@ if (WIN32) ${MRPT_BINARY_DIR}/version.rc @ONLY) set(MRPT_VERSION_RC_FILE "${MRPT_BINARY_DIR}/version.rc") -else(WIN32) +else() set(MRPT_VERSION_RC_FILE "") -endif (WIN32) +endif() diff --git a/doc/source/doxygen-docs/changelog.md b/doc/source/doxygen-docs/changelog.md index 0ba13b8ed4..820e710c24 100644 --- a/doc/source/doxygen-docs/changelog.md +++ b/doc/source/doxygen-docs/changelog.md @@ -1,6 +1,8 @@ \page changelog Change Log # Version 2.10.2: UNRELEASED +- Build system: + - MRPT and OpenCV versions were until now exposed as macros with 3 hexadecimal digits (e.g. `2.4.0`->`0x240`), with a clear limitation of versions greater than 15. Now, both symbols `MRPT_VERSION` and `MRPT_OPENCV_VERSION_NUM` use TWO hexadecimal digits per version part, like: `2.10.2` -> `0x010A02`, which is much more general and safe for the future. For backwards compatibility, just make sure your user code only uses `MRPT_VERSION>=xxx` or `MRPT_VERSION>xxx` comparisons, instead of less-than comparisons (Fixes [issue #1285](https://github.com/MRPT/mrpt/issues/1285)). - Changes in apps: - rawlog-edit: Add `--select-label` optional filter to command `--remap-timestamps`. - Changes in libraries: diff --git a/libs/detectors/src/CCascadeClassifierDetection.cpp b/libs/detectors/src/CCascadeClassifierDetection.cpp index eb5f672694..3e8372996f 100644 --- a/libs/detectors/src/CCascadeClassifierDetection.cpp +++ b/libs/detectors/src/CCascadeClassifierDetection.cpp @@ -24,7 +24,7 @@ using namespace mrpt::obs; using namespace mrpt::img; using namespace std; -#if MRPT_HAS_OPENCV && MRPT_OPENCV_VERSION_NUM >= 0x200 +#if MRPT_HAS_OPENCV using namespace cv; #endif @@ -38,7 +38,7 @@ using namespace cv; CCascadeClassifierDetection::CCascadeClassifierDetection() { // Check if MRPT is using OpenCV -#if !MRPT_HAS_OPENCV || MRPT_OPENCV_VERSION_NUM < 0x200 +#if !MRPT_HAS_OPENCV THROW_EXCEPTION( "CCascadeClassifierDetection class requires MRPT built against OpenCV " ">=2.0"); @@ -51,7 +51,7 @@ CCascadeClassifierDetection::CCascadeClassifierDetection() CCascadeClassifierDetection::~CCascadeClassifierDetection() { -#if MRPT_HAS_OPENCV && MRPT_OPENCV_VERSION_NUM >= 0x200 +#if MRPT_HAS_OPENCV delete CASCADE; #endif } @@ -63,7 +63,7 @@ CCascadeClassifierDetection::~CCascadeClassifierDetection() void CCascadeClassifierDetection::init( const mrpt::config::CConfigFileBase& config) { -#if MRPT_HAS_OPENCV && MRPT_OPENCV_VERSION_NUM >= 0x200 +#if MRPT_HAS_OPENCV // load configuration values m_options.cascadeFileName = config.read_string("CascadeClassifier", "cascadeFilename", ""); @@ -91,7 +91,7 @@ void CCascadeClassifierDetection::init( void CCascadeClassifierDetection::detectObjects_Impl( const CObservation& obs, vector_detectable_object& detected) { -#if MRPT_HAS_OPENCV && MRPT_OPENCV_VERSION_NUM >= 0x200 +#if MRPT_HAS_OPENCV // Obtain image from generic observation const mrpt::img::CImage* img = nullptr; diff --git a/libs/img/include/mrpt/3rdparty/do_opencv_includes.h b/libs/img/include/mrpt/3rdparty/do_opencv_includes.h index 4eb26dcdad..6138a067ee 100644 --- a/libs/img/include/mrpt/3rdparty/do_opencv_includes.h +++ b/libs/img/include/mrpt/3rdparty/do_opencv_includes.h @@ -18,14 +18,14 @@ // OPENCV HEADERS #define CV_NO_CVV_IMAGE // Avoid CImage name crash -#if MRPT_OPENCV_VERSION_NUM < 0x240 +#if MRPT_OPENCV_VERSION_NUM < 0x020400 #error "MRPT requires OpenCV 2.4.0 or newer" #endif #include // C++ API: -#if MRPT_OPENCV_VERSION_NUM >= 0x300 +#if MRPT_OPENCV_VERSION_NUM >= 0x030000 // C++ API - opencv >=3 #include #include @@ -72,7 +72,7 @@ #endif // Backwards compatible macro: -#if MRPT_OPENCV_VERSION_NUM < 0x344 +#if MRPT_OPENCV_VERSION_NUM < 0x030404 #define cvIplImage(X) (X) #endif diff --git a/libs/img/src/CImage.cpp b/libs/img/src/CImage.cpp index 440a6632de..d6d94cae83 100644 --- a/libs/img/src/CImage.cpp +++ b/libs/img/src/CImage.cpp @@ -2223,7 +2223,7 @@ void CImage::getAsIplImage(IplImage* dest) const #if MRPT_HAS_OPENCV makeSureImageIsLoaded(); -#if MRPT_OPENCV_VERSION_NUM < 0x300 +#if MRPT_OPENCV_VERSION_NUM < 0x030000 ASSERT_(dest != nullptr); *dest = cvIplImage(m_impl->img); #else diff --git a/libs/vision/src/CFeatureExtraction_AKAZE.cpp b/libs/vision/src/CFeatureExtraction_AKAZE.cpp index 46793f2aba..6d25435922 100644 --- a/libs/vision/src/CFeatureExtraction_AKAZE.cpp +++ b/libs/vision/src/CFeatureExtraction_AKAZE.cpp @@ -37,7 +37,7 @@ void CFeatureExtraction::extractFeaturesAKAZE( mrpt::system::CTimeLoggerEntry tle(profiler, "extractFeaturesAKAZE"); #if MRPT_HAS_OPENCV -#if MRPT_OPENCV_VERSION_NUM < 0x300 +#if MRPT_OPENCV_VERSION_NUM < 0x030000 THROW_EXCEPTION("This function requires OpenCV > 3.0.0"); #else @@ -46,11 +46,11 @@ void CFeatureExtraction::extractFeaturesAKAZE( // Make sure we operate on a gray-scale version of the image: const CImage inImg_gray(inImg, FAST_REF_OR_CONVERT_TO_GRAY); -#if MRPT_OPENCV_VERSION_NUM >= 0x300 +#if MRPT_OPENCV_VERSION_NUM >= 0x030000 Mat theImg = inImg_gray.asCvMat(SHALLOW_COPY); Ptr akaze = AKAZE::create( -#if MRPT_OPENCV_VERSION_NUM >= 0x400 +#if MRPT_OPENCV_VERSION_NUM >= 0x040000 static_cast( options.AKAZEOptions.descriptor_type), #else @@ -60,7 +60,7 @@ void CFeatureExtraction::extractFeaturesAKAZE( options.AKAZEOptions.descriptor_channels, options.AKAZEOptions.threshold, options.AKAZEOptions.nOctaves, options.AKAZEOptions.nOctaveLayers, -#if MRPT_OPENCV_VERSION_NUM >= 0x400 +#if MRPT_OPENCV_VERSION_NUM >= 0x040000 static_cast(options.AKAZEOptions.diffusivity) #else options.AKAZEOptions.diffusivity diff --git a/libs/vision/src/CFeatureExtraction_FAST.cpp b/libs/vision/src/CFeatureExtraction_FAST.cpp index 7ef357f6ce..5957de9cce 100644 --- a/libs/vision/src/CFeatureExtraction_FAST.cpp +++ b/libs/vision/src/CFeatureExtraction_FAST.cpp @@ -39,7 +39,7 @@ void CFeatureExtraction::extractFeaturesFAST( const CImage inImg_gray(inImg, FAST_REF_OR_CONVERT_TO_GRAY); const Mat theImg = inImg_gray.asCvMat(SHALLOW_COPY); -#if MRPT_OPENCV_VERSION_NUM < 0x300 +#if MRPT_OPENCV_VERSION_NUM < 0x030000 FastFeatureDetector fastDetector( options.FASTOptions.threshold, options.FASTOptions.nonmax_suppression); fastDetector.detect(theImg, cv_feats); diff --git a/libs/vision/src/CFeatureExtraction_ORB.cpp b/libs/vision/src/CFeatureExtraction_ORB.cpp index e81c048984..77efcd4383 100644 --- a/libs/vision/src/CFeatureExtraction_ORB.cpp +++ b/libs/vision/src/CFeatureExtraction_ORB.cpp @@ -55,7 +55,7 @@ void CFeatureExtraction::extractFeaturesORB( // The detector and descriptor profiler.enter("extractFeaturesORB.openCV_detectAndCompute"); -#if MRPT_OPENCV_VERSION_NUM < 0x300 +#if MRPT_OPENCV_VERSION_NUM < 0x030000 Ptr orb = Algorithm::create("Feature2D.ORB"); orb->operator()(cvImg, Mat(), cv_feats, cv_descs, use_precomputed_feats); #else @@ -250,7 +250,7 @@ void CFeatureExtraction::internal_computeORBDescriptors( const Mat& cvImg = inImg_gray.asCvMatRef(); Mat cv_descs; -#if MRPT_OPENCV_VERSION_NUM < 0x300 +#if MRPT_OPENCV_VERSION_NUM < 0x030000 Ptr orb = Algorithm::create("Feature2D.ORB"); orb->operator()( cvImg, cv::noArray(), cv_feats, cv_descs, diff --git a/libs/vision/src/CFeatureExtraction_SIFT.cpp b/libs/vision/src/CFeatureExtraction_SIFT.cpp index b7bcbaedac..103277f59c 100644 --- a/libs/vision/src/CFeatureExtraction_SIFT.cpp +++ b/libs/vision/src/CFeatureExtraction_SIFT.cpp @@ -18,7 +18,7 @@ #include #endif #ifdef HAVE_OPENCV_FEATURES2D -#if MRPT_OPENCV_VERSION_NUM >= 0x300 +#if MRPT_OPENCV_VERSION_NUM >= 0x030000 #include #else #include @@ -71,9 +71,9 @@ void CFeatureExtraction::extractFeaturesSIFT( // in opencv 4.4 SIFT got into the main repo #if defined(HAVE_OPENCV_NONFREE) || defined(HAVE_OPENCV_XFEATURES2D) || \ - (MRPT_OPENCV_VERSION_NUM >= 0x440) + (MRPT_OPENCV_VERSION_NUM >= 0x040400) -#if MRPT_OPENCV_VERSION_NUM < 0x300 +#if MRPT_OPENCV_VERSION_NUM < 0x030000 SiftFeatureDetector SIFTDetector( options.SIFTOptions.threshold, options.SIFTOptions.edgeThreshold); @@ -84,11 +84,11 @@ void CFeatureExtraction::extractFeaturesSIFT( Mat desc; SIFTDescriptor.compute(theImg, cv_feats, desc); #else - // MRPT_OPENCV_VERSION_NUM >= 0x300 + // MRPT_OPENCV_VERSION_NUM >= 0x030000 using namespace cv; vector cv_feats; -#if MRPT_OPENCV_VERSION_NUM >= 0x440 +#if MRPT_OPENCV_VERSION_NUM >= 0x040400 using sift_t = cv::SIFT; #else using sift_t = cv::xfeatures2d::SIFT; @@ -180,7 +180,7 @@ void CFeatureExtraction::internal_computeSiftDescriptors( ASSERT_(options.SIFTOptions.implementation == OpenCV); // in opencv 4.4 SIFT got into the main repo -#if MRPT_OPENCV_VERSION_NUM >= 0x440 +#if MRPT_OPENCV_VERSION_NUM >= 0x040400 using namespace cv; vector cv_feats; diff --git a/libs/vision/src/CFeatureExtraction_SURF.cpp b/libs/vision/src/CFeatureExtraction_SURF.cpp index 21c12dd474..72cf675a63 100644 --- a/libs/vision/src/CFeatureExtraction_SURF.cpp +++ b/libs/vision/src/CFeatureExtraction_SURF.cpp @@ -33,7 +33,7 @@ using namespace std; // Was: MRPT_HAS_OPENCV_NONFREE #if defined(HAVE_OPENCV_XFEATURES2D) || \ - (MRPT_OPENCV_VERSION_NUM < 0x300 && MRPT_OPENCV_VERSION_NUM >= 0x240) + (MRPT_OPENCV_VERSION_NUM < 0x030000 && MRPT_OPENCV_VERSION_NUM >= 0x020400) #define HAVE_OPENCV_WITH_SURF 1 #else #define HAVE_OPENCV_WITH_SURF 0 @@ -56,7 +56,7 @@ void CFeatureExtraction::extractFeaturesSURF( // gb redesign start -make sure that the Algorithm::create is used only for // older openCV versions -#if MRPT_OPENCV_VERSION_NUM < 0x300 && MRPT_OPENCV_VERSION_NUM >= 0x240 +#if MRPT_OPENCV_VERSION_NUM < 0x030000 && MRPT_OPENCV_VERSION_NUM >= 0x020400 Ptr surf = Algorithm::create("Feature2D.SURF"); if (surf.empty()) @@ -181,7 +181,7 @@ void CFeatureExtraction::internal_computeSurfDescriptors( // Only computes the descriptors: // gb redesign -#if MRPT_OPENCV_VERSION_NUM < 0x300 && MRPT_OPENCV_VERSION_NUM >= 0x240 +#if MRPT_OPENCV_VERSION_NUM < 0x030000 && MRPT_OPENCV_VERSION_NUM >= 0x020400 Ptr surf = Algorithm::create("Feature2D.SURF"); if (surf.empty()) diff --git a/libs/vision/src/CFeatureExtraction_logPolarImg.cpp b/libs/vision/src/CFeatureExtraction_logPolarImg.cpp index be92abfdf1..7a02f974b5 100644 --- a/libs/vision/src/CFeatureExtraction_logPolarImg.cpp +++ b/libs/vision/src/CFeatureExtraction_logPolarImg.cpp @@ -53,14 +53,14 @@ void CFeatureExtraction::internal_computeLogPolarImageDescriptors( const cv::Mat& in = in_img.asCvMatRef(); cv::Mat& out = logpolar_frame.asCvMatRef(); -#if MRPT_OPENCV_VERSION_NUM < 0x300 +#if MRPT_OPENCV_VERSION_NUM < 0x030000 IplImage cvin, cvout; in_img.getAsIplImage(&cvin); logpolar_frame.getAsIplImage(&cvout); cvLogPolar( &cvin, &cvout, pt, radius, CV_INTER_LINEAR + CV_WARP_FILL_OUTLIERS); -#elif MRPT_OPENCV_VERSION_NUM < 0x342 +#elif MRPT_OPENCV_VERSION_NUM < 0x030402 cv::logPolar( in(cv::Rect( round(pt.x - radius), round(pt.y - radius), diff --git a/libs/vision/src/CFeatureExtraction_polarImg.cpp b/libs/vision/src/CFeatureExtraction_polarImg.cpp index 9a8627bf36..6abfff0f58 100644 --- a/libs/vision/src/CFeatureExtraction_polarImg.cpp +++ b/libs/vision/src/CFeatureExtraction_polarImg.cpp @@ -54,13 +54,13 @@ void CFeatureExtraction::internal_computePolarImageDescriptors( const cv::Mat& in = in_img.asCvMatRef(); cv::Mat& out = linpolar_frame.asCvMatRef(); -#if MRPT_OPENCV_VERSION_NUM < 0x300 +#if MRPT_OPENCV_VERSION_NUM < 0x030000 IplImage cvin, cvout; in_img.getAsIplImage(&cvin); linpolar_frame.getAsIplImage(&cvout); cvLinearPolar( &cvin, &cvout, pt, radius, CV_INTER_LINEAR + CV_WARP_FILL_OUTLIERS); -#elif MRPT_OPENCV_VERSION_NUM < 0x342 +#elif MRPT_OPENCV_VERSION_NUM < 0x030402 cv::linearPolar( in(cv::Rect( mrpt::round(pt.x - radius), mrpt::round(pt.y - radius), diff --git a/libs/vision/src/pnp/pnp_unittest.cpp b/libs/vision/src/pnp/pnp_unittest.cpp index 9905d7a49e..97c990cdd9 100644 --- a/libs/vision/src/pnp/pnp_unittest.cpp +++ b/libs/vision/src/pnp/pnp_unittest.cpp @@ -15,7 +15,7 @@ // Opencv 2.3 had a broken in Ubuntu 14.04 Trusty => Disable // PNP classes #include -#if MRPT_HAS_OPENCV && MRPT_OPENCV_VERSION_NUM < 0x240 +#if MRPT_HAS_OPENCV && MRPT_OPENCV_VERSION_NUM < 0x020400 #undef MRPT_HAS_OPENCV #define MRPT_HAS_OPENCV 0 #endif diff --git a/parse-files/version.h.in b/parse-files/version.h.in index d7b05c6a4b..a190905443 100644 --- a/parse-files/version.h.in +++ b/parse-files/version.h.in @@ -8,7 +8,7 @@ const char MRPT_version_str[] = "${CMAKE_MRPT_COMPLETE_NAME}"; /** Version number of package in hexadecimal: - * A three digits version code, eg. 1.2.0 -> 0x120, 2.5.11 -> 0x25B */ + * A 0x112233 hexadecimal version code, eg. 2.10.2 -> 0x020A02 */ // clang-format off #define MRPT_VERSION ${CMAKE_MRPT_VERSION_CODE} // clang-format on