From a98aa24c8976b95520d9b0056d9715afe1eec5b7 Mon Sep 17 00:00:00 2001 From: Joan Pep Company Date: Thu, 4 Jul 2019 12:50:17 +0200 Subject: [PATCH] Modified to work in UBUNTU 18.04 and OPENCV3 --- CMakeLists.txt | 11 ++++++++++- src/LineMatching.cpp | 16 ++++++++-------- src/LineMatching.h | 8 ++++++++ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cdce28..cdcc942 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,16 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) SET(PROJECT_NAME LSM) PROJECT(${PROJECT_NAME}) -FIND_PACKAGE(OpenCV REQUIRED) + +find_package(OpenCV 3 REQUIRED opencv_core opencv_videoio opencv_imgcodecs opencv_imgproc opencv_calib3d opencv_highgui) + +if(NOT OpenCV_FOUND) + find_package(OpenCV 2.4.3 QUIET) + if(NOT OpenCV_FOUND) + message(FATAL_ERROR "OpenCV > 2.4.3 not found.") + endif() +endif() + INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) MESSAGE(STATUS "Project: ${PROJECT_NAME}") MESSAGE(STATUS "OpenCV library status:") diff --git a/src/LineMatching.cpp b/src/LineMatching.cpp index 07a9329..4923614 100644 --- a/src/LineMatching.cpp +++ b/src/LineMatching.cpp @@ -278,7 +278,7 @@ CLineMatching::CLineMatching(Mat img1, Mat line1, Mat tnode1, Mat img2, Mat li if (isVerbose) { plotLineMatches(colorImg1.clone(), colorImg2.clone(), vstrLineMatch, "Final line matches"); - waitKey(); + waitKey(0); } // }; @@ -291,7 +291,7 @@ void CLineMatching::descriptorEvaluationUniquePtMatches() void CLineMatching::lineMatches2Mat(Mat &mline) { string fileName = _outFileName; - ofstream outFile(fileName.c_str(), ios_base::out); //°´Ð½¨»ò¸²¸Ç·½Ê½Ð´Èë + ofstream outFile(fileName.c_str(), ios_base::out); //���½��ò¸²¸Ç·ï¿½Ê½Ð´ï¿½ï¿½ vector vser; int nmatch = vstrLineMatch.size(); @@ -305,7 +305,7 @@ void CLineMatching::lineMatches2Mat(Mat &mline) strline2[ser2].pe.x, strline2[ser2].pe.y); mline.push_back(tmat); vser.push_back(ser1); - // outFile<< ser1 << ' ' << ser2 < vsidex; sortIdx(vser, vsidex, SORT_EVERY_ROW); @@ -315,7 +315,7 @@ void CLineMatching::lineMatches2Mat(Mat &mline) int ser = vsidex.at(i); int ser1 = vstrLineMatch[ser].serLine1; int ser2 = vstrLineMatch[ser].serLine2; - outFile<< ser1 << ' ' << ser2 < &PointSet1,vector &PointSet2, Mat_ F, double T, bool *pbIsKept) @@ -4307,7 +4307,7 @@ void CLineMatching::findRobustFundamentalMat(vector &PointSet1,vector

status; - findFundamentalMat(PointSet1,PointSet2,CV_RANSAC, _fmatThr, 0.99, status); + findFundamentalMat(PointSet1,PointSet2,CV_FM_RANSAC, _fmatThr, 0.99, status); int time = 0; vector goodPoints1,goodPoints2; for (i = 0; i < status.size(); i ++) @@ -4318,9 +4318,9 @@ void CLineMatching::findRobustFundamentalMat(vector &PointSet1,vector

#include "Timer.h" #include + +#include +#include +#include +#include +#include "opencv2/core/utility.hpp" +#include "opencv2/calib3d/calib3d.hpp" + using namespace cv; using namespace std; //////////////////////////////////////////////////////////