mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-06 01:57:45 +08:00
OpenCV 5 support (#1732)
* OpenCV 5 support * RTABMapConfig.cmake, guard from including stereoRectifyFisheye.h * unified opencv components at the same place * fixing android build * Confirmed stereo calibration with fisheye works. Fix camera start/top progress dialog not drawn. Opencv >=4.7 using new opencv's ArucoDetector class. * pinning opencv for downstream apps * Avoid changing object/image points between fisheye calibration * Fixed stereo calib diverging when recalibrating same data * removed not needed opencv c api * fixing depthai build on opencv5 * bumped version * Adding ci opencv5 with homebrew * fixed ci script * Fixed OptimizerCeres build with opencv5
This commit is contained in:
@@ -30,7 +30,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
|
||||
#include "rtabmap/core/DBDriver.h"
|
||||
#if CV_MAJOR_VERSION < 5
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#else
|
||||
#include <opencv2/features.hpp>
|
||||
#endif
|
||||
|
||||
typedef struct sqlite3_stmt sqlite3_stmt;
|
||||
typedef struct sqlite3 sqlite3;
|
||||
|
||||
@@ -31,7 +31,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "rtabmap/core/Parameters.h"
|
||||
#include "rtabmap/utilite/UStl.h"
|
||||
#include <opencv2/core/core.hpp>
|
||||
#if CV_MAJOR_VERSION < 5
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#else
|
||||
#include <opencv2/features.hpp>
|
||||
#endif
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <list>
|
||||
|
||||
@@ -32,7 +32,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/core/core.hpp>
|
||||
#if CV_MAJOR_VERSION < 5
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#else
|
||||
#include <opencv2/features.hpp>
|
||||
#endif
|
||||
#include <list>
|
||||
#include <numeric>
|
||||
#include "rtabmap/core/Parameters.h"
|
||||
@@ -70,6 +74,10 @@ class BriefDescriptorExtractor;
|
||||
class SIFT;
|
||||
#endif
|
||||
class SURF;
|
||||
#if (CV_MAJOR_VERSION == 5)
|
||||
class BRISK;
|
||||
class KAZE;
|
||||
#endif
|
||||
}
|
||||
namespace cuda {
|
||||
class FastFeatureDetector;
|
||||
@@ -89,7 +97,13 @@ typedef cv::xfeatures2d::FREAK CV_FREAK;
|
||||
typedef cv::xfeatures2d::DAISY CV_DAISY;
|
||||
typedef cv::GFTTDetector CV_GFTT;
|
||||
typedef cv::xfeatures2d::BriefDescriptorExtractor CV_BRIEF;
|
||||
#if (CV_MAJOR_VERSION < 5)
|
||||
typedef cv::BRISK CV_BRISK;
|
||||
typedef cv::KAZE CV_KAZE;
|
||||
#else
|
||||
typedef cv::xfeatures2d::BRISK CV_BRISK;
|
||||
typedef cv::xfeatures2d::KAZE CV_KAZE;
|
||||
#endif
|
||||
typedef cv::ORB CV_ORB;
|
||||
typedef cv::cuda::SURF_CUDA CV_SURF_GPU;
|
||||
typedef cv::cuda::ORB CV_ORB_GPU;
|
||||
@@ -578,7 +592,7 @@ private:
|
||||
int diffusivity_;
|
||||
|
||||
#if CV_MAJOR_VERSION > 2
|
||||
cv::Ptr<cv::KAZE> kaze_;
|
||||
cv::Ptr<CV_KAZE> kaze_;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -32,7 +32,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <rtabmap/core/CameraModel.h>
|
||||
#include <opencv2/opencv_modules.hpp>
|
||||
|
||||
#ifdef HAVE_OPENCV_ARUCO
|
||||
#if (CV_MAJOR_VERSION > 4 || (CV_MAJOR_VERSION==4 && CV_MINOR_VERSION >=7)) && defined(HAVE_OPENCV_OBJDETECT)
|
||||
#include <opencv2/objdetect.hpp>
|
||||
#elif defined(HAVE_OPENCV_ARUCO)
|
||||
#include <opencv2/aruco.hpp>
|
||||
#endif
|
||||
|
||||
@@ -97,8 +99,11 @@ private:
|
||||
float maxRange_;
|
||||
float minRange_;
|
||||
int dictionaryId_;
|
||||
#ifdef HAVE_OPENCV_ARUCO
|
||||
cv::Ptr<cv::aruco::DetectorParameters> detectorParams_;
|
||||
#if ((CV_MAJOR_VERSION > 4 || (CV_MAJOR_VERSION==4 && CV_MINOR_VERSION >=7)) && defined(HAVE_OPENCV_OBJDETECT)) || defined(HAVE_OPENCV_ARUCO)
|
||||
#if CV_MAJOR_VERSION > 4 || (CV_MAJOR_VERSION==4 && CV_MINOR_VERSION >=7)
|
||||
cv::Ptr<cv::aruco::ArucoDetector> arucoDetector_;
|
||||
#endif
|
||||
cv::Ptr<cv::aruco::DetectorParameters> detectorParams_;
|
||||
cv::Ptr<cv::aruco::Dictionary> dictionary_;
|
||||
#endif
|
||||
void * apriltagLibDetector_;
|
||||
|
||||
@@ -41,7 +41,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <set>
|
||||
#include "rtabmap/utilite/UStl.h"
|
||||
#include <opencv2/core/core.hpp>
|
||||
#if CV_MAJOR_VERSION < 5
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#else
|
||||
#include <opencv2/features.hpp>
|
||||
#endif
|
||||
#include <pcl/pcl_config.h>
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
@@ -34,7 +34,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "rtabmap/core/RegistrationInfo.h"
|
||||
#include "rtabmap/core/CameraModel.h"
|
||||
#include "rtabmap/core/LaserScan.h"
|
||||
#if CV_MAJOR_VERSION < 5
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#else
|
||||
#include <opencv2/features.hpp>
|
||||
#endif
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
|
||||
@@ -34,7 +34,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <rtabmap/core/StereoCameraModel.h>
|
||||
#include <rtabmap/core/Transform.h>
|
||||
#include <opencv2/core/core.hpp>
|
||||
#if CV_MAJOR_VERSION < 5
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#else
|
||||
#include <opencv2/features.hpp>
|
||||
#endif
|
||||
#include <rtabmap/core/LaserScan.h>
|
||||
#include <rtabmap/core/IMU.h>
|
||||
#include <rtabmap/core/GPS.h>
|
||||
|
||||
@@ -31,7 +31,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <pcl/point_types.h>
|
||||
#include <opencv2/core/core.hpp>
|
||||
#if CV_MAJOR_VERSION < 5
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#else
|
||||
#include <opencv2/features.hpp>
|
||||
#endif
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
#include <map>
|
||||
#include <list>
|
||||
|
||||
@@ -31,7 +31,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
|
||||
|
||||
#include <opencv2/core/core.hpp>
|
||||
#if CV_MAJOR_VERSION < 5
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#else
|
||||
#include <opencv2/features.hpp>
|
||||
#endif
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
@@ -31,7 +31,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/core/core.hpp>
|
||||
#if CV_MAJOR_VERSION < 5
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#else
|
||||
#include <opencv2/features.hpp>
|
||||
#endif
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include "rtabmap/core/Parameters.h"
|
||||
|
||||
@@ -32,6 +32,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifndef CORELIB_SRC_OPENCV_STEREORECTIFYFISHEYE_H_
|
||||
#define CORELIB_SRC_OPENCV_STEREORECTIFYFISHEYE_H_
|
||||
|
||||
// This header relies on the OpenCV C API (cvRodrigues2, cvProjectPoints2, ...)
|
||||
// which was removed in OpenCV 5. Pull in only the version macros (available in
|
||||
// all OpenCV versions) so we can fail early with a clear message rather than
|
||||
// with cryptic errors from the includes below.
|
||||
#include <opencv2/core/version.hpp>
|
||||
#if CV_MAJOR_VERSION >= 5
|
||||
#error "stereoRectifyFisheye.h is not supported with OpenCV 5 or later (it uses the removed OpenCV C API). Use cv::fisheye::stereoRectify() instead, or guard your include with '#if CV_MAJOR_VERSION < 5'."
|
||||
#endif
|
||||
|
||||
#include <opencv2/calib3d/calib3d.hpp>
|
||||
#if CV_MAJOR_VERSION >= 3
|
||||
#include <opencv2/calib3d/calib3d_c.h>
|
||||
|
||||
@@ -32,7 +32,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <opencv2/core/version.hpp>
|
||||
#if CV_MAJOR_VERSION < 5
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#else
|
||||
#include <opencv2/features.hpp>
|
||||
#endif
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <list>
|
||||
|
||||
@@ -30,7 +30,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <rtabmap/core/rtabmap_core_export.h>
|
||||
|
||||
#include <opencv2/core/version.hpp>
|
||||
#if CV_MAJOR_VERSION < 5
|
||||
#include <opencv2/calib3d/calib3d.hpp>
|
||||
#else
|
||||
#include <opencv2/calib.hpp>
|
||||
#endif
|
||||
#include <rtabmap/core/Transform.h>
|
||||
#include <rtabmap/core/CameraModel.h>
|
||||
#include <rtabmap/core/StereoCameraModel.h>
|
||||
|
||||
Reference in New Issue
Block a user