Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:")
Expand Down
16 changes: 8 additions & 8 deletions src/LineMatching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
//
};
Expand All @@ -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<int> vser;
int nmatch = vstrLineMatch.size();
Expand All @@ -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 <<endl; //ÿ�������� tab ����
// outFile<< ser1 << ' ' << ser2 <<endl; //ÿ�������� tab ����
}
vector<int> vsidex;
sortIdx(vser, vsidex, SORT_EVERY_ROW);
Expand All @@ -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 <<endl; //ÿ�������� tab ����
outFile<< ser1 << ' ' << ser2 <<endl; //ÿ�������� tab ����
}
}

Expand Down Expand Up @@ -4231,7 +4231,7 @@ void CLineMatching::concatenateTwoImgs(Mat mImg1, Mat mImg2, Mat &outImg)
cvSetImageROI( stacked, cvRect(img1.width, 0, img2.width, img2.height) );
cvCopy(&img2, stacked);//, stacked, NULL );
cvResetImageROI(stacked);
outImg = Mat(stacked,0);
outImg = cv::cvarrToMat(stacked);
}

void CLineMatching::getPointsonPolarline(vector<Point2f> &PointSet1,vector<Point2f> &PointSet2, Mat_<double> F, double T, bool *pbIsKept)
Expand Down Expand Up @@ -4307,7 +4307,7 @@ void CLineMatching::findRobustFundamentalMat(vector<Point2f> &PointSet1,vector<P
{
unsigned i;
vector<uchar> status;
findFundamentalMat(PointSet1,PointSet2,CV_RANSAC, _fmatThr, 0.99, status);
findFundamentalMat(PointSet1,PointSet2,CV_FM_RANSAC, _fmatThr, 0.99, status);
int time = 0;
vector<Point2f> goodPoints1,goodPoints2;
for (i = 0; i < status.size(); i ++)
Expand All @@ -4318,9 +4318,9 @@ void CLineMatching::findRobustFundamentalMat(vector<Point2f> &PointSet1,vector<P
goodPoints2.push_back(PointSet2[i]);
}
}
Mat F = findFundamentalMat(goodPoints1, goodPoints2,CV_LMEDS, _fmatThr, 0.99, status);
Mat F = findFundamentalMat(goodPoints1, goodPoints2,CV_FM_LMEDS, _fmatThr, 0.99, status);
getPointsonPolarline(PointSet1, PointSet2, F, _fmatThr, pbIsKept);
FMat = findFundamentalMat(PointSet1, PointSet2,CV_LMEDS, _fmatThr, 0.99, status);
FMat = findFundamentalMat(PointSet1, PointSet2,CV_FM_LMEDS, _fmatThr, 0.99, status);
FMat.convertTo(FMat, CV_32F);
}

Expand Down
8 changes: 8 additions & 0 deletions src/LineMatching.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
#include <highgui.h>
#include "Timer.h"
#include <vector>

#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "opencv2/core/utility.hpp"
#include "opencv2/calib3d/calib3d.hpp"

using namespace cv;
using namespace std;
//////////////////////////////////////////////////////////
Expand Down