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
+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/UConversion.h"
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/highgui/highgui_c.h>
#include <stdio.h>
void showUsage()
@@ -178,7 +177,7 @@ int main(int argc, char * argv[])
cv::Mat rgb;
rgb = camera->takeImage().imageRaw();
cv::namedWindow("Video", CV_WINDOW_AUTOSIZE); // create window
cv::namedWindow("Video", cv::WINDOW_AUTOSIZE); // create window
while(!rgb.empty())
{
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 <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgproc/types_c.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>
#endif
#include <pcl/visualization/cloud_viewer.h>
@@ -470,7 +471,7 @@ int main(int argc, char * argv[])
{
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(
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/types_c.h>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
@@ -36,7 +35,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UDirectory.h>
#include <rtabmap/utilite/UStl.h>
#include <rtabmap/utilite/UMath.h>
#if CV_MAJOR_VERSION < 5
#include <opencv2/calib3d/calib3d.hpp>
#else
#include <opencv2/geometry.hpp>
#endif
#include "rtabmap/core/Features2d.h"
#include "rtabmap/core/EpipolarGeometry.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/UTimer.h>
#include <rtabmap/utilite/UMath.h>
#include <opencv2/imgproc/types_c.h>
#include <fstream>
#include <string>
@@ -222,7 +221,7 @@ int main(int argc, char * argv[])
cv::Mat leftMono;
if(left.channels() == 3)
{
cv::cvtColor(left, leftMono, CV_BGR2GRAY);
cv::cvtColor(left, leftMono, cv::COLOR_BGR2GRAY);
}
else
{
@@ -231,7 +230,7 @@ int main(int argc, char * argv[])
cv::Mat rightMono;
if(right.channels() == 3)
{
cv::cvtColor(right, rightMono, CV_BGR2GRAY);
cv::cvtColor(right, rightMono, cv::COLOR_BGR2GRAY);
}
else
{
@@ -266,7 +265,7 @@ int main(int argc, char * argv[])
cv::cornerSubPix(leftMono, leftCorners,
cv::Size( subPixWinSize, subPixWinSize ),
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");
}