OpenCV 5 support

This commit is contained in:
matlabbe
2026-07-08 20:40:40 -07:00
parent e321999b15
commit 0c0fd3b9ec
69 changed files with 374 additions and 224 deletions
+6 -1
View File
@@ -241,7 +241,12 @@ option(BUILD_WITH_RPATH_NOT_RUNPATH "Explicitly disable usage of RUNPATH for the
set(RTABMAP_QT_VERSION AUTO CACHE STRING "Force a specific Qt version.") set(RTABMAP_QT_VERSION AUTO CACHE STRING "Force a specific Qt version.")
set_property(CACHE RTABMAP_QT_VERSION PROPERTY STRINGS AUTO 4 5 6) set_property(CACHE RTABMAP_QT_VERSION PROPERTY STRINGS AUTO 4 5 6)
FIND_PACKAGE(OpenCV REQUIRED QUIET COMPONENTS core calib3d imgproc highgui stitching photo video videoio OPTIONAL_COMPONENTS aruco objdetect xfeatures2d nonfree gpu cudafeatures2d cudaoptflow cudaimgproc) # Try OpenCV 5 first (calib3d was split into "calib" + "geometry" modules in OpenCV 5)
FIND_PACKAGE(OpenCV 5 QUIET COMPONENTS core calib imgproc highgui stitching photo video videoio geometry OPTIONAL_COMPONENTS aruco objdetect xfeatures2d nonfree gpu cudafeatures2d cudaoptflow cudaimgproc)
IF(NOT OpenCV_FOUND)
# Fall back to OpenCV < 5 (calib3d module)
FIND_PACKAGE(OpenCV REQUIRED QUIET COMPONENTS core calib3d imgproc highgui stitching photo video videoio OPTIONAL_COMPONENTS aruco objdetect xfeatures2d nonfree gpu cudafeatures2d cudaoptflow cudaimgproc)
ENDIF()
IF(WITH_QT) IF(WITH_QT)
FIND_PACKAGE(PCL 1.7 REQUIRED QUIET COMPONENTS common io kdtree search surface filters registration sample_consensus segmentation visualization) FIND_PACKAGE(PCL 1.7 REQUIRED QUIET COMPONENTS common io kdtree search surface filters registration sample_consensus segmentation visualization)
@@ -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/rtabmap_core_export.h" // DLL export/import defines
#include "rtabmap/core/DBDriver.h" #include "rtabmap/core/DBDriver.h"
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
typedef struct sqlite3_stmt sqlite3_stmt; typedef struct sqlite3_stmt sqlite3_stmt;
typedef struct sqlite3 sqlite3; 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/core/Parameters.h"
#include "rtabmap/utilite/UStl.h" #include "rtabmap/utilite/UStl.h"
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
#include <pcl/point_cloud.h> #include <pcl/point_cloud.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <list> #include <list>
+15 -1
View File
@@ -32,7 +32,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
#include <list> #include <list>
#include <numeric> #include <numeric>
#include "rtabmap/core/Parameters.h" #include "rtabmap/core/Parameters.h"
@@ -70,6 +74,10 @@ class BriefDescriptorExtractor;
class SIFT; class SIFT;
#endif #endif
class SURF; class SURF;
#if (CV_MAJOR_VERSION == 5)
class BRISK;
class KAZE;
#endif
} }
namespace cuda { namespace cuda {
class FastFeatureDetector; class FastFeatureDetector;
@@ -89,7 +97,13 @@ typedef cv::xfeatures2d::FREAK CV_FREAK;
typedef cv::xfeatures2d::DAISY CV_DAISY; typedef cv::xfeatures2d::DAISY CV_DAISY;
typedef cv::GFTTDetector CV_GFTT; typedef cv::GFTTDetector CV_GFTT;
typedef cv::xfeatures2d::BriefDescriptorExtractor CV_BRIEF; typedef cv::xfeatures2d::BriefDescriptorExtractor CV_BRIEF;
#if (CV_MAJOR_VERSION < 5)
typedef cv::BRISK CV_BRISK; 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::ORB CV_ORB;
typedef cv::cuda::SURF_CUDA CV_SURF_GPU; typedef cv::cuda::SURF_CUDA CV_SURF_GPU;
typedef cv::cuda::ORB CV_ORB_GPU; typedef cv::cuda::ORB CV_ORB_GPU;
@@ -578,7 +592,7 @@ private:
int diffusivity_; int diffusivity_;
#if CV_MAJOR_VERSION > 2 #if CV_MAJOR_VERSION > 2
cv::Ptr<cv::KAZE> kaze_; cv::Ptr<CV_KAZE> kaze_;
#endif #endif
}; };
+4
View File
@@ -41,7 +41,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <set> #include <set>
#include "rtabmap/utilite/UStl.h" #include "rtabmap/utilite/UStl.h"
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
#include <pcl/pcl_config.h> #include <pcl/pcl_config.h>
namespace rtabmap { namespace rtabmap {
@@ -34,7 +34,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/core/RegistrationInfo.h" #include "rtabmap/core/RegistrationInfo.h"
#include "rtabmap/core/CameraModel.h" #include "rtabmap/core/CameraModel.h"
#include "rtabmap/core/LaserScan.h" #include "rtabmap/core/LaserScan.h"
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
namespace rtabmap { namespace rtabmap {
@@ -34,7 +34,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/core/StereoCameraModel.h> #include <rtabmap/core/StereoCameraModel.h>
#include <rtabmap/core/Transform.h> #include <rtabmap/core/Transform.h>
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
#include <rtabmap/core/LaserScan.h> #include <rtabmap/core/LaserScan.h>
#include <rtabmap/core/IMU.h> #include <rtabmap/core/IMU.h>
#include <rtabmap/core/GPS.h> #include <rtabmap/core/GPS.h>
+5 -1
View File
@@ -31,7 +31,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <map> #include <map>
#include <list> #include <list>
@@ -62,7 +66,7 @@ public:
virtual ~Signature(); virtual ~Signature();
/** /**
* Must return a value between >=0 and <=1 (1 means 100% similarity). * Must return a value between >=0 and <=1 (1 means 100% similarity).
*/ */
float compareTo(const Signature & signature) const; float compareTo(const Signature & signature) const;
bool isBadSignature() const; bool isBadSignature() const;
@@ -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 "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <list> #include <list>
#include <vector> #include <vector>
@@ -31,7 +31,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
#include <list> #include <list>
#include <set> #include <set>
#include "rtabmap/core/Parameters.h" #include "rtabmap/core/Parameters.h"
@@ -32,7 +32,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <pcl/point_cloud.h> #include <pcl/point_cloud.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <opencv2/core/version.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
#include <set> #include <set>
#include <map> #include <map>
#include <list> #include <list>
@@ -30,7 +30,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/core/rtabmap_core_export.h> #include <rtabmap/core/rtabmap_core_export.h>
#include <opencv2/core/version.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/calib3d/calib3d.hpp> #include <opencv2/calib3d/calib3d.hpp>
#else
#include <opencv2/calib.hpp>
#endif
#include <rtabmap/core/Transform.h> #include <rtabmap/core/Transform.h>
#include <rtabmap/core/CameraModel.h> #include <rtabmap/core/CameraModel.h>
#include <rtabmap/core/StereoCameraModel.h> #include <rtabmap/core/StereoCameraModel.h>
+4 -1
View File
@@ -33,8 +33,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/UMath.h" #include "rtabmap/utilite/UMath.h"
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#include <opencv2/core/core_c.h> #if CV_MAJOR_VERSION < 5
#include <opencv2/calib3d/calib3d.hpp> #include <opencv2/calib3d/calib3d.hpp>
#else
#include <opencv2/geometry.hpp>
#endif
#include <iostream> #include <iostream>
namespace rtabmap namespace rtabmap
+29 -11
View File
@@ -36,7 +36,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/UMath.h" #include "rtabmap/utilite/UMath.h"
#include "rtabmap/utilite/ULogger.h" #include "rtabmap/utilite/ULogger.h"
#include "rtabmap/utilite/UTimer.h" #include "rtabmap/utilite/UTimer.h"
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/core/version.hpp> #include <opencv2/core/version.hpp>
#include <opencv2/opencv_modules.hpp> #include <opencv2/opencv_modules.hpp>
@@ -865,7 +864,7 @@ std::vector<cv::KeyPoint> Feature2D::generateKeypoints(const cv::Mat & image, co
cv::cornerSubPix( image, corners, cv::cornerSubPix( image, corners,
cv::Size( _subPixWinSize, _subPixWinSize ), cv::Size( _subPixWinSize, _subPixWinSize ),
cv::Size( -1, -1 ), cv::Size( -1, -1 ),
cv::TermCriteria( CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, _subPixIterations, _subPixEps ) ); cv::TermCriteria( cv::TermCriteria::MAX_ITER | cv::TermCriteria::EPS, _subPixIterations, _subPixEps ) );
for(unsigned int i=0;i<corners.size(); ++i) for(unsigned int i=0;i<corners.size(); ++i)
{ {
@@ -2377,8 +2376,13 @@ void BRISK::parseParameters(const ParametersMap & parameters)
Parameters::parse(parameters, Parameters::kBRISKThresh(), thresh_); Parameters::parse(parameters, Parameters::kBRISKThresh(), thresh_);
Parameters::parse(parameters, Parameters::kBRISKOctaves(), octaves_); Parameters::parse(parameters, Parameters::kBRISKOctaves(), octaves_);
Parameters::parse(parameters, Parameters::kBRISKPatternScale(), patternScale_); Parameters::parse(parameters, Parameters::kBRISKPatternScale(), patternScale_);
#if CV_MAJOR_VERSION > 4
#if CV_MAJOR_VERSION < 3 #ifdef HAVE_OPENCV_XFEATURES2D
brisk_ = CV_BRISK::create(thresh_, octaves_, patternScale_);
#else
UWARN("RTAB-Map is not built with OpenCV xfeatures2d module so BRISK cannot be used!");
#endif
#elif CV_MAJOR_VERSION < 3
brisk_ = cv::Ptr<CV_BRISK>(new CV_BRISK(thresh_, octaves_, patternScale_)); brisk_ = cv::Ptr<CV_BRISK>(new CV_BRISK(thresh_, octaves_, patternScale_));
#else #else
brisk_ = CV_BRISK::create(thresh_, octaves_, patternScale_); brisk_ = CV_BRISK::create(thresh_, octaves_, patternScale_);
@@ -2389,6 +2393,7 @@ std::vector<cv::KeyPoint> BRISK::generateKeypointsImpl(const cv::Mat & image, co
{ {
UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U); UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
std::vector<cv::KeyPoint> keypoints; std::vector<cv::KeyPoint> keypoints;
#if CV_MAJOR_VERSION < 5 || (CV_MAJOR_VERSION > 4 && defined(HAVE_OPENCV_XFEATURES2D))
cv::Mat imgRoi(image, roi); cv::Mat imgRoi(image, roi);
cv::Mat maskRoi; cv::Mat maskRoi;
if(!mask.empty()) if(!mask.empty())
@@ -2396,6 +2401,9 @@ std::vector<cv::KeyPoint> BRISK::generateKeypointsImpl(const cv::Mat & image, co
maskRoi = cv::Mat(mask, roi); maskRoi = cv::Mat(mask, roi);
} }
brisk_->detect(imgRoi, keypoints, maskRoi); // Opencv keypoints brisk_->detect(imgRoi, keypoints, maskRoi); // Opencv keypoints
#else
UWARN("RTAB-Map is not built with BRISK feature support!");
#endif
return keypoints; return keypoints;
} }
@@ -2403,7 +2411,11 @@ cv::Mat BRISK::generateDescriptorsImpl(const cv::Mat & image, std::vector<cv::Ke
{ {
UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U); UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
cv::Mat descriptors; cv::Mat descriptors;
#if CV_MAJOR_VERSION < 5 || (CV_MAJOR_VERSION > 4 && defined(HAVE_OPENCV_XFEATURES2D))
brisk_->compute(image, keypoints, descriptors); brisk_->compute(image, keypoints, descriptors);
#else
UWARN("RTAB-Map is not built with BRISK feature support!");
#endif
return descriptors; return descriptors;
} }
@@ -2436,10 +2448,16 @@ void KAZE::parseParameters(const ParametersMap & parameters)
Parameters::parse(parameters, Parameters::kKAZENOctaveLayers(), nOctaveLayers_); Parameters::parse(parameters, Parameters::kKAZENOctaveLayers(), nOctaveLayers_);
Parameters::parse(parameters, Parameters::kKAZEDiffusivity(), diffusivity_); Parameters::parse(parameters, Parameters::kKAZEDiffusivity(), diffusivity_);
#if CV_MAJOR_VERSION > 3 #if CV_MAJOR_VERSION > 4
kaze_ = cv::KAZE::create(extended_, upright_, threshold_, nOctaves_, nOctaveLayers_, (cv::KAZE::DiffusivityType)diffusivity_); #ifdef HAVE_OPENCV_XFEATURES2D
kaze_ = CV_KAZE::create(extended_, upright_, threshold_, nOctaves_, nOctaveLayers_, (CV_KAZE::DiffusivityType)diffusivity_);
#else
UWARN("RTAB-Map is not built with OpenCV xfeatures2d module so KAZE cannot be used!");
#endif
#elif CV_MAJOR_VERSION > 3
kaze_ = CV_KAZE::create(extended_, upright_, threshold_, nOctaves_, nOctaveLayers_, (CV_KAZE::DiffusivityType)diffusivity_);
#elif CV_MAJOR_VERSION > 2 #elif CV_MAJOR_VERSION > 2
kaze_ = cv::KAZE::create(extended_, upright_, threshold_, nOctaves_, nOctaveLayers_, diffusivity_); kaze_ = CV_KAZE::create(extended_, upright_, threshold_, nOctaves_, nOctaveLayers_, diffusivity_);
#else #else
UWARN("RTAB-Map is not built with OpenCV3 so Kaze feature cannot be used!"); UWARN("RTAB-Map is not built with OpenCV3 so Kaze feature cannot be used!");
#endif #endif
@@ -2449,7 +2467,7 @@ std::vector<cv::KeyPoint> KAZE::generateKeypointsImpl(const cv::Mat & image, con
{ {
UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U); UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
std::vector<cv::KeyPoint> keypoints; std::vector<cv::KeyPoint> keypoints;
#if CV_MAJOR_VERSION > 2 #if (CV_MAJOR_VERSION > 2 && CV_MAJOR_VERSION < 5) || (CV_MAJOR_VERSION > 4 && defined(HAVE_OPENCV_XFEATURES2D))
cv::Mat imgRoi(image, roi); cv::Mat imgRoi(image, roi);
cv::Mat maskRoi; cv::Mat maskRoi;
if (!mask.empty()) if (!mask.empty())
@@ -2458,7 +2476,7 @@ std::vector<cv::KeyPoint> KAZE::generateKeypointsImpl(const cv::Mat & image, con
} }
kaze_->detect(imgRoi, keypoints, maskRoi); // Opencv keypoints kaze_->detect(imgRoi, keypoints, maskRoi); // Opencv keypoints
#else #else
UWARN("RTAB-Map is not built with OpenCV3 so Kaze feature cannot be used!"); UWARN("RTAB-Map is not built with Kaze feature support!");
#endif #endif
return keypoints; return keypoints;
} }
@@ -2467,10 +2485,10 @@ cv::Mat KAZE::generateDescriptorsImpl(const cv::Mat & image, std::vector<cv::Key
{ {
UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U); UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
cv::Mat descriptors; cv::Mat descriptors;
#if CV_MAJOR_VERSION > 2 #if (CV_MAJOR_VERSION > 2 && CV_MAJOR_VERSION < 5) || (CV_MAJOR_VERSION > 4 && defined(HAVE_OPENCV_XFEATURES2D))
kaze_->compute(image, keypoints, descriptors); kaze_->compute(image, keypoints, descriptors);
#else #else
UWARN("RTAB-Map is not built with OpenCV3 so Kaze feature cannot be used!"); UWARN("RTAB-Map is not built with Kaze feature support!");
#endif #endif
return descriptors; return descriptors;
} }
+4
View File
@@ -30,6 +30,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/ULogger.h> #include <rtabmap/utilite/ULogger.h>
#include <rtabmap/utilite/UStl.h> #include <rtabmap/utilite/UStl.h>
#if CV_MAJOR_VERSION > 4
#include <opencv2/geometry.hpp>
#endif
#ifdef HAVE_OPENCV_ARUCO #ifdef HAVE_OPENCV_ARUCO
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION <8) #if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION <8)
namespace cv{ namespace cv{
+5 -3
View File
@@ -62,8 +62,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <pcl/io/pcd_io.h> #include <pcl/io/pcd_io.h>
#include <pcl/common/common.h> #include <pcl/common/common.h>
#include <rtabmap/core/MarkerDetector.h> #include <rtabmap/core/MarkerDetector.h>
#include <opencv2/imgproc/types_c.h>
#include <rtabmap/core/LocalGridMaker.h> #include <rtabmap/core/LocalGridMaker.h>
#if CV_MAJOR_VERSION >=5
#include <opencv2/geometry.hpp>
#endif
namespace rtabmap { namespace rtabmap {
@@ -5373,7 +5375,7 @@ Signature * Memory::createSignature(const SensorData & inputData, const Transfor
cv::Mat imageMono; cv::Mat imageMono;
if(decimatedData.imageRaw().channels() == 3) if(decimatedData.imageRaw().channels() == 3)
{ {
cv::cvtColor(decimatedData.imageRaw(), imageMono, CV_BGR2GRAY); cv::cvtColor(decimatedData.imageRaw(), imageMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
@@ -5681,7 +5683,7 @@ Signature * Memory::createSignature(const SensorData & inputData, const Transfor
cv::Mat imageMono; cv::Mat imageMono;
if(data.imageRaw().channels() == 3) if(data.imageRaw().channels() == 3)
{ {
cv::cvtColor(data.imageRaw(), imageMono, CV_BGR2GRAY); cv::cvtColor(data.imageRaw(), imageMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
+4 -2
View File
@@ -43,7 +43,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UStl.h> #include <rtabmap/utilite/UStl.h>
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <rtabmap/utilite/UMath.h> #include <rtabmap/utilite/UMath.h>
#include <opencv2/core/core_c.h> #if CV_MAJOR_VERSION > 4
#include <opencv2/geometry.hpp>
#endif
#if defined(HAVE_OPENCV_XFEATURES2D) && (CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION==3 && CV_MINOR_VERSION >=4 && CV_SUBMINOR_VERSION >= 1)) #if defined(HAVE_OPENCV_XFEATURES2D) && (CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION==3 && CV_MINOR_VERSION >=4 && CV_SUBMINOR_VERSION >= 1))
#include <opencv2/xfeatures2d.hpp> // For GMS matcher #include <opencv2/xfeatures2d.hpp> // For GMS matcher
@@ -2172,7 +2174,7 @@ Transform RegistrationVis::computeTransformationImpl(
if(!transform.isNull() && !pcaData.empty()) if(!transform.isNull() && !pcaData.empty())
{ {
cv::Mat pcaEigenVectors, pcaEigenValues; cv::Mat pcaEigenVectors, pcaEigenValues;
cv::PCA pca_analysis(pcaData, cv::Mat(), CV_PCA_DATA_AS_ROW); cv::PCA pca_analysis(pcaData, cv::Mat(), cv::PCA::DATA_AS_ROW);
// We take the second eigen value // We take the second eigen value
info.inliersDistribution = pca_analysis.eigenvalues.at<float>(0, 1); info.inliersDistribution = pca_analysis.eigenvalues.at<float>(0, 1);
+8 -9
View File
@@ -39,7 +39,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/core/IMUFilter.h" #include "rtabmap/core/IMUFilter.h"
#include "rtabmap/core/Features2d.h" #include "rtabmap/core/Features2d.h"
#include "rtabmap/core/clams/discrete_depth_distortion_model.h" #include "rtabmap/core/clams/discrete_depth_distortion_model.h"
#include <opencv2/imgproc/types_c.h>
#include <opencv2/stitching/detail/exposure_compensate.hpp> #include <opencv2/stitching/detail/exposure_compensate.hpp>
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <rtabmap/utilite/ULogger.h> #include <rtabmap/utilite/ULogger.h>
@@ -757,11 +756,11 @@ void SensorCaptureThread::postUpdate(SensorData * dataPtr, SensorCaptureInfo * i
else if(data.imageRaw().type() == CV_8UC3) else if(data.imageRaw().type() == CV_8UC3)
{ {
cv::Mat channels[3]; cv::Mat channels[3];
cv::cvtColor(data.imageRaw(), image, CV_BGR2YCrCb); cv::cvtColor(data.imageRaw(), image, cv::COLOR_BGR2YCrCb);
cv::split(image, channels); cv::split(image, channels);
cv::equalizeHist(channels[0], channels[0]); cv::equalizeHist(channels[0], channels[0]);
cv::merge(channels, 3, image); cv::merge(channels, 3, image);
cv::cvtColor(image, image, CV_YCrCb2BGR); cv::cvtColor(image, image, cv::COLOR_YCrCb2BGR);
} }
if(!data.depthRaw().empty()) if(!data.depthRaw().empty())
{ {
@@ -777,11 +776,11 @@ void SensorCaptureThread::postUpdate(SensorData * dataPtr, SensorCaptureInfo * i
else if(data.rightRaw().type() == CV_8UC3) else if(data.rightRaw().type() == CV_8UC3)
{ {
cv::Mat channels[3]; cv::Mat channels[3];
cv::cvtColor(data.rightRaw(), right, CV_BGR2YCrCb); cv::cvtColor(data.rightRaw(), right, cv::COLOR_BGR2YCrCb);
cv::split(right, channels); cv::split(right, channels);
cv::equalizeHist(channels[0], channels[0]); cv::equalizeHist(channels[0], channels[0]);
cv::merge(channels, 3, right); cv::merge(channels, 3, right);
cv::cvtColor(right, right, CV_YCrCb2BGR); cv::cvtColor(right, right, cv::COLOR_YCrCb2BGR);
} }
data.setStereoImage(image, right, data.stereoCameraModels()[0]); data.setStereoImage(image, right, data.stereoCameraModels()[0]);
} }
@@ -796,11 +795,11 @@ void SensorCaptureThread::postUpdate(SensorData * dataPtr, SensorCaptureInfo * i
else if(data.imageRaw().type() == CV_8UC3) else if(data.imageRaw().type() == CV_8UC3)
{ {
cv::Mat channels[3]; cv::Mat channels[3];
cv::cvtColor(data.imageRaw(), image, CV_BGR2YCrCb); cv::cvtColor(data.imageRaw(), image, cv::COLOR_BGR2YCrCb);
cv::split(image, channels); cv::split(image, channels);
clahe->apply(channels[0], channels[0]); clahe->apply(channels[0], channels[0]);
cv::merge(channels, 3, image); cv::merge(channels, 3, image);
cv::cvtColor(image, image, CV_YCrCb2BGR); cv::cvtColor(image, image, cv::COLOR_YCrCb2BGR);
} }
if(!data.depthRaw().empty()) if(!data.depthRaw().empty())
{ {
@@ -816,11 +815,11 @@ void SensorCaptureThread::postUpdate(SensorData * dataPtr, SensorCaptureInfo * i
else if(data.rightRaw().type() == CV_8UC3) else if(data.rightRaw().type() == CV_8UC3)
{ {
cv::Mat channels[3]; cv::Mat channels[3];
cv::cvtColor(data.rightRaw(), right, CV_BGR2YCrCb); cv::cvtColor(data.rightRaw(), right, cv::COLOR_BGR2YCrCb);
cv::split(right, channels); cv::split(right, channels);
clahe->apply(channels[0], channels[0]); clahe->apply(channels[0], channels[0]);
cv::merge(channels, 3, right); cv::merge(channels, 3, right);
cv::cvtColor(right, right, CV_YCrCb2BGR); cv::cvtColor(right, right, cv::COLOR_YCrCb2BGR);
} }
data.setStereoImage(image, right, data.stereoCameraModels()[0]); data.setStereoImage(image, right, data.stereoCameraModels()[0]);
} }
+10 -2
View File
@@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UConversion.h> #include <rtabmap/utilite/UConversion.h>
#include <opencv2/imgproc/imgproc.hpp> #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))) #if (CV_MAJOR_VERSION > 2 and CV_MAJOR_VERSION < 5) or (CV_MAJOR_VERSION == 2 and (CV_MINOR_VERSION >4 or (CV_MINOR_VERSION == 4 and CV_SUBMINOR_VERSION >=10)))
#include <rtabmap/core/stereo/stereoRectifyFisheye.h> #include <rtabmap/core/stereo/stereoRectifyFisheye.h>
#endif #endif
@@ -179,12 +179,20 @@ void StereoCameraModel::updateStereoRectification()
{ {
cv::Vec4d D_left(left_.D_raw().at<double>(0,0), left_.D_raw().at<double>(0,1), left_.D_raw().at<double>(0,4), left_.D_raw().at<double>(0,5)); cv::Vec4d D_left(left_.D_raw().at<double>(0,0), left_.D_raw().at<double>(0,1), left_.D_raw().at<double>(0,4), left_.D_raw().at<double>(0,5));
cv::Vec4d D_right(right_.D_raw().at<double>(0,0), right_.D_raw().at<double>(0,1), right_.D_raw().at<double>(0,4), right_.D_raw().at<double>(0,5)); cv::Vec4d D_right(right_.D_raw().at<double>(0,0), right_.D_raw().at<double>(0,1), right_.D_raw().at<double>(0,4), right_.D_raw().at<double>(0,5));
#if CV_MAJOR_VERSION < 5
stereoRectifyFisheye( stereoRectifyFisheye(
left_.K_raw(), D_left, left_.K_raw(), D_left,
right_.K_raw(), D_right, right_.K_raw(), D_right,
left_.imageSize(), R_, T_, R1, R2, P1, P2, Q, left_.imageSize(), R_, T_, R1, R2, P1, P2, Q,
cv::CALIB_ZERO_DISPARITY, 0, left_.imageSize()); cv::CALIB_ZERO_DISPARITY, 0, left_.imageSize());
#else
double balance = 0.0, fov_scale = 1.0;
cv::fisheye::stereoRectify(
left_.K_raw(), D_left,
right_.K_raw(), D_right,
left_.imageSize(), R_, T_, R1, R2, P1, P2, Q,
cv::CALIB_ZERO_DISPARITY, left_.imageSize(), balance, fov_scale);
#endif
// Re-zoom to original focal distance // Re-zoom to original focal distance
if(P1.at<double>(0,0) < 0) if(P1.at<double>(0,0) < 0)
+1 -2
View File
@@ -28,7 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UThread.h> #include <rtabmap/utilite/UThread.h>
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <rtabmap/core/util2d.h> #include <rtabmap/core/util2d.h>
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_FREENECT #ifdef RTABMAP_FREENECT
#include <libfreenect.h> #include <libfreenect.h>
@@ -183,7 +182,7 @@ private:
if(color_) if(color_)
{ {
cv::cvtColor(rgbIrBuffer_, rgbIrLastFrame_, CV_RGB2BGR); cv::cvtColor(rgbIrBuffer_, rgbIrLastFrame_, cv::COLOR_RGB2BGR);
} }
else // IrDepth else // IrDepth
{ {
+8 -9
View File
@@ -29,7 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UMath.h> #include <rtabmap/utilite/UMath.h>
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <rtabmap/core/util2d.h> #include <rtabmap/core/util2d.h>
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_FREENECT2 #ifdef RTABMAP_FREENECT2
#include <libfreenect2/libfreenect2.hpp> #include <libfreenect2/libfreenect2.hpp>
@@ -430,11 +429,11 @@ SensorData CameraFreenect2::captureImage(SensorCaptureInfo * info)
cv::Mat rgbMat; // rtabmap uses 3 channels RGB cv::Mat rgbMat; // rtabmap uses 3 channels RGB
#ifdef LIBFREENECT2_WITH_TEGRAJPEG_SUPPORT #ifdef LIBFREENECT2_WITH_TEGRAJPEG_SUPPORT
cv::cvtColor(rgbMatC4, rgbMat, CV_RGBA2BGR); cv::cvtColor(rgbMatC4, rgbMat, cv::COLOR_RGBA2BGR);
#else #else
cv::cvtColor(rgbMatC4, rgbMat, CV_BGRA2BGR); cv::cvtColor(rgbMatC4, rgbMat, cv::COLOR_BGRA2BGR);
#endif #endif
cv::flip(rgbMat, rgb, 1); cv::flip(rgbMat, rgb, 1);
@@ -490,11 +489,11 @@ SensorData CameraFreenect2::captureImage(SensorCaptureInfo * info)
cv::Mat rgbMat; // rtabmap uses 3 channels RGB cv::Mat rgbMat; // rtabmap uses 3 channels RGB
#ifdef LIBFREENECT2_WITH_TEGRAJPEG_SUPPORT #ifdef LIBFREENECT2_WITH_TEGRAJPEG_SUPPORT
cv::cvtColor(rgbMatC4, rgbMat, CV_RGB2BGR); cv::cvtColor(rgbMatC4, rgbMat, cv::COLOR_RGB2BGR);
#else #else
cv::cvtColor(rgbMatC4, rgbMat, CV_BGRA2BGR); cv::cvtColor(rgbMatC4, rgbMat, cv::COLOR_BGRA2BGR);
#endif #endif
cv::flip(rgbMat, rgb, 1); cv::flip(rgbMat, rgb, 1);
@@ -607,11 +606,11 @@ SensorData CameraFreenect2::captureImage(SensorCaptureInfo * info)
// rtabmap uses 3 channels RGB // rtabmap uses 3 channels RGB
#ifdef LIBFREENECT2_WITH_TEGRAJPEG_SUPPORT #ifdef LIBFREENECT2_WITH_TEGRAJPEG_SUPPORT
cv::cvtColor(rgbMatBGRA, rgb, CV_RGBA2BGR); cv::cvtColor(rgbMatBGRA, rgb, cv::COLOR_RGBA2BGR);
#else #else
cv::cvtColor(rgbMatBGRA, rgb, CV_BGRA2BGR); cv::cvtColor(rgbMatBGRA, rgb, cv::COLOR_BGRA2BGR);
#endif #endif
cv::flip(rgb, rgb, 1); cv::flip(rgb, rgb, 1);
@@ -629,11 +628,11 @@ SensorData CameraFreenect2::captureImage(SensorCaptureInfo * info)
// rtabmap uses 3 channels RGB // rtabmap uses 3 channels RGB
#ifdef LIBFREENECT2_WITH_TEGRAJPEG_SUPPORT #ifdef LIBFREENECT2_WITH_TEGRAJPEG_SUPPORT
cv::cvtColor(rgbMatBGRA, rgb, CV_RGBA2BGR); cv::cvtColor(rgbMatBGRA, rgb, cv::COLOR_RGBA2BGR);
#else #else
cv::cvtColor(rgbMatBGRA, rgb, CV_BGRA2BGR); cv::cvtColor(rgbMatBGRA, rgb, cv::COLOR_BGRA2BGR);
#endif #endif
cv::flip(rgb, rgb, 1); cv::flip(rgb, rgb, 1);
+7 -3
View File
@@ -34,7 +34,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/core/util3d.h> #include <rtabmap/core/util3d.h>
#include <rtabmap/core/util3d_filtering.h> #include <rtabmap/core/util3d_filtering.h>
#include <rtabmap/core/Graph.h> #include <rtabmap/core/Graph.h>
#include <opencv2/imgproc/types_c.h> #if CV_MAJOR_VERSION < 5
#include <opencv2/imgproc/imgproc.hpp>
#else
#include <opencv2/imgproc.hpp>
#endif
#include <fstream> #include <fstream>
namespace rtabmap namespace rtabmap
@@ -1111,7 +1115,7 @@ SensorData CameraImages::captureImage(SensorCaptureInfo * info)
{ {
UWARN("Conversion from 4 channels to 3 channels (file=%s)", imageFilePath.c_str()); UWARN("Conversion from 4 channels to 3 channels (file=%s)", imageFilePath.c_str());
cv::Mat out; cv::Mat out;
cv::cvtColor(img, out, CV_BGRA2BGR); cv::cvtColor(img, out, cv::COLOR_BGRA2BGR);
img = out; img = out;
} }
else if(!img.empty() && _bayerMode >= 0 && _bayerMode <=3) else if(!img.empty() && _bayerMode >= 0 && _bayerMode <=3)
@@ -1119,7 +1123,7 @@ SensorData CameraImages::captureImage(SensorCaptureInfo * info)
cv::Mat debayeredImg; cv::Mat debayeredImg;
try try
{ {
cv::cvtColor(img, debayeredImg, CV_BayerBG2BGR + _bayerMode); cv::cvtColor(img, debayeredImg, cv::COLOR_BayerBG2BGR + _bayerMode);
img = debayeredImg; img = debayeredImg;
} }
catch(const cv::Exception & e) catch(const cv::Exception & e)
+1 -2
View File
@@ -29,7 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UThreadC.h> #include <rtabmap/utilite/UThreadC.h>
#include <rtabmap/core/util2d.h> #include <rtabmap/core/util2d.h>
#include <rtabmap/core/Compression.h> #include <rtabmap/core/Compression.h>
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_K4A #ifdef RTABMAP_K4A
#include <k4a/k4a.h> #include <k4a/k4a.h>
@@ -508,7 +507,7 @@ SensorData CameraK4A::captureImage(SensorCaptureInfo * info)
CV_8UC4, CV_8UC4,
(void*)k4a_image_get_buffer(rgb_image_)); (void*)k4a_image_get_buffer(rgb_image_));
cv::cvtColor(bgra, bgrCV, CV_BGRA2BGR); cv::cvtColor(bgra, bgrCV, cv::COLOR_BGRA2BGR);
} }
bgrCV = model_.rectifyImage(bgrCV); bgrCV = model_.rectifyImage(bgrCV);
+2 -3
View File
@@ -28,7 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <rtabmap/utilite/UThreadC.h> #include <rtabmap/utilite/UThreadC.h>
#include <rtabmap/core/util2d.h> #include <rtabmap/core/util2d.h>
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_K4W2 #ifdef RTABMAP_K4W2
#include <Kinect.h> #include <Kinect.h>
@@ -486,11 +485,11 @@ SensorData CameraK4W2::captureImage(SensorCaptureInfo * info)
{ {
cv::Mat tmp; cv::Mat tmp;
cv::resize(cv::Mat(nColorHeight, nColorWidth, CV_8UC4, pColorBuffer), tmp, cv::Size(), 0.5, 0.5, cv::INTER_AREA); cv::resize(cv::Mat(nColorHeight, nColorWidth, CV_8UC4, pColorBuffer), tmp, cv::Size(), 0.5, 0.5, cv::INTER_AREA);
cv::cvtColor(tmp, imageColor, CV_BGRA2BGR); cv::cvtColor(tmp, imageColor, cv::COLOR_BGRA2BGR);
} }
else else
{ {
cv::cvtColor(cv::Mat(nColorHeight, nColorWidth, CV_8UC4, pColorBuffer), imageColor, CV_BGRA2BGR); cv::cvtColor(cv::Mat(nColorHeight, nColorWidth, CV_8UC4, pColorBuffer), imageColor, cv::COLOR_BGRA2BGR);
} }
// loop over output pixels // loop over output pixels
for (int depthIndex = 0; depthIndex < (nDepthWidth*nDepthHeight); ++depthIndex) for (int depthIndex = 0; depthIndex < (nDepthWidth*nDepthHeight); ++depthIndex)
+1 -2
View File
@@ -29,7 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UFile.h> #include <rtabmap/utilite/UFile.h>
#include <rtabmap/utilite/UThreadC.h> #include <rtabmap/utilite/UThreadC.h>
#include <rtabmap/core/util2d.h> #include <rtabmap/core/util2d.h>
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_OPENNI2 #ifdef RTABMAP_OPENNI2
#include <OniVersion.h> #include <OniVersion.h>
@@ -514,7 +513,7 @@ SensorData CameraOpenNI2::captureImage(SensorCaptureInfo * info)
cv::Mat tmp(h, w, CV_8UC3, (void *)colorFrame.getData()); cv::Mat tmp(h, w, CV_8UC3, (void *)colorFrame.getData());
if(_type==kTypeColorDepth) if(_type==kTypeColorDepth)
{ {
cv::cvtColor(tmp, rgb, CV_RGB2BGR); cv::cvtColor(tmp, rgb, cv::COLOR_RGB2BGR);
} }
else // IR else // IR
{ {
+24 -18
View File
@@ -26,7 +26,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/core/camera/CameraOpenNICV.h> #include <rtabmap/core/camera/CameraOpenNICV.h>
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#if CV_MAJOR_VERSION > 3 #if CV_MAJOR_VERSION >= 5
#include <opencv2/videoio.hpp>
#elif CV_MAJOR_VERSION > 3
#include <opencv2/videoio/videoio_c.h> #include <opencv2/videoio/videoio_c.h>
#endif #endif
@@ -59,30 +61,34 @@ bool CameraOpenNICV::init(const std::string & calibrationFolder, const std::stri
} }
ULOGGER_DEBUG("Camera::init()"); ULOGGER_DEBUG("Camera::init()");
_capture.open( _asus?CV_CAP_OPENNI_ASUS:CV_CAP_OPENNI ); #if CV_MAJOR_VERSION < 5
_capture.open( _asus?cv::CAP_OPENNI_ASUS:cv::CAP_OPENNI );
#else
_capture.open( _asus?cv::CAP_OPENNI2_ASUS:cv::CAP_OPENNI2 );
#endif
if(_capture.isOpened()) if(_capture.isOpened())
{ {
_capture.set( CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE, CV_CAP_OPENNI_VGA_30HZ ); _capture.set( cv::CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE, cv::CAP_OPENNI_VGA_30HZ );
_depthFocal = _capture.get( CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH ); _depthFocal = _capture.get( cv::CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH );
// Print some avalible device settings. // Print some avalible device settings.
UINFO("Depth generator output mode:"); UINFO("Depth generator output mode:");
UINFO("FRAME_WIDTH %f", _capture.get( CV_CAP_PROP_FRAME_WIDTH )); UINFO("FRAME_WIDTH %f", _capture.get( cv::CAP_PROP_FRAME_WIDTH ));
UINFO("FRAME_HEIGHT %f", _capture.get( CV_CAP_PROP_FRAME_HEIGHT )); UINFO("FRAME_HEIGHT %f", _capture.get( cv::CAP_PROP_FRAME_HEIGHT ));
UINFO("FRAME_MAX_DEPTH %f mm", _capture.get( CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH )); UINFO("FRAME_MAX_DEPTH %f mm", _capture.get( cv::CAP_PROP_OPENNI_FRAME_MAX_DEPTH ));
UINFO("BASELINE %f mm", _capture.get( CV_CAP_PROP_OPENNI_BASELINE )); UINFO("BASELINE %f mm", _capture.get( cv::CAP_PROP_OPENNI_BASELINE ));
UINFO("FPS %f", _capture.get( CV_CAP_PROP_FPS )); UINFO("FPS %f", _capture.get( cv::CAP_PROP_FPS ));
UINFO("Focal %f", _capture.get( CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH )); UINFO("Focal %f", _capture.get( cv::CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH ));
UINFO("REGISTRATION %f", _capture.get( CV_CAP_PROP_OPENNI_REGISTRATION )); UINFO("REGISTRATION %f", _capture.get( cv::CAP_PROP_OPENNI_REGISTRATION ));
if(_capture.get( CV_CAP_PROP_OPENNI_REGISTRATION ) == 0.0) if(_capture.get( cv::CAP_PROP_OPENNI_REGISTRATION ) == 0.0)
{ {
UERROR("Depth registration is not activated on this device!"); UERROR("Depth registration is not activated on this device!");
} }
if( _capture.get( CV_CAP_OPENNI_IMAGE_GENERATOR_PRESENT ) ) if( _capture.get( cv::CAP_OPENNI_IMAGE_GENERATOR_PRESENT ) )
{ {
UINFO("Image generator output mode:"); UINFO("Image generator output mode:");
UINFO("FRAME_WIDTH %f", _capture.get( CV_CAP_OPENNI_IMAGE_GENERATOR+CV_CAP_PROP_FRAME_WIDTH )); UINFO("FRAME_WIDTH %f", _capture.get( cv::CAP_OPENNI_IMAGE_GENERATOR+cv::CAP_PROP_FRAME_WIDTH ));
UINFO("FRAME_HEIGHT %f", _capture.get( CV_CAP_OPENNI_IMAGE_GENERATOR+CV_CAP_PROP_FRAME_HEIGHT )); UINFO("FRAME_HEIGHT %f", _capture.get( cv::CAP_OPENNI_IMAGE_GENERATOR+cv::CAP_PROP_FRAME_HEIGHT ));
UINFO("FPS %f", _capture.get( CV_CAP_OPENNI_IMAGE_GENERATOR+CV_CAP_PROP_FPS )); UINFO("FPS %f", _capture.get( cv::CAP_OPENNI_IMAGE_GENERATOR+cv::CAP_PROP_FPS ));
} }
else else
{ {
@@ -112,8 +118,8 @@ SensorData CameraOpenNICV::captureImage(SensorCaptureInfo * info)
{ {
_capture.grab(); _capture.grab();
cv::Mat depth, rgb; cv::Mat depth, rgb;
_capture.retrieve(depth, CV_CAP_OPENNI_DEPTH_MAP ); _capture.retrieve(depth, cv::CAP_OPENNI_DEPTH_MAP );
_capture.retrieve(rgb, CV_CAP_OPENNI_BGR_IMAGE ); _capture.retrieve(rgb, cv::CAP_OPENNI_BGR_IMAGE );
depth = depth.clone(); depth = depth.clone();
rgb = rgb.clone(); rgb = rgb.clone();
+1 -2
View File
@@ -28,7 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UFile.h> #include <rtabmap/utilite/UFile.h>
#include <rtabmap/utilite/UThreadC.h> #include <rtabmap/utilite/UThreadC.h>
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_OPENNI #ifdef RTABMAP_OPENNI
#include <pcl/io/openni_grabber.h> #include <pcl/io/openni_grabber.h>
@@ -94,7 +93,7 @@ void CameraOpenni::image_cb (
cv::Mat rgbFrame(rgb->getHeight(), rgb->getWidth(), CV_8UC3); cv::Mat rgbFrame(rgb->getHeight(), rgb->getWidth(), CV_8UC3);
rgb->fillRGB(rgb->getWidth(), rgb->getHeight(), rgbFrame.data); rgb->fillRGB(rgb->getWidth(), rgb->getHeight(), rgbFrame.data);
cv::cvtColor(rgbFrame, rgb_, CV_RGB2BGR); cv::cvtColor(rgbFrame, rgb_, cv::COLOR_RGB2BGR);
depth_ = cv::Mat(rgb->getHeight(), rgb->getWidth(), CV_16UC1); depth_ = cv::Mat(rgb->getHeight(), rgb->getWidth(), CV_16UC1);
depth->fillDepthImageRaw(rgb->getWidth(), rgb->getHeight(), (unsigned short*)depth_.data); depth->fillDepthImageRaw(rgb->getWidth(), rgb->getHeight(), (unsigned short*)depth_.data);
+1 -2
View File
@@ -29,7 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UMath.h> #include <rtabmap/utilite/UMath.h>
#include <rtabmap/utilite/UThreadC.h> #include <rtabmap/utilite/UThreadC.h>
#include <rtabmap/core/util2d.h> #include <rtabmap/core/util2d.h>
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_REALSENSE #ifdef RTABMAP_REALSENSE
#include <librealsense/rs.hpp> #include <librealsense/rs.hpp>
@@ -938,7 +937,7 @@ SensorData CameraRealSense::captureImage(SensorCaptureInfo * info)
} }
else else
{ {
cv::cvtColor(rgb, bgr, CV_RGB2BGR); cv::cvtColor(rgb, bgr, cv::COLOR_RGB2BGR);
} }
bool rectified = false; bool rectified = false;
+1 -2
View File
@@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UConversion.h> #include <rtabmap/utilite/UConversion.h>
#include <rtabmap/utilite/UStl.h> #include <rtabmap/utilite/UStl.h>
#include <rtabmap/utilite/UDirectory.h> #include <rtabmap/utilite/UDirectory.h>
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_REALSENSE2 #ifdef RTABMAP_REALSENSE2
#include <librealsense2/rsutil.h> #include <librealsense2/rsutil.h>
@@ -1440,7 +1439,7 @@ SensorData CameraRealSense2::captureImage(SensorCaptureInfo * info)
cv::Mat bgr; cv::Mat bgr;
if(rgb.channels() == 3) if(rgb.channels() == 3)
{ {
cv::cvtColor(rgb, bgr, CV_RGB2BGR); cv::cvtColor(rgb, bgr, cv::COLOR_RGB2BGR);
} }
else else
{ {
+2 -3
View File
@@ -28,7 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/core/camera/CameraStereoDC1394.h> #include <rtabmap/core/camera/CameraStereoDC1394.h>
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <rtabmap/utilite/UConversion.h> #include <rtabmap/utilite/UConversion.h>
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_DC1394 #ifdef RTABMAP_DC1394
#include <dc1394/dc1394.h> #include <dc1394/dc1394.h>
@@ -295,8 +294,8 @@ public:
//DC1394_COLOR_CODING_RAW16: //DC1394_COLOR_CODING_RAW16:
//DC1394_COLOR_FILTER_BGGR //DC1394_COLOR_FILTER_BGGR
cv::cvtColor(cv::Mat(frame->size[1], frame->size[0], CV_8UC1, capture_buffer), left, CV_BayerRG2BGR); cv::cvtColor(cv::Mat(frame->size[1], frame->size[0], CV_8UC1, capture_buffer), left, cv::COLOR_BayerRG2BGR);
cv::cvtColor(cv::Mat(frame->size[1], frame->size[0], CV_8UC1, capture_buffer+image.total()), right, CV_BayerRG2GRAY); cv::cvtColor(cv::Mat(frame->size[1], frame->size[0], CV_8UC1, capture_buffer+image.total()), right, cv::COLOR_BayerRG2GRAY);
dc1394_capture_enqueue(camera_, frame); dc1394_capture_enqueue(camera_, frame);
+1 -2
View File
@@ -29,7 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UStl.h> #include <rtabmap/utilite/UStl.h>
#include <rtabmap/utilite/UFile.h> #include <rtabmap/utilite/UFile.h>
#include <rtabmap/utilite/UConversion.h> #include <rtabmap/utilite/UConversion.h>
#include <opencv2/imgproc/types_c.h>
namespace rtabmap namespace rtabmap
{ {
@@ -339,7 +338,7 @@ SensorData CameraStereoImages::captureImage(SensorCaptureInfo * info)
if(rightImage.type() != CV_8UC1 && rightGrayScale_) if(rightImage.type() != CV_8UC1 && rightGrayScale_)
{ {
cv::Mat tmp; cv::Mat tmp;
cv::cvtColor(rightImage, tmp, CV_BGR2GRAY); cv::cvtColor(rightImage, tmp, cv::COLOR_BGR2GRAY);
rightImage = tmp; rightImage = tmp;
} }
+9 -7
View File
@@ -34,7 +34,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <rtabmap/utilite/UThreadC.h> #include <rtabmap/utilite/UThreadC.h>
#include <rtabmap/utilite/UConversion.h> #include <rtabmap/utilite/UConversion.h>
#if CV_MAJOR_VERSION > 3 #if CV_MAJOR_VERSION > 4
#include <opencv2/videoio.hpp>
#elif CV_MAJOR_VERSION > 3
#include <opencv2/videoio/videoio_c.h> #include <opencv2/videoio/videoio_c.h>
#endif #endif
@@ -81,18 +83,18 @@ bool CameraStereoTara::init(const std::string & calibrationFolder, const std::st
capture_.open(usbDevice_); capture_.open(usbDevice_);
capture_.set(CV_CAP_PROP_FOURCC, CV_FOURCC('Y', '1', '6', ' ')); capture_.set(cv::CAP_PROP_FOURCC, CV_FOURCC('Y', '1', '6', ' '));
capture_.set(CV_CAP_PROP_FPS, 60); capture_.set(cv::CAP_PROP_FPS, 60);
capture_.set(CV_CAP_PROP_FRAME_WIDTH, 752); capture_.set(cv::CAP_PROP_FRAME_WIDTH, 752);
capture_.set(CV_CAP_PROP_FRAME_HEIGHT, 480); capture_.set(cv::CAP_PROP_FRAME_HEIGHT, 480);
capture_.set(CV_CAP_PROP_CONVERT_RGB,false); capture_.set(cv::CAP_PROP_CONVERT_RGB,false);
ULOGGER_DEBUG("CameraStereoTara: Usb device initialization on device %d", usbDevice_); ULOGGER_DEBUG("CameraStereoTara: Usb device initialization on device %d", usbDevice_);
if (cameraName_.empty()) if (cameraName_.empty())
{ {
unsigned int guid = (unsigned int)capture_.get(CV_CAP_PROP_GUID); unsigned int guid = (unsigned int)capture_.get(cv::CAP_PROP_GUID);
if (guid != 0 && guid != 0xffffffff) if (guid != 0 && guid != 0xffffffff)
{ {
cameraName_ = uFormat("%08x", guid); cameraName_ = uFormat("%08x", guid);
+22 -24
View File
@@ -28,12 +28,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/core/camera/CameraStereoVideo.h> #include <rtabmap/core/camera/CameraStereoVideo.h>
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <rtabmap/utilite/UConversion.h> #include <rtabmap/utilite/UConversion.h>
#include <opencv2/imgproc/types_c.h>
#if CV_MAJOR_VERSION > 3
#include <opencv2/videoio/videoio_c.h>
#if CV_MAJOR_VERSION > 4 #if CV_MAJOR_VERSION > 4
#include <opencv2/videoio/legacy/constants_c.h> #include <opencv2/videoio.hpp>
#endif #elif CV_MAJOR_VERSION > 3
#include <opencv2/videoio/videoio_c.h>
#endif #endif
namespace rtabmap namespace rtabmap
@@ -172,7 +170,7 @@ bool CameraStereoVideo::init(const std::string & calibrationFolder, const std::s
if (cameraName_.empty()) if (cameraName_.empty())
{ {
unsigned int guid = (unsigned int)capture_.get(CV_CAP_PROP_GUID); unsigned int guid = (unsigned int)capture_.get(cv::CAP_PROP_GUID);
if (guid != 0 && guid != 0xffffffff) if (guid != 0 && guid != 0xffffffff)
{ {
cameraName_ = uFormat("%08x", guid); cameraName_ = uFormat("%08x", guid);
@@ -214,17 +212,17 @@ bool CameraStereoVideo::init(const std::string & calibrationFolder, const std::s
if(capture_.isOpened()) if(capture_.isOpened())
{ {
bool resolutionSet = false; bool resolutionSet = false;
resolutionSet = capture_.set(CV_CAP_PROP_FRAME_WIDTH, stereoModel_.left().imageWidth()*(capture2_.isOpened()?1:2)); resolutionSet = capture_.set(cv::CAP_PROP_FRAME_WIDTH, stereoModel_.left().imageWidth()*(capture2_.isOpened()?1:2));
resolutionSet = resolutionSet && capture_.set(CV_CAP_PROP_FRAME_HEIGHT, stereoModel_.left().imageHeight()); resolutionSet = resolutionSet && capture_.set(cv::CAP_PROP_FRAME_HEIGHT, stereoModel_.left().imageHeight());
if(capture2_.isOpened()) if(capture2_.isOpened())
{ {
resolutionSet = resolutionSet && capture2_.set(CV_CAP_PROP_FRAME_WIDTH, stereoModel_.right().imageWidth()); resolutionSet = resolutionSet && capture2_.set(cv::CAP_PROP_FRAME_WIDTH, stereoModel_.right().imageWidth());
resolutionSet = resolutionSet && capture2_.set(CV_CAP_PROP_FRAME_HEIGHT, stereoModel_.right().imageHeight()); resolutionSet = resolutionSet && capture2_.set(cv::CAP_PROP_FRAME_HEIGHT, stereoModel_.right().imageHeight());
} }
// Check if the resolution was set successfully // Check if the resolution was set successfully
int actualWidth = int(capture_.get(CV_CAP_PROP_FRAME_WIDTH)); int actualWidth = int(capture_.get(cv::CAP_PROP_FRAME_WIDTH));
int actualHeight = int(capture_.get(CV_CAP_PROP_FRAME_HEIGHT)); int actualHeight = int(capture_.get(cv::CAP_PROP_FRAME_HEIGHT));
if(!resolutionSet || if(!resolutionSet ||
actualWidth != stereoModel_.left().imageWidth()*(capture2_.isOpened()?1:2) || actualWidth != stereoModel_.left().imageWidth()*(capture2_.isOpened()?1:2) ||
actualHeight != stereoModel_.left().imageHeight()) actualHeight != stereoModel_.left().imageHeight())
@@ -244,17 +242,17 @@ bool CameraStereoVideo::init(const std::string & calibrationFolder, const std::s
if(capture_.isOpened()) if(capture_.isOpened())
{ {
bool resolutionSet = false; bool resolutionSet = false;
resolutionSet = capture_.set(CV_CAP_PROP_FRAME_WIDTH, _width*(capture2_.isOpened()?1:2)); resolutionSet = capture_.set(cv::CAP_PROP_FRAME_WIDTH, _width*(capture2_.isOpened()?1:2));
resolutionSet = resolutionSet && capture_.set(CV_CAP_PROP_FRAME_HEIGHT, _height); resolutionSet = resolutionSet && capture_.set(cv::CAP_PROP_FRAME_HEIGHT, _height);
if(capture2_.isOpened()) if(capture2_.isOpened())
{ {
resolutionSet = resolutionSet && capture2_.set(CV_CAP_PROP_FRAME_WIDTH, _width); resolutionSet = resolutionSet && capture2_.set(cv::CAP_PROP_FRAME_WIDTH, _width);
resolutionSet = resolutionSet && capture2_.set(CV_CAP_PROP_FRAME_HEIGHT, _height); resolutionSet = resolutionSet && capture2_.set(cv::CAP_PROP_FRAME_HEIGHT, _height);
} }
// Check if the resolution was set successfully // Check if the resolution was set successfully
int actualWidth = int(capture_.get(CV_CAP_PROP_FRAME_WIDTH)); int actualWidth = int(capture_.get(cv::CAP_PROP_FRAME_WIDTH));
int actualHeight = int(capture_.get(CV_CAP_PROP_FRAME_HEIGHT)); int actualHeight = int(capture_.get(cv::CAP_PROP_FRAME_HEIGHT));
if(!resolutionSet || if(!resolutionSet ||
actualWidth != _width*(capture2_.isOpened()?1:2) || actualWidth != _width*(capture2_.isOpened()?1:2) ||
actualHeight != _height) actualHeight != _height)
@@ -273,10 +271,10 @@ bool CameraStereoVideo::init(const std::string & calibrationFolder, const std::s
if (this->getFrameRate() > 0) if (this->getFrameRate() > 0)
{ {
bool fpsSupported = false; bool fpsSupported = false;
fpsSupported = capture_.set(CV_CAP_PROP_FPS, this->getFrameRate()); fpsSupported = capture_.set(cv::CAP_PROP_FPS, this->getFrameRate());
if (capture2_.isOpened()) if (capture2_.isOpened())
{ {
fpsSupported = fpsSupported && capture2_.set(CV_CAP_PROP_FPS, this->getFrameRate()); fpsSupported = fpsSupported && capture2_.set(cv::CAP_PROP_FPS, this->getFrameRate());
} }
if(fpsSupported) if(fpsSupported)
{ {
@@ -310,14 +308,14 @@ bool CameraStereoVideo::init(const std::string & calibrationFolder, const std::s
std::string fourccUpperCase = uToUpperCase(_fourcc); std::string fourccUpperCase = uToUpperCase(_fourcc);
int fourcc = cv::VideoWriter::fourcc(fourccUpperCase.at(0), fourccUpperCase.at(1), fourccUpperCase.at(2), fourccUpperCase.at(3)); int fourcc = cv::VideoWriter::fourcc(fourccUpperCase.at(0), fourccUpperCase.at(1), fourccUpperCase.at(2), fourccUpperCase.at(3));
bool fourccSupported = false; bool fourccSupported = false;
fourccSupported = capture_.set(CV_CAP_PROP_FOURCC, fourcc); fourccSupported = capture_.set(cv::CAP_PROP_FOURCC, fourcc);
if (capture2_.isOpened()) if (capture2_.isOpened())
{ {
fourccSupported = fourccSupported && capture2_.set(CV_CAP_PROP_FOURCC, fourcc); fourccSupported = fourccSupported && capture2_.set(cv::CAP_PROP_FOURCC, fourcc);
} }
// Check if the FOURCC was set successfully // Check if the FOURCC was set successfully
int actualFourcc = int(capture_.get(CV_CAP_PROP_FOURCC)); int actualFourcc = int(capture_.get(cv::CAP_PROP_FOURCC));
if(!fourccSupported || actualFourcc != fourcc) if(!fourccSupported || actualFourcc != fourcc)
{ {
@@ -386,7 +384,7 @@ SensorData CameraStereoVideo::captureImage(SensorCaptureInfo * info)
if(rightImage.type() != CV_8UC1 && rightGrayScale_) if(rightImage.type() != CV_8UC1 && rightGrayScale_)
{ {
cv::Mat tmp; cv::Mat tmp;
cv::cvtColor(rightImage, tmp, CV_BGR2GRAY); cv::cvtColor(rightImage, tmp, cv::COLOR_BGR2GRAY);
rightImage = tmp; rightImage = tmp;
rightCvt = true; rightCvt = true;
} }
+4
View File
@@ -38,6 +38,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <zed-open-capture/sensorcapture.hpp> #include <zed-open-capture/sensorcapture.hpp>
#include "SimpleIni.h" #include "SimpleIni.h"
#if CV_MAJOR_VERSION >= 5
#include <opencv2/geometry.hpp>
#endif
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2018, STEREOLABS. // Copyright (c) 2018, STEREOLABS.
+15 -16
View File
@@ -28,11 +28,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/core/camera/CameraVideo.h> #include <rtabmap/core/camera/CameraVideo.h>
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <rtabmap/utilite/UConversion.h> #include <rtabmap/utilite/UConversion.h>
#if CV_MAJOR_VERSION > 3
#include <opencv2/videoio/videoio_c.h>
#if CV_MAJOR_VERSION > 4 #if CV_MAJOR_VERSION > 4
#include <opencv2/videoio/legacy/constants_c.h> #include <opencv2/videoio.hpp>
#endif #elif CV_MAJOR_VERSION > 3
#include <opencv2/videoio/videoio_c.h>
#endif #endif
namespace rtabmap namespace rtabmap
@@ -105,7 +104,7 @@ bool CameraVideo::init(const std::string & calibrationFolder, const std::string
{ {
if (_guid.empty()) if (_guid.empty())
{ {
unsigned int guid = (unsigned int)_capture.get(CV_CAP_PROP_GUID); unsigned int guid = (unsigned int)_capture.get(cv::CAP_PROP_GUID);
if (guid != 0 && guid != 0xffffffff) if (guid != 0 && guid != 0xffffffff)
{ {
_guid = uFormat("%08x", guid); _guid = uFormat("%08x", guid);
@@ -143,12 +142,12 @@ bool CameraVideo::init(const std::string & calibrationFolder, const std::string
} }
bool resolutionSet = false; bool resolutionSet = false;
resolutionSet = _capture.set(CV_CAP_PROP_FRAME_WIDTH, _model.imageWidth()); resolutionSet = _capture.set(cv::CAP_PROP_FRAME_WIDTH, _model.imageWidth());
resolutionSet = resolutionSet && _capture.set(CV_CAP_PROP_FRAME_HEIGHT, _model.imageHeight()); resolutionSet = resolutionSet && _capture.set(cv::CAP_PROP_FRAME_HEIGHT, _model.imageHeight());
// Check if the resolution was set successfully // Check if the resolution was set successfully
int actualWidth = int(_capture.get(CV_CAP_PROP_FRAME_WIDTH)); int actualWidth = int(_capture.get(cv::CAP_PROP_FRAME_WIDTH));
int actualHeight = int(_capture.get(CV_CAP_PROP_FRAME_HEIGHT)); int actualHeight = int(_capture.get(cv::CAP_PROP_FRAME_HEIGHT));
if(!resolutionSet || if(!resolutionSet ||
actualWidth != _model.imageWidth() || actualWidth != _model.imageWidth() ||
actualHeight != _model.imageHeight()) actualHeight != _model.imageHeight())
@@ -165,12 +164,12 @@ bool CameraVideo::init(const std::string & calibrationFolder, const std::string
else if(_width > 0 && _height > 0) else if(_width > 0 && _height > 0)
{ {
int resolutionSet = false; int resolutionSet = false;
resolutionSet = _capture.set(CV_CAP_PROP_FRAME_WIDTH, _width); resolutionSet = _capture.set(cv::CAP_PROP_FRAME_WIDTH, _width);
resolutionSet = resolutionSet && _capture.set(CV_CAP_PROP_FRAME_HEIGHT, _height); resolutionSet = resolutionSet && _capture.set(cv::CAP_PROP_FRAME_HEIGHT, _height);
// Check if the resolution was set successfully // Check if the resolution was set successfully
int actualWidth = int(_capture.get(CV_CAP_PROP_FRAME_WIDTH)); int actualWidth = int(_capture.get(cv::CAP_PROP_FRAME_WIDTH));
int actualHeight = int(_capture.get(CV_CAP_PROP_FRAME_HEIGHT)); int actualHeight = int(_capture.get(cv::CAP_PROP_FRAME_HEIGHT));
if(!resolutionSet || actualWidth != _width || actualHeight != _height) if(!resolutionSet || actualWidth != _width || actualHeight != _height)
{ {
UWARN("Desired resolution (%dx%d) cannot be set to camera driver, " UWARN("Desired resolution (%dx%d) cannot be set to camera driver, "
@@ -182,7 +181,7 @@ bool CameraVideo::init(const std::string & calibrationFolder, const std::string
} }
// Set FPS // Set FPS
if (this->getFrameRate() > 0 && _capture.set(CV_CAP_PROP_FPS, this->getFrameRate())) if (this->getFrameRate() > 0 && _capture.set(cv::CAP_PROP_FPS, this->getFrameRate()))
{ {
// Check if the FPS was set successfully // Check if the FPS was set successfully
double actualFPS = _capture.get(cv::CAP_PROP_FPS); double actualFPS = _capture.get(cv::CAP_PROP_FPS);
@@ -213,10 +212,10 @@ bool CameraVideo::init(const std::string & calibrationFolder, const std::string
std::string fourccUpperCase = uToUpperCase(_fourcc); std::string fourccUpperCase = uToUpperCase(_fourcc);
int fourcc = cv::VideoWriter::fourcc(fourccUpperCase.at(0), fourccUpperCase.at(1), fourccUpperCase.at(2), fourccUpperCase.at(3)); int fourcc = cv::VideoWriter::fourcc(fourccUpperCase.at(0), fourccUpperCase.at(1), fourccUpperCase.at(2), fourccUpperCase.at(3));
bool fourccSupported = _capture.set(CV_CAP_PROP_FOURCC, fourcc); bool fourccSupported = _capture.set(cv::CAP_PROP_FOURCC, fourcc);
// Check if the FOURCC was set successfully // Check if the FOURCC was set successfully
int actualFourcc = int(_capture.get(CV_CAP_PROP_FOURCC)); int actualFourcc = int(_capture.get(cv::CAP_PROP_FOURCC));
if(!fourccSupported || actualFourcc != fourcc) if(!fourccSupported || actualFourcc != fourcc)
{ {
+1 -2
View File
@@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/ULogger.h" #include "rtabmap/utilite/ULogger.h"
#include "rtabmap/utilite/UTimer.h" #include "rtabmap/utilite/UTimer.h"
#include "rtabmap/utilite/UStl.h" #include "rtabmap/utilite/UStl.h"
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_DVO #ifdef RTABMAP_DVO
#include <dvo/dense_tracking.h> #include <dvo/dense_tracking.h>
@@ -124,7 +123,7 @@ Transform OdometryDVO::computeTransform(
{ {
if(data.imageRaw().type() == CV_8UC3) if(data.imageRaw().type() == CV_8UC3)
{ {
cv::cvtColor(data.imageRaw(), grey, CV_BGR2GRAY); cv::cvtColor(data.imageRaw(), grey, cv::COLOR_BGR2GRAY);
} }
else else
{ {
+4
View File
@@ -42,7 +42,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/UTimer.h" #include "rtabmap/utilite/UTimer.h"
#include "rtabmap/utilite/UMath.h" #include "rtabmap/utilite/UMath.h"
#include "rtabmap/utilite/UConversion.h" #include "rtabmap/utilite/UConversion.h"
#if CV_MAJOR_VERSION < 5
#include <opencv2/calib3d/calib3d.hpp> #include <opencv2/calib3d/calib3d.hpp>
#else
#include <opencv2/geometry.hpp>
#endif
#include <rtabmap/core/odometry/OdometryF2M.h> #include <rtabmap/core/odometry/OdometryF2M.h>
#include <pcl/common/io.h> #include <pcl/common/io.h>
+2 -3
View File
@@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/ULogger.h" #include "rtabmap/utilite/ULogger.h"
#include "rtabmap/utilite/UTimer.h" #include "rtabmap/utilite/UTimer.h"
#include "rtabmap/utilite/UStl.h" #include "rtabmap/utilite/UStl.h"
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_FOVIS #ifdef RTABMAP_FOVIS
#include <libfovis/fovis.hpp> #include <libfovis/fovis.hpp>
@@ -137,7 +136,7 @@ Transform OdometryFovis::computeTransform(
cv::Mat gray; cv::Mat gray;
if(data.imageRaw().type() == CV_8UC3) if(data.imageRaw().type() == CV_8UC3)
{ {
cv::cvtColor(data.imageRaw(), gray, CV_BGR2GRAY); cv::cvtColor(data.imageRaw(), gray, cv::COLOR_BGR2GRAY);
} }
else if(data.imageRaw().type() == CV_8UC1) else if(data.imageRaw().type() == CV_8UC1)
{ {
@@ -302,7 +301,7 @@ Transform OdometryFovis::computeTransform(
} }
if(data.rightRaw().type() == CV_8UC3) if(data.rightRaw().type() == CV_8UC3)
{ {
cv::cvtColor(data.rightRaw(), right, CV_BGR2GRAY); cv::cvtColor(data.rightRaw(), right, cv::COLOR_BGR2GRAY);
} }
else if(data.rightRaw().type() == CV_8UC1) else if(data.rightRaw().type() == CV_8UC1)
{ {
+2 -3
View File
@@ -32,7 +32,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/UTimer.h" #include "rtabmap/utilite/UTimer.h"
#include "rtabmap/utilite/UStl.h" #include "rtabmap/utilite/UStl.h"
#include "rtabmap/utilite/UThread.h" #include "rtabmap/utilite/UThread.h"
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_MSCKF_VIO #ifdef RTABMAP_MSCKF_VIO
#include <msckf_vio/image_processor.h> #include <msckf_vio/image_processor.h>
@@ -867,7 +866,7 @@ Transform OdometryMSCKF::computeTransform(
if(data.imageRaw().type() == CV_8UC3) if(data.imageRaw().type() == CV_8UC3)
{ {
cv::cvtColor(data.imageRaw(), cam0.image, CV_BGR2GRAY); cv::cvtColor(data.imageRaw(), cam0.image, cv::COLOR_BGR2GRAY);
} }
else else
{ {
@@ -875,7 +874,7 @@ Transform OdometryMSCKF::computeTransform(
} }
if(data.rightRaw().type() == CV_8UC3) if(data.rightRaw().type() == CV_8UC3)
{ {
cv::cvtColor(data.rightRaw(), cam1.image, CV_BGR2GRAY); cv::cvtColor(data.rightRaw(), cam1.image, cv::COLOR_BGR2GRAY);
} }
else else
{ {
+4
View File
@@ -43,7 +43,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/UStl.h" #include "rtabmap/utilite/UStl.h"
#include "rtabmap/utilite/UMath.h" #include "rtabmap/utilite/UMath.h"
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/calib3d/calib3d.hpp> #include <opencv2/calib3d/calib3d.hpp>
#else
#include <opencv2/geometry.hpp>
#endif
#include <opencv2/video/tracking.hpp> #include <opencv2/video/tracking.hpp>
#include <pcl/common/centroid.h> #include <pcl/common/centroid.h>
+6 -7
View File
@@ -33,7 +33,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/UStl.h" #include "rtabmap/utilite/UStl.h"
#include "rtabmap/utilite/UDirectory.h" #include "rtabmap/utilite/UDirectory.h"
#include <pcl/common/transforms.h> #include <pcl/common/transforms.h>
#include <opencv2/imgproc/types_c.h>
#include <rtabmap/core/odometry/OdometryORBSLAM2.h> #include <rtabmap/core/odometry/OdometryORBSLAM2.h>
#if defined(RTABMAP_ORB_SLAM) and RTABMAP_ORB_SLAM == 2 #if defined(RTABMAP_ORB_SLAM) and RTABMAP_ORB_SLAM == 2
@@ -426,7 +425,7 @@ public:
} }
else else
{ {
cvtColor(mImGray,mImGray,CV_BGR2GRAY); cvtColor(mImGray,mImGray,cv::COLOR_BGR2GRAY);
} }
} }
else if(mImGray.channels()==4) else if(mImGray.channels()==4)
@@ -437,7 +436,7 @@ public:
} }
else else
{ {
cvtColor(mImGray,mImGray,CV_BGRA2GRAY); cvtColor(mImGray,mImGray,cv::COLOR_BGRA2GRAY);
} }
} }
if(imGrayRight.channels()==3) if(imGrayRight.channels()==3)
@@ -448,7 +447,7 @@ public:
} }
else else
{ {
cvtColor(imGrayRight,imGrayRight,CV_BGR2GRAY); cvtColor(imGrayRight,imGrayRight,cv::COLOR_BGR2GRAY);
} }
} }
else if(imGrayRight.channels()==4) else if(imGrayRight.channels()==4)
@@ -459,7 +458,7 @@ public:
} }
else else
{ {
cvtColor(imGrayRight,imGrayRight,CV_BGRA2GRAY); cvtColor(imGrayRight,imGrayRight,cv::COLOR_BGRA2GRAY);
} }
} }
@@ -480,14 +479,14 @@ public:
if(mbRGB) if(mbRGB)
cvtColor(mImGray,mImGray,CV_RGB2GRAY); cvtColor(mImGray,mImGray,CV_RGB2GRAY);
else else
cvtColor(mImGray,mImGray,CV_BGR2GRAY); cvtColor(mImGray,mImGray,cv::COLOR_BGR2GRAY);
} }
else if(mImGray.channels()==4) else if(mImGray.channels()==4)
{ {
if(mbRGB) if(mbRGB)
cvtColor(mImGray,mImGray,CV_RGBA2GRAY); cvtColor(mImGray,mImGray,CV_RGBA2GRAY);
else else
cvtColor(mImGray,mImGray,CV_BGRA2GRAY); cvtColor(mImGray,mImGray,cv::COLOR_BGRA2GRAY);
} }
UASSERT(imDepth.type()==CV_32F); UASSERT(imDepth.type()==CV_32F);
+2 -3
View File
@@ -34,7 +34,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/UDirectory.h" #include "rtabmap/utilite/UDirectory.h"
#include "rtabmap/utilite/UFile.h" #include "rtabmap/utilite/UFile.h"
#include <pcl/common/transforms.h> #include <pcl/common/transforms.h>
#include <opencv2/imgproc/types_c.h>
#include <rtabmap/core/odometry/OdometryORBSLAM3.h> #include <rtabmap/core/odometry/OdometryORBSLAM3.h>
#if defined(RTABMAP_ORB_SLAM) and RTABMAP_ORB_SLAM == 3 #if defined(RTABMAP_ORB_SLAM) and RTABMAP_ORB_SLAM == 3
@@ -469,12 +468,12 @@ Transform OdometryORBSLAM3::computeTransform(
cv::Mat leftMono = data.imageRaw(); cv::Mat leftMono = data.imageRaw();
if(data.imageRaw().channels() == 3) { if(data.imageRaw().channels() == 3) {
leftMono = cv::Mat(); leftMono = cv::Mat();
cv::cvtColor(data.imageRaw(), leftMono, CV_BGR2GRAY); cv::cvtColor(data.imageRaw(), leftMono, cv::COLOR_BGR2GRAY);
} }
cv::Mat rightMono = data.rightRaw(); cv::Mat rightMono = data.rightRaw();
if(data.rightRaw().channels() == 3) { if(data.rightRaw().channels() == 3) {
rightMono = cv::Mat(); rightMono = cv::Mat();
cv::cvtColor(data.imageRaw(), rightMono, CV_BGR2GRAY); cv::cvtColor(data.imageRaw(), rightMono, cv::COLOR_BGR2GRAY);
} }
UDEBUG("Adding Stereo Frame %f", data.stamp()); UDEBUG("Adding Stereo Frame %f", data.stamp());
Tcw = orbslam_->TrackStereo(leftMono, rightMono, data.stamp(), orbslamImus_); Tcw = orbslam_->TrackStereo(leftMono, rightMono, data.stamp(), orbslamImus_);
+1 -2
View File
@@ -34,7 +34,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/UThread.h" #include "rtabmap/utilite/UThread.h"
#include "rtabmap/utilite/UFile.h" #include "rtabmap/utilite/UFile.h"
#include "rtabmap/utilite/UDirectory.h" #include "rtabmap/utilite/UDirectory.h"
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_OKVIS #ifdef RTABMAP_OKVIS
#include <iostream> #include <iostream>
@@ -427,7 +426,7 @@ Transform OdometryOkvis::computeTransform(
cv::Mat gray; cv::Mat gray;
if(images[i].type() == CV_8UC3) if(images[i].type() == CV_8UC3)
{ {
cv::cvtColor(images[i], gray, CV_BGR2GRAY); cv::cvtColor(images[i], gray, cv::COLOR_BGR2GRAY);
} }
else if(images[i].type() == CV_8UC1) else if(images[i].type() == CV_8UC1)
{ {
+2 -3
View File
@@ -32,7 +32,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/ULogger.h" #include "rtabmap/utilite/ULogger.h"
#include "rtabmap/utilite/UTimer.h" #include "rtabmap/utilite/UTimer.h"
#include <opencv2/core/eigen.hpp> #include <opencv2/core/eigen.hpp>
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_OPENVINS #ifdef RTABMAP_OPENVINS
#include "core/VioManager.h" #include "core/VioManager.h"
@@ -419,7 +418,7 @@ Transform OdometryOpenVINS::computeTransform(
cv::Mat image; cv::Mat image;
if(data.imageRaw().type() == CV_8UC3) if(data.imageRaw().type() == CV_8UC3)
cv::cvtColor(data.imageRaw(), image, CV_BGR2GRAY); cv::cvtColor(data.imageRaw(), image, cv::COLOR_BGR2GRAY);
else if(data.imageRaw().type() == CV_8UC1) else if(data.imageRaw().type() == CV_8UC1)
image = data.imageRaw().clone(); image = data.imageRaw().clone();
else else
@@ -450,7 +449,7 @@ Transform OdometryOpenVINS::computeTransform(
if(!data.rightRaw().empty()) if(!data.rightRaw().empty())
{ {
if(data.rightRaw().type() == CV_8UC3) if(data.rightRaw().type() == CV_8UC3)
cv::cvtColor(data.rightRaw(), image, CV_BGR2GRAY); cv::cvtColor(data.rightRaw(), image, cv::COLOR_BGR2GRAY);
else if(data.rightRaw().type() == CV_8UC1) else if(data.rightRaw().type() == CV_8UC1)
image = data.rightRaw().clone(); image = data.rightRaw().clone();
else else
+2 -3
View File
@@ -33,7 +33,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/UStl.h" #include "rtabmap/utilite/UStl.h"
#include "rtabmap/utilite/UThread.h" #include "rtabmap/utilite/UThread.h"
#include "rtabmap/utilite/UDirectory.h" #include "rtabmap/utilite/UDirectory.h"
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_VINS_FUSION #ifdef RTABMAP_VINS_FUSION
#include <estimator/estimator.h> #include <estimator/estimator.h>
@@ -444,7 +443,7 @@ Transform OdometryVINSFusion::computeTransform(
cv::Mat right; cv::Mat right;
if(data.imageRaw().type() == CV_8UC3) if(data.imageRaw().type() == CV_8UC3)
{ {
cv::cvtColor(data.imageRaw(), left, CV_BGR2GRAY); cv::cvtColor(data.imageRaw(), left, cv::COLOR_BGR2GRAY);
} }
else if(data.imageRaw().type() == CV_8UC1) else if(data.imageRaw().type() == CV_8UC1)
{ {
@@ -456,7 +455,7 @@ Transform OdometryVINSFusion::computeTransform(
} }
if(data.rightRaw().type() == CV_8UC3) if(data.rightRaw().type() == CV_8UC3)
{ {
cv::cvtColor(data.rightRaw(), right, CV_BGR2GRAY); cv::cvtColor(data.rightRaw(), right, cv::COLOR_BGR2GRAY);
} }
else if(data.rightRaw().type() == CV_8UC1) else if(data.rightRaw().type() == CV_8UC1)
{ {
+2 -3
View File
@@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/ULogger.h" #include "rtabmap/utilite/ULogger.h"
#include "rtabmap/utilite/UTimer.h" #include "rtabmap/utilite/UTimer.h"
#include "rtabmap/utilite/UStl.h" #include "rtabmap/utilite/UStl.h"
#include <opencv2/imgproc/types_c.h>
#ifdef RTABMAP_VISO2 #ifdef RTABMAP_VISO2
#include <viso_stereo.h> #include <viso_stereo.h>
@@ -131,7 +130,7 @@ Transform OdometryViso2::computeTransform(
cv::Mat leftGray; cv::Mat leftGray;
if(data.imageRaw().type() == CV_8UC3) if(data.imageRaw().type() == CV_8UC3)
{ {
cv::cvtColor(data.imageRaw(), leftGray, CV_BGR2GRAY); cv::cvtColor(data.imageRaw(), leftGray, cv::COLOR_BGR2GRAY);
} }
else if(data.imageRaw().type() == CV_8UC1) else if(data.imageRaw().type() == CV_8UC1)
{ {
@@ -144,7 +143,7 @@ Transform OdometryViso2::computeTransform(
cv::Mat rightGray; cv::Mat rightGray;
if(data.rightRaw().type() == CV_8UC3) if(data.rightRaw().type() == CV_8UC3)
{ {
cv::cvtColor(data.rightRaw(), rightGray, CV_BGR2GRAY); cv::cvtColor(data.rightRaw(), rightGray, cv::COLOR_BGR2GRAY);
} }
else if(data.rightRaw().type() == CV_8UC1) else if(data.rightRaw().type() == CV_8UC1)
{ {
+4
View File
@@ -64,7 +64,11 @@
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
-2
View File
@@ -31,8 +31,6 @@
#include <vector> #include <vector>
#include <list> #include <list>
#include <opencv2/core/core_c.h>
namespace rtabmap namespace rtabmap
{ {
+1 -1
View File
@@ -752,7 +752,7 @@ void CV_ORB::operator()( InputArray _image, InputArray _mask, std::vector<KeyPoi
Mat image = _image.getMat(), mask = _mask.getMat(); Mat image = _image.getMat(), mask = _mask.getMat();
if( image.type() != CV_8UC1 ) if( image.type() != CV_8UC1 )
cvtColor(_image, image, CV_BGR2GRAY); cvtColor(_image, image, cv::COLOR_BGR2GRAY);
int levelsNum = this->nlevels; int levelsNum = this->nlevels;
+4
View File
@@ -8,6 +8,10 @@
#ifndef CORELIB_SRC_OPENCV_FIVE_POINT_H_ #ifndef CORELIB_SRC_OPENCV_FIVE_POINT_H_
#define CORELIB_SRC_OPENCV_FIVE_POINT_H_ #define CORELIB_SRC_OPENCV_FIVE_POINT_H_
#if CV_MAJOR_VERSION > 4
#include <opencv2/geometry.hpp>
#endif
namespace cv3 namespace cv3
{ {
+8 -4
View File
@@ -53,7 +53,7 @@ class PnPRansacCallback : public PointSetRegistrator::Callback
public: public:
PnPRansacCallback(Mat _cameraMatrix=Mat(3,3,CV_64F), Mat _distCoeffs=Mat(4,1,CV_64F), int _flags=CV_ITERATIVE, PnPRansacCallback(Mat _cameraMatrix=Mat(3,3,CV_64F), Mat _distCoeffs=Mat(4,1,CV_64F), int _flags=cv::SOLVEPNP_ITERATIVE,
bool _useExtrinsicGuess=false, Mat _rvec=Mat(), Mat _tvec=Mat() ) bool _useExtrinsicGuess=false, Mat _rvec=Mat(), Mat _tvec=Mat() )
: cameraMatrix(_cameraMatrix), distCoeffs(_distCoeffs), flags(_flags), useExtrinsicGuess(_useExtrinsicGuess), : cameraMatrix(_cameraMatrix), distCoeffs(_distCoeffs), flags(_flags), useExtrinsicGuess(_useExtrinsicGuess),
rvec(_rvec), tvec(_tvec) {} rvec(_rvec), tvec(_tvec) {}
@@ -142,12 +142,12 @@ bool solvePnPRansac(InputArray _opoints, InputArray _ipoints,
Mat cameraMatrix = _cameraMatrix.getMat(), distCoeffs = _distCoeffs.getMat(); Mat cameraMatrix = _cameraMatrix.getMat(), distCoeffs = _distCoeffs.getMat();
int model_points = 6; int model_points = 6;
int ransac_kernel_method = CV_EPNP; int ransac_kernel_method = cv::SOLVEPNP_EPNP;
if( npoints == 4 ) if( npoints == 4 )
{ {
model_points = 4; model_points = 4;
ransac_kernel_method = CV_P3P; ransac_kernel_method = cv::SOLVEPNP_P3P;
} }
Ptr<PointSetRegistrator::Callback> cb; // pointer to callback Ptr<PointSetRegistrator::Callback> cb; // pointer to callback
@@ -178,7 +178,7 @@ bool solvePnPRansac(InputArray _opoints, InputArray _ipoints,
opoints_inliers.resize(npoints1); opoints_inliers.resize(npoints1);
ipoints_inliers.resize(npoints1); ipoints_inliers.resize(npoints1);
result = solvePnP(opoints_inliers, ipoints_inliers, cameraMatrix, result = solvePnP(opoints_inliers, ipoints_inliers, cameraMatrix,
distCoeffs, rvec, tvec, useExtrinsicGuess, flags == CV_P3P ? CV_EPNP : flags) ? 1 : -1; distCoeffs, rvec, tvec, useExtrinsicGuess, flags == cv::SOLVEPNP_P3P ? cv::SOLVEPNP_EPNP : flags) ? 1 : -1;
} }
if( result <= 0 || _local_model.rows <= 0) if( result <= 0 || _local_model.rows <= 0)
@@ -213,7 +213,11 @@ bool solvePnPRansac(InputArray _opoints, InputArray _ipoints,
int RANSACUpdateNumIters( double p, double ep, int modelPoints, int maxIters ) int RANSACUpdateNumIters( double p, double ep, int modelPoints, int maxIters )
{ {
if( modelPoints <= 0 ) if( modelPoints <= 0 )
#if CV_MAJOR_VERSION < 5
CV_Error( 0, "the number of model points should be positive" ); CV_Error( 0, "the number of model points should be positive" );
#else
CV_Error( cv::Error::Code::StsBadArg, "the number of model points should be positive" );
#endif
p = MAX(p, 0.); p = MAX(p, 0.);
p = MIN(p, 1.); p = MIN(p, 1.);
+5 -1
View File
@@ -45,10 +45,14 @@
#define RTABMAP_CORELIB_SRC_OPENCV_SOLVEPNP_H_ #define RTABMAP_CORELIB_SRC_OPENCV_SOLVEPNP_H_
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#if CV_MAJOR_VERSION >= 5
#include <opencv2/geometry.hpp>
#else
#include <opencv2/calib3d/calib3d.hpp> #include <opencv2/calib3d/calib3d.hpp>
#if CV_MAJOR_VERSION >= 3 #if CV_MAJOR_VERSION >= 3
#include <opencv2/calib3d/calib3d_c.h> #include <opencv2/calib3d/calib3d_c.h>
#endif #endif
#endif
namespace cv3 { namespace cv3 {
@@ -95,7 +99,7 @@ bool solvePnPRansac( cv::InputArray objectPoints, cv::InputArray imagePoints,
cv::OutputArray rvec, cv::OutputArray tvec, cv::OutputArray rvec, cv::OutputArray tvec,
bool useExtrinsicGuess = false, int iterationsCount = 100, bool useExtrinsicGuess = false, int iterationsCount = 100,
float reprojectionError = 8.0, double confidence = 0.99, float reprojectionError = 8.0, double confidence = 0.99,
cv::OutputArray inliers = cv::noArray(), int flags = CV_ITERATIVE ); cv::OutputArray inliers = cv::noArray(), int flags = cv::SOLVEPNP_ITERATIVE );
int RANSACUpdateNumIters( double p, double ep, int modelPoints, int maxIters ); int RANSACUpdateNumIters( double p, double ep, int modelPoints, int maxIters );
+7 -3
View File
@@ -27,9 +27,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/core/stereo/StereoBM.h> #include <rtabmap/core/stereo/StereoBM.h>
#include <rtabmap/utilite/ULogger.h> #include <rtabmap/utilite/ULogger.h>
#if CV_MAJOR_VERSION < 5
#include <opencv2/calib3d/calib3d.hpp> #include <opencv2/calib3d/calib3d.hpp>
#else
#include <opencv2/stereo.hpp>
#include <opencv2/geometry.hpp>
#endif
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgproc/types_c.h>
namespace rtabmap { namespace rtabmap {
@@ -88,7 +92,7 @@ cv::Mat StereoBM::computeDisparity(
cv::Mat leftMono; cv::Mat leftMono;
if(leftImage.channels() == 3) if(leftImage.channels() == 3)
{ {
cv::cvtColor(leftImage, leftMono, CV_BGR2GRAY); cv::cvtColor(leftImage, leftMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
@@ -98,7 +102,7 @@ cv::Mat StereoBM::computeDisparity(
cv::Mat rightMono; cv::Mat rightMono;
if(rightImage.channels() == 3) if(rightImage.channels() == 3)
{ {
cv::cvtColor(rightImage, rightMono, CV_BGR2GRAY); cv::cvtColor(rightImage, rightMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
+7 -3
View File
@@ -27,9 +27,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/core/stereo/StereoSGBM.h> #include <rtabmap/core/stereo/StereoSGBM.h>
#include <rtabmap/utilite/ULogger.h> #include <rtabmap/utilite/ULogger.h>
#if CV_MAJOR_VERSION < 5
#include <opencv2/calib3d/calib3d.hpp> #include <opencv2/calib3d/calib3d.hpp>
#else
#include <opencv2/stereo.hpp>
#include <opencv2/geometry.hpp>
#endif
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgproc/types_c.h>
namespace rtabmap { namespace rtabmap {
@@ -77,7 +81,7 @@ cv::Mat StereoSGBM::computeDisparity(
cv::Mat leftMono; cv::Mat leftMono;
if(leftImage.channels() == 3) if(leftImage.channels() == 3)
{ {
cv::cvtColor(leftImage, leftMono, CV_BGR2GRAY); cv::cvtColor(leftImage, leftMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
@@ -87,7 +91,7 @@ cv::Mat StereoSGBM::computeDisparity(
cv::Mat rightMono; cv::Mat rightMono;
if(rightImage.channels() == 3) if(rightImage.channels() == 3)
{ {
cv::cvtColor(rightImage, rightMono, CV_BGR2GRAY); cv::cvtColor(rightImage, rightMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
+9 -5
View File
@@ -34,11 +34,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UStl.h> #include <rtabmap/utilite/UStl.h>
#include <rtabmap/core/util3d_transforms.h> #include <rtabmap/core/util3d_transforms.h>
#include <rtabmap/core/StereoDense.h> #include <rtabmap/core/StereoDense.h>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/video/tracking.hpp> #include <opencv2/video/tracking.hpp>
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/types_c.h>
#include <map> #include <map>
#include <Eigen/Core> #include <Eigen/Core>
@@ -46,6 +44,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <opencv2/photo/photo.hpp> #include <opencv2/photo/photo.hpp>
#endif #endif
#if CV_MAJOR_VERSION < 5
#include <opencv2/calib3d/calib3d.hpp>
#else
#include <opencv2/geometry.hpp>
#endif
namespace rtabmap namespace rtabmap
{ {
@@ -747,7 +751,7 @@ cv::Mat disparityFromStereoImages(
cv::Mat leftMono; cv::Mat leftMono;
if(leftImage.channels() == 3) if(leftImage.channels() == 3)
{ {
cv::cvtColor(leftImage, leftMono, CV_BGR2GRAY); cv::cvtColor(leftImage, leftMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
@@ -2042,8 +2046,8 @@ cv::Mat brightnessAndContrastAuto(const cv::Mat &src, const cv::Mat & mask, floa
//to calculate grayscale histogram //to calculate grayscale histogram
cv::Mat gray; cv::Mat gray;
if (src.type() == CV_8UC1) gray = src; if (src.type() == CV_8UC1) gray = src;
else if (src.type() == CV_8UC3) cvtColor(src, gray, CV_BGR2GRAY); else if (src.type() == CV_8UC3) cvtColor(src, gray, cv::COLOR_BGR2GRAY);
else if (src.type() == CV_8UC4) cvtColor(src, gray, CV_BGRA2GRAY); else if (src.type() == CV_8UC4) cvtColor(src, gray, cv::COLOR_BGRA2GRAY);
if (clipLowHistPercent == 0 && clipHighHistPercent == 0) if (clipLowHistPercent == 0 && clipHighHistPercent == 0)
{ {
// keep full available range // keep full available range
+4 -5
View File
@@ -41,7 +41,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <pcl/common/transforms.h> #include <pcl/common/transforms.h>
#include <pcl/common/common.h> #include <pcl/common/common.h>
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgproc/types_c.h>
namespace rtabmap namespace rtabmap
{ {
@@ -892,7 +891,7 @@ pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudFromStereoImages(
cv::Mat leftMono; cv::Mat leftMono;
if(leftColor.channels() == 3) if(leftColor.channels() == 3)
{ {
cv::cvtColor(leftColor, leftMono, CV_BGR2GRAY); cv::cvtColor(leftColor, leftMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
@@ -902,7 +901,7 @@ pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudFromStereoImages(
cv::Mat rightMono; cv::Mat rightMono;
if(rightColor.channels() == 3) if(rightColor.channels() == 3)
{ {
cv::cvtColor(rightColor, rightMono, CV_BGR2GRAY); cv::cvtColor(rightColor, rightMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
@@ -1038,7 +1037,7 @@ std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> cloudsFromSensorData(
cv::Mat leftMono; cv::Mat leftMono;
if(sensorData.imageRaw().channels() == 3) if(sensorData.imageRaw().channels() == 3)
{ {
cv::cvtColor(sensorData.imageRaw(), leftMono, CV_BGR2GRAY); cv::cvtColor(sensorData.imageRaw(), leftMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
@@ -1048,7 +1047,7 @@ std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> cloudsFromSensorData(
cv::Mat rightMono; cv::Mat rightMono;
if(sensorData.rightRaw().channels() == 3) if(sensorData.rightRaw().channels() == 3)
{ {
cv::cvtColor(sensorData.rightRaw(), rightMono, CV_BGR2GRAY); cv::cvtColor(sensorData.rightRaw(), rightMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
+4
View File
@@ -30,7 +30,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UStl.h> #include <rtabmap/utilite/UStl.h>
#include <rtabmap/core/EpipolarGeometry.h> #include <rtabmap/core/EpipolarGeometry.h>
#if CV_MAJOR_VERSION < 5
#include <opencv2/calib3d/calib3d.hpp> #include <opencv2/calib3d/calib3d.hpp>
#else
#include <opencv2/geometry.hpp>
#endif
#include <pcl/search/kdtree.h> #include <pcl/search/kdtree.h>
#include <pcl/common/point_tests.h> #include <pcl/common/point_tests.h>
+7 -9
View File
@@ -39,8 +39,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/UConversion.h" #include "rtabmap/utilite/UConversion.h"
#include "rtabmap/utilite/UMath.h" #include "rtabmap/utilite/UMath.h"
#include "rtabmap/utilite/UTimer.h" #include "rtabmap/utilite/UTimer.h"
#include <opencv2/core/core_c.h>
#include <opencv2/imgproc/types_c.h>
#include <pcl/search/kdtree.h> #include <pcl/search/kdtree.h>
#include <pcl/surface/gp3.h> #include <pcl/surface/gp3.h>
#include <pcl/features/normal_3d_omp.h> #include <pcl/features/normal_3d_omp.h>
@@ -1745,7 +1743,7 @@ cv::Mat mergeTextures(
if(resizedImage.type() == CV_8UC1) if(resizedImage.type() == CV_8UC1)
{ {
cv::Mat resizedImageColor; cv::Mat resizedImageColor;
cv::cvtColor(resizedImage, resizedImageColor, CV_GRAY2BGR); cv::cvtColor(resizedImage, resizedImageColor, cv::COLOR_GRAY2BGR);
resizedImage = resizedImageColor; resizedImage = resizedImageColor;
} }
UASSERT(resizedImage.type() == globalTextures.type()); UASSERT(resizedImage.type() == globalTextures.type());
@@ -2609,7 +2607,7 @@ bool multiBandTexturing(
if(imageRoi.channels() == 1) if(imageRoi.channels() == 1)
{ {
cv::Mat imageRoiColor; cv::Mat imageRoiColor;
cv::cvtColor(imageRoi, imageRoiColor, CV_GRAY2BGR); cv::cvtColor(imageRoi, imageRoiColor, cv::COLOR_GRAY2BGR);
imageRoi = imageRoiColor; imageRoi = imageRoiColor;
} }
@@ -3218,7 +3216,7 @@ float computeNormalsComplexity(
} }
if(oi>1) if(oi>1)
{ {
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), CV_PCA_DATA_AS_ROW); cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), cv::PCA::DATA_AS_ROW);
if(pcaEigenVectors) if(pcaEigenVectors)
{ {
@@ -3279,7 +3277,7 @@ float computeNormalsComplexity(
} }
if(oi>1) if(oi>1)
{ {
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), CV_PCA_DATA_AS_ROW); cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), cv::PCA::DATA_AS_ROW);
if(pcaEigenVectors) if(pcaEigenVectors)
{ {
@@ -3335,7 +3333,7 @@ float computeNormalsComplexity(
} }
if(oi>1) if(oi>1)
{ {
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), CV_PCA_DATA_AS_ROW); cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), cv::PCA::DATA_AS_ROW);
if(pcaEigenVectors) if(pcaEigenVectors)
{ {
@@ -3391,7 +3389,7 @@ float computeNormalsComplexity(
} }
if(oi>1) if(oi>1)
{ {
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), CV_PCA_DATA_AS_ROW); cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), cv::PCA::DATA_AS_ROW);
if(pcaEigenVectors) if(pcaEigenVectors)
{ {
@@ -3447,7 +3445,7 @@ float computeNormalsComplexity(
} }
if(oi>1) if(oi>1)
{ {
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), CV_PCA_DATA_AS_ROW); cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), cv::PCA::DATA_AS_ROW);
if(pcaEigenVectors) if(pcaEigenVectors)
{ {
@@ -36,7 +36,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QtCore/QSet> #include <QtCore/QSet>
#include <QtGui/QImage> #include <QtGui/QImage>
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
#include <set> #include <set>
#include <vector> #include <vector>
#include <pcl/point_cloud.h> #include <pcl/point_cloud.h>
+5
View File
@@ -34,7 +34,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QtCore/QRectF> #include <QtCore/QRectF>
#include <QtCore/QMultiMap> #include <QtCore/QMultiMap>
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <opencv2/core/version.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
#include <map> #include <map>
#include "rtabmap/utilite/UCv2Qt.h" #include "rtabmap/utilite/UCv2Qt.h"
#include <rtabmap/core/CameraModel.h> #include <rtabmap/core/CameraModel.h>
@@ -34,7 +34,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QGraphicsTextItem> #include <QGraphicsTextItem>
#include <QtGui/QPen> #include <QtGui/QPen>
#include <QtGui/QBrush> #include <QtGui/QBrush>
#include <opencv2/core/version.hpp>
#if CV_MAJOR_VERSION < 5
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#else
#include <opencv2/features.hpp>
#endif
namespace rtabmap { namespace rtabmap {
+16 -10
View File
@@ -30,13 +30,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgproc/imgproc_c.h> #if CV_MAJOR_VERSION >= 5
#include <opencv2/calib.hpp>
#include <opencv2/geometry.hpp>
#else
#include <opencv2/calib3d/calib3d.hpp> #include <opencv2/calib3d/calib3d.hpp>
#if CV_MAJOR_VERSION >= 3 #if CV_MAJOR_VERSION >= 3
#include <opencv2/calib3d/calib3d_c.h> #include <opencv2/calib3d/calib3d_c.h>
#endif #endif
#endif
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.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))) #if (CV_MAJOR_VERSION > 2 and CV_MAJOR_VERSION < 5) or (CV_MAJOR_VERSION == 2 and (CV_MINOR_VERSION >4 or (CV_MINOR_VERSION == 4 and CV_SUBMINOR_VERSION >=10)))
#include <rtabmap/core/stereo/stereoRectifyFisheye.h> #include <rtabmap/core/stereo/stereoRectifyFisheye.h>
#endif #endif
@@ -737,7 +741,7 @@ void CalibrationDialog::processImages(const cv::Mat & imageLeft, const cv::Mat &
cv::Size boardSize(ui_->spinBox_boardWidth->value(), ui_->spinBox_boardHeight->value()); cv::Size boardSize(ui_->spinBox_boardWidth->value(), ui_->spinBox_boardHeight->value());
if(!viewGray.empty()) if(!viewGray.empty())
{ {
int flags = CV_CALIB_CB_ADAPTIVE_THRESH | CV_CALIB_CB_NORMALIZE_IMAGE; int flags = cv::CALIB_CB_ADAPTIVE_THRESH | cv::CALIB_CB_NORMALIZE_IMAGE;
if(!viewGray.empty()) if(!viewGray.empty())
{ {
@@ -748,7 +752,7 @@ void CalibrationDialog::processImages(const cv::Mat & imageLeft, const cv::Mat &
if( scale == 1 ) if( scale == 1 )
timg = viewGray; timg = viewGray;
else else
cv::resize(viewGray, timg, cv::Size(), scale, scale, CV_INTER_CUBIC); cv::resize(viewGray, timg, cv::Size(), scale, scale, cv::INTER_CUBIC);
#ifdef HAVE_CHARUCO #ifdef HAVE_CHARUCO
if(ui_->comboBox_board_type->currentIndex() >= 1 ) if(ui_->comboBox_board_type->currentIndex() >= 1 )
@@ -833,7 +837,7 @@ void CalibrationDialog::processImages(const cv::Mat & imageLeft, const cv::Mat &
float ratio = ui_->comboBox_board_type->currentIndex() >= 1 ?6.0f:2.0f; float ratio = ui_->comboBox_board_type->currentIndex() >= 1 ?6.0f:2.0f;
float radius = minSquareDistance==-1.0f?5.0f:(minSquareDistance/ratio); float radius = minSquareDistance==-1.0f?5.0f:(minSquareDistance/ratio);
cv::cornerSubPix( viewGray, pointBuf[id], cv::Size(radius, radius), cv::Size(-1,-1), cv::cornerSubPix( viewGray, pointBuf[id], cv::Size(radius, radius), cv::Size(-1,-1),
cv::TermCriteria( CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1 )); cv::TermCriteria( cv::TermCriteria::EPS + cv::TermCriteria::MAX_ITER, 30, 0.1 ));
// Filter points that drifted to far (caused by reflection or bad subpixel gradient) // Filter points that drifted to far (caused by reflection or bad subpixel gradient)
float threshold = ui_->doubleSpinBox_subpixel_error->value(); float threshold = ui_->doubleSpinBox_subpixel_error->value();
@@ -1473,7 +1477,7 @@ void CalibrationDialog::calibrate()
{ {
cv::projectPoints( cv::Mat(objectPoints_[id][i]), rvecs[i], tvecs[i], K, D, imagePoints2); cv::projectPoints( cv::Mat(objectPoints_[id][i]), rvecs[i], tvecs[i], K, D, imagePoints2);
} }
err = cv::norm(cv::Mat(imagePoints_[id][i]), cv::Mat(imagePoints2), CV_L2); err = cv::norm(cv::Mat(imagePoints_[id][i]), cv::Mat(imagePoints2), cv::NORM_L2);
int n = (int)objectPoints_[id][i].size(); int n = (int)objectPoints_[id][i].size();
reprojErrs[i] = (float) std::sqrt(err*err/n); reprojErrs[i] = (float) std::sqrt(err*err/n);
@@ -1750,19 +1754,21 @@ StereoCameraModel CalibrationDialog::stereoCalibration(const CameraModel & left,
UINFO("Compute stereo rectification"); UINFO("Compute stereo rectification");
cv::Mat R1, R2, P1, P2, Q; cv::Mat R1, R2, P1, P2, Q;
#if CV_MAJOR_VERSION < 5
stereoRectifyFisheye( stereoRectifyFisheye(
left.K_raw(), D_left, left.K_raw(), D_left,
right.K_raw(), D_right, right.K_raw(), D_right,
imageSize, R, Tvec, R1, R2, P1, P2, Q, imageSize, R, Tvec, R1, R2, P1, P2, Q,
cv::CALIB_ZERO_DISPARITY, 0, imageSize); cv::CALIB_ZERO_DISPARITY, 0, imageSize);
#else
// Very hard to get good results with this one: // Very hard to get good results with this one, however we cannot use the previous one anymore in opencv5
/*double balance = 0.0, fov_scale = 1.0; double balance = 0.0, fov_scale = 1.0;
cv::fisheye::stereoRectify( cv::fisheye::stereoRectify(
left.K_raw(), D_left, left.K_raw(), D_left,
right.K_raw(), D_right, right.K_raw(), D_right,
imageSize, R, Tvec, R1, R2, P1, P2, Q, imageSize, R, Tvec, R1, R2, P1, P2, Q,
cv::CALIB_ZERO_DISPARITY, imageSize, balance, fov_scale);*/ cv::CALIB_ZERO_DISPARITY, imageSize, balance, fov_scale);
#endif
std::cout << "R1 = " << R1 << std::endl; std::cout << "R1 = " << R1 << std::endl;
std::cout << "R2 = " << R2 << std::endl; std::cout << "R2 = " << R2 << std::endl;
+2 -4
View File
@@ -46,8 +46,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/ULogger.h> #include <rtabmap/utilite/ULogger.h>
#include <rtabmap/utilite/UDirectory.h> #include <rtabmap/utilite/UDirectory.h>
#include <rtabmap/utilite/UConversion.h> #include <rtabmap/utilite/UConversion.h>
#include <opencv2/core/core_c.h>
#include <opencv2/imgproc/types_c.h>
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <rtabmap/utilite/UFile.h> #include <rtabmap/utilite/UFile.h>
@@ -5980,7 +5978,7 @@ void DatabaseViewer::updateStereo(const SensorData * data)
cv::Mat leftMono; cv::Mat leftMono;
if(data->imageRaw().channels() == 3) if(data->imageRaw().channels() == 3)
{ {
cv::cvtColor(data->imageRaw(), leftMono, CV_BGR2GRAY); cv::cvtColor(data->imageRaw(), leftMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
@@ -5989,7 +5987,7 @@ void DatabaseViewer::updateStereo(const SensorData * data)
cv::Mat rightMono; cv::Mat rightMono;
if(data->rightRaw().channels() == 3) if(data->rightRaw().channels() == 3)
{ {
cv::cvtColor(data->rightRaw(), rightMono, CV_BGR2GRAY); cv::cvtColor(data->rightRaw(), rightMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
+4
View File
@@ -93,6 +93,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QInputDialog> #include <QInputDialog>
#include <QToolButton> #include <QToolButton>
#if CV_MAJOR_VERSION >= 5
#include <opencv2/geometry.hpp>
#endif
//RGB-D stuff //RGB-D stuff
#include "rtabmap/core/CameraRGBD.h" #include "rtabmap/core/CameraRGBD.h"
#include "rtabmap/core/Odometry.h" #include "rtabmap/core/Odometry.h"
+10 -10
View File
@@ -2639,19 +2639,19 @@ void PreferencesDialog::restoreConfigOwnership(const QString & filePath)
gid_t gid = (gid_t)atoi(sudoGid); gid_t gid = (gid_t)atoi(sudoGid);
// Restore the config file and its containing directory so the user // Restore the config file and its containing directory so the user
// can still write preferences without sudo afterwards. // can still write preferences without sudo afterwards.
if(!filePath.isEmpty() && QFile::exists(filePath)) auto restoreOwnership = [uid, gid](const QString & path)
{ {
if(chown(filePath.toStdString().c_str(), uid, gid) != 0) if(!path.isEmpty() && QFile::exists(path))
{ {
UWARN("Could not restore ownership of \"%s\" to uid=%d (%s).", if(chown(path.toStdString().c_str(), uid, gid) != 0)
filePath.toStdString().c_str(), (int)uid, strerror(errno)); {
UWARN("Could not restore ownership of \"%s\" to uid=%d (%s).",
path.toStdString().c_str(), (int)uid, strerror(errno));
}
} }
} };
QString dir = QFileInfo(filePath).absolutePath(); restoreOwnership(filePath);
if(!dir.isEmpty()) restoreOwnership(QFileInfo(filePath).absolutePath());
{
chown(dir.toStdString().c_str(), uid, gid);
}
} }
} }
#else #else
+1 -2
View File
@@ -32,7 +32,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/UDirectory.h" #include "rtabmap/utilite/UDirectory.h"
#include "rtabmap/utilite/UConversion.h" #include "rtabmap/utilite/UConversion.h"
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
#include <opencv2/highgui/highgui_c.h>
#include <stdio.h> #include <stdio.h>
void showUsage() void showUsage()
@@ -178,7 +177,7 @@ int main(int argc, char * argv[])
cv::Mat rgb; cv::Mat rgb;
rgb = camera->takeImage().imageRaw(); rgb = camera->takeImage().imageRaw();
cv::namedWindow("Video", CV_WINDOW_AUTOSIZE); // create window cv::namedWindow("Video", cv::WINDOW_AUTOSIZE); // create window
while(!rgb.empty()) while(!rgb.empty())
{ {
cv::imshow("Video", rgb); // show frame cv::imshow("Video", rgb); // show frame
+4 -3
View File
@@ -40,8 +40,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/UEventsManager.h" #include "rtabmap/utilite/UEventsManager.h"
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgproc/types_c.h> #if CV_MAJOR_VERSION >= 5
#if CV_MAJOR_VERSION >= 3 #include <opencv2/videoio.hpp>
#elif CV_MAJOR_VERSION >= 3
#include <opencv2/videoio/videoio_c.h> #include <opencv2/videoio/videoio_c.h>
#endif #endif
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
@@ -470,7 +471,7 @@ int main(int argc, char * argv[])
{ {
if(right.channels() == 3) if(right.channels() == 3)
{ {
cv::cvtColor(right, right, CV_BGR2GRAY); cv::cvtColor(right, right, cv::COLOR_BGR2GRAY);
} }
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud = rtabmap::util3d::cloudFromStereoImages( pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud = rtabmap::util3d::cloudFromStereoImages(
rgb, right, rgb, right,
+4 -1
View File
@@ -26,7 +26,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#include <opencv2/core/types_c.h>
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <iostream> #include <iostream>
@@ -36,7 +35,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UDirectory.h> #include <rtabmap/utilite/UDirectory.h>
#include <rtabmap/utilite/UStl.h> #include <rtabmap/utilite/UStl.h>
#include <rtabmap/utilite/UMath.h> #include <rtabmap/utilite/UMath.h>
#if CV_MAJOR_VERSION < 5
#include <opencv2/calib3d/calib3d.hpp> #include <opencv2/calib3d/calib3d.hpp>
#else
#include <opencv2/geometry.hpp>
#endif
#include "rtabmap/core/Features2d.h" #include "rtabmap/core/Features2d.h"
#include "rtabmap/core/EpipolarGeometry.h" #include "rtabmap/core/EpipolarGeometry.h"
#include "rtabmap/core/VWDictionary.h" #include "rtabmap/core/VWDictionary.h"
+3 -4
View File
@@ -37,7 +37,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UConversion.h> #include <rtabmap/utilite/UConversion.h>
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <rtabmap/utilite/UMath.h> #include <rtabmap/utilite/UMath.h>
#include <opencv2/imgproc/types_c.h>
#include <fstream> #include <fstream>
#include <string> #include <string>
@@ -222,7 +221,7 @@ int main(int argc, char * argv[])
cv::Mat leftMono; cv::Mat leftMono;
if(left.channels() == 3) if(left.channels() == 3)
{ {
cv::cvtColor(left, leftMono, CV_BGR2GRAY); cv::cvtColor(left, leftMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
@@ -231,7 +230,7 @@ int main(int argc, char * argv[])
cv::Mat rightMono; cv::Mat rightMono;
if(right.channels() == 3) if(right.channels() == 3)
{ {
cv::cvtColor(right, rightMono, CV_BGR2GRAY); cv::cvtColor(right, rightMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
@@ -266,7 +265,7 @@ int main(int argc, char * argv[])
cv::cornerSubPix(leftMono, leftCorners, cv::cornerSubPix(leftMono, leftCorners,
cv::Size( subPixWinSize, subPixWinSize ), cv::Size( subPixWinSize, subPixWinSize ),
cv::Size( -1, -1 ), cv::Size( -1, -1 ),
cv::TermCriteria( CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, subPixIterations, subPixEps ) ); cv::TermCriteria( cv::TermCriteria::MAX_ITER | cv::TermCriteria::EPS, subPixIterations, subPixEps ) );
UDEBUG("cv::cornerSubPix() end"); UDEBUG("cv::cornerSubPix() end");
} }