Skip to content

Commit

Permalink
[rtabmap] More patches [skip actions]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt committed Mar 27, 2024
1 parent 7d0384b commit 7840c75
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 2 deletions.
12 changes: 12 additions & 0 deletions ports/rtabmap/link-keywords.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/corelib/src/CMakeLists.txt b/corelib/src/CMakeLists.txt
index 6a4a9ab..85ede4e 100644
--- a/corelib/src/CMakeLists.txt
+++ b/corelib/src/CMakeLists.txt
@@ -167,7 +167,6 @@ SET(LIBRARIES
# Issue that qhull dependency uses optimized and debug keywords,
# which are converted to \$<\$<NOT:\$<CONFIG:DEBUG>> and \$<\$<CONFIG:DEBUG>
# in RTABMap_coreTargets.cmake (not sure why?!).
-list(REMOVE_ITEM PCL_LIBRARIES "debug" "optimized")
SET(PUBLIC_LIBRARIES
${OpenCV_LIBS}
${PCL_LIBRARIES}
88 changes: 88 additions & 0 deletions ports/rtabmap/multi-definition.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
diff --git a/corelib/include/rtabmap/core/stereo/stereoRectifyFisheye.h b/corelib/include/rtabmap/core/stereo/stereoRectifyFisheye.h
index 2fc12a2..d9af960 100644
--- a/corelib/include/rtabmap/core/stereo/stereoRectifyFisheye.h
+++ b/corelib/include/rtabmap/core/stereo/stereoRectifyFisheye.h
@@ -39,6 +39,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if CV_MAJOR_VERSION >= 4
#include <opencv2/core/core_c.h>

+namespace {
+
// Opencv4 doesn't expose those functions below anymore, we should recopy all of them!
int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian CV_DEFAULT(0))
{
@@ -919,6 +921,8 @@ void cvConvertPointsHomogeneous( const CvMat* _src, CvMat* _dst )

#endif // OpenCV3

+} // namespace
+
namespace rtabmap
{

@@ -926,6 +930,7 @@ void
icvGetRectanglesFisheye( const CvMat* cameraMatrix, const CvMat* distCoeffs,
const CvMat* R, const CvMat* newCameraMatrix, CvSize imgSize,
cv::Rect_<float>& inner, cv::Rect_<float>& outer )
+#ifdef RTABMAP_STEREORECTIFIYFISHEYE_IMPLEMENTATION
{
const int N = 9;
int x, y, k;
@@ -967,12 +972,16 @@ icvGetRectanglesFisheye( const CvMat* cameraMatrix, const CvMat* distCoeffs,
inner = cv::Rect_<float>(iX0, iY0, iX1-iX0, iY1-iY0);
outer = cv::Rect_<float>(oX0, oY0, oX1-oX0, oY1-oY0);
}
+#else
+;
+#endif

void cvStereoRectifyFisheye( const CvMat* _cameraMatrix1, const CvMat* _cameraMatrix2,
const CvMat* _distCoeffs1, const CvMat* _distCoeffs2,
CvSize imageSize, const CvMat* matR, const CvMat* matT,
CvMat* _R1, CvMat* _R2, CvMat* _P1, CvMat* _P2,
CvMat* matQ, int flags, double alpha, CvSize newImgSize )
+#ifdef RTABMAP_STEREORECTIFIYFISHEYE_IMPLEMENTATION
{
double _om[3], _t[3] = {0}, _uu[3]={0,0,0}, _r_r[3][3], _pp[3][4];
double _ww[3], _wr[3][3], _z[3] = {0,0,0}, _ri[3][3], _w3[3];
@@ -1177,6 +1186,10 @@ void cvStereoRectifyFisheye( const CvMat* _cameraMatrix1, const CvMat* _cameraMa
cvConvert( &Q, matQ );
}
}
+#else
+;
+#endif
+

void stereoRectifyFisheye( cv::InputArray _cameraMatrix1, cv::InputArray _distCoeffs1,
cv::InputArray _cameraMatrix2, cv::InputArray _distCoeffs2,
@@ -1185,6 +1198,7 @@ void stereoRectifyFisheye( cv::InputArray _cameraMatrix1, cv::InputArray _distCo
cv::OutputArray _Pmat1, cv::OutputArray _Pmat2,
cv::OutputArray _Qmat, int flags,
double alpha, cv::Size newImageSize)
+#ifdef RTABMAP_STEREORECTIFIYFISHEYE_IMPLEMENTATION
{
cv::Mat cameraMatrix1 = _cameraMatrix1.getMat(), cameraMatrix2 = _cameraMatrix2.getMat();
cv::Mat distCoeffs1 = _distCoeffs1.getMat(), distCoeffs2 = _distCoeffs2.getMat();
@@ -1238,6 +1252,9 @@ void stereoRectifyFisheye( cv::InputArray _cameraMatrix1, cv::InputArray _distCo
CvSize(newImageSize));
#endif
}
+#else
+;
+#endif

}

diff --git a/corelib/src/StereoCameraModel.cpp b/corelib/src/StereoCameraModel.cpp
index 421d3f4..e7c166c 100644
--- a/corelib/src/StereoCameraModel.cpp
+++ b/corelib/src/StereoCameraModel.cpp
@@ -34,6 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <opencv2/imgproc/imgproc.hpp>

#if CV_MAJOR_VERSION > 2 or (CV_MAJOR_VERSION == 2 and (CV_MINOR_VERSION >4 or (CV_MINOR_VERSION == 4 and CV_SUBMINOR_VERSION >=10)))
+#define RTABMAP_STEREORECTIFIYFISHEYE_IMPLEMENTATION
#include <rtabmap/core/stereo/stereoRectifyFisheye.h>
#endif

6 changes: 5 additions & 1 deletion ports/rtabmap/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
Expand All @@ -9,6 +11,8 @@ vcpkg_from_github(
PATCHES
apple.patch
fix_link.patch
link-keywords.patch
multi-definition.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
Expand Down
1 change: 0 additions & 1 deletion ports/rtabmap/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "Real-Time Appearance-Based Mapping",
"homepage": "https://introlab.github.io/rtabmap/",
"license": "GPL-3.0-only",
"supports": "(windows & !staticcrt & x64) | linux | (osx & x64)",
"dependencies": [
"ceres",
"g2o",
Expand Down

0 comments on commit 7840c75

Please sign in to comment.