update svn to revision 719
This commit is contained in:
parent
b135839c2a
commit
efb86ac6fd
12 changed files with 83 additions and 20 deletions
BIN
.svn/wc.db
BIN
.svn/wc.db
Binary file not shown.
|
@ -113,6 +113,11 @@ public:
|
|||
//! Create a new set of reduced points
|
||||
DataXYZ createXYZReduced(unsigned int size);
|
||||
|
||||
|
||||
//! Create a new set of reflectance
|
||||
DataReflectance createReflectance(unsigned int size);
|
||||
|
||||
|
||||
//! Reduced untransformed points
|
||||
DataXYZ getXYZReducedOriginal();
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <opencv2/opencv.hpp>
|
||||
//for opencv 2.4
|
||||
#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 4)
|
||||
#include <opencv2/nonfree/nonfree.hpp>
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include <string>
|
||||
#include "slam6d/io_types.h"
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace fbr{
|
|||
double zMax;
|
||||
double zMin;
|
||||
IOType sFormat;
|
||||
bool scanserver;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -41,8 +42,9 @@ namespace fbr{
|
|||
* @param dir directory of the input scan file
|
||||
* @param number input scan number
|
||||
* @param format input scan file format
|
||||
* @param scanServer
|
||||
*/
|
||||
scan_cv (string dir, unsigned int number, IOType format);
|
||||
scan_cv (string dir, unsigned int number, IOType format, bool scanServer);
|
||||
/**
|
||||
* @brief read scan file and convert it to open cv Mat
|
||||
*/
|
||||
|
|
|
@ -18,7 +18,7 @@ set(CLIENT_LIBS ${Boost_LIBRARIES} pointfilter)
|
|||
|
||||
if(UNIX AND NOT APPLE)
|
||||
# boost::interprocess uses pthread, requiring librt
|
||||
#set(CLIENT_LIBS ${CLIENT_LIBS} rt)
|
||||
set(CLIENT_LIBS ${CLIENT_LIBS} rt)
|
||||
endif(UNIX AND NOT APPLE)
|
||||
|
||||
target_link_libraries(scanclient ${CLIENT_LIBS})
|
||||
|
@ -40,10 +40,10 @@ add_executable(scanserver ${SERVER_SRCS})
|
|||
# scanio for ScanHandler input
|
||||
set(SERVER_LIBS ${Boost_LIBRARIES} scanclient scanio)
|
||||
|
||||
if(UNIX)
|
||||
if(UNIX AND NOT APPLE)
|
||||
# boost::interprocess uses pthread, requiring librt
|
||||
set(SERVER_LIBS ${SERVER_LIBS} rt)
|
||||
endif(UNIX)
|
||||
endif(UNIX AND NOT APPLE)
|
||||
|
||||
if(WIN32)
|
||||
# 3rd party getopt library
|
||||
|
|
|
@ -238,6 +238,13 @@ DataXYZ SharedScan::createXYZReduced(unsigned int size) {
|
|||
return m_xyz_reduced->createCacheData<SharedScan::onAllocation>(size*3*sizeof(double));
|
||||
}
|
||||
|
||||
|
||||
DataReflectance SharedScan::createReflectance(unsigned int size) {
|
||||
// size is in units of double[1], scale to bytes
|
||||
return m_reflectance->createCacheData<SharedScan::onAllocation>(size*1*sizeof(double));
|
||||
}
|
||||
|
||||
|
||||
DataXYZ SharedScan::getXYZReducedOriginal() {
|
||||
return m_xyz_reduced_original->getCacheData<SharedScan::onCacheMiss>();
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@ SET(FBR_IO_SRC scan_cv.cc)
|
|||
add_library(fbr_cv_io STATIC ${FBR_IO_SRC})
|
||||
|
||||
SET(FBR_PANORAMA_SRC panorama.cc)
|
||||
add_library(fbr_panorama STATIC ${FBR_PANORAMA_SRC} fbr_global.cc)
|
||||
add_library(fbr_panorama STATIC ${FBR_PANORAMA_SRC})
|
||||
#add_library(fbr_panorama STATIC ${FBR_PANORAMA_SRC} fbr_global.cc)
|
||||
|
||||
|
||||
SET(FBR_FEATURE_SRC feature.cc)
|
||||
add_library(fbr_feature STATIC ${FBR_FEATURE_SRC})
|
||||
|
@ -15,9 +17,12 @@ add_library(fbr_feature_matcher STATIC ${FBR_FEATURE_MATCHER_SRC})
|
|||
SET(FBR_REGISTRATION_SRC registration.cc)
|
||||
add_library(fbr_registration STATIC ${FBR_REGISTRATION_SRC})
|
||||
|
||||
add_library(fbr STATIC ${FBR_IO_SRC} ${FBR_PANORAMA_SRC} ${FBR_FEATURE_SRC} ${FBR_FEATURE_MATCHER_SRC} ${FBR_REGISTRATION_SRC} fbr_global.cc)
|
||||
|
||||
IF(WITH_FBR)
|
||||
SET(FBR_LIBS scan ANN ${OpenCV_LIBS})
|
||||
|
||||
add_executable(featurebasedregistration feature_based_registration.cc fbr_global.cc)
|
||||
target_link_libraries(featurebasedregistration fbr_cv_io fbr_panorama fbr_feature fbr_feature_matcher fbr_registration ${FBR_LIBS})
|
||||
#target_link_libraries(featurebasedregistration fbr_cv_io fbr_panorama fbr_feature fbr_feature_matcher fbr_registration ${FBR_LIBS})
|
||||
target_link_libraries(featurebasedregistration fbr ${FBR_LIBS})
|
||||
ENDIF(WITH_FBR)
|
||||
|
|
|
@ -30,6 +30,7 @@ struct information{
|
|||
feature_descriptor_method dMethod;
|
||||
matcher_method mMethod;
|
||||
registration_method rMethod;
|
||||
bool scanServer;
|
||||
|
||||
int fSPoints, sSPoints, fFNum, sFNum, mNum, filteredMNum;
|
||||
double fSTime, sSTime, fPTime, sPTime, fFTime, sFTime, fDTime, sDTime, mTime, rTime;
|
||||
|
@ -60,6 +61,7 @@ void usage(int argc, char** argv){
|
|||
printf("\t\t-r registration \t registration method [ALL|ransac]\n");
|
||||
printf("\t\t-V verbose \t\t level of verboseness\n");
|
||||
printf("\t\t-O outDir \t\t output directory if not stated same as input\n");
|
||||
printf("\t\t-S scanServer \t\t Scan Server\n");
|
||||
printf("\n");
|
||||
printf("\tExamples:\n");
|
||||
printf("\tUsing Bremen City dataset:\n");
|
||||
|
@ -101,11 +103,12 @@ void parssArgs(int argc, char** argv, information& info){
|
|||
info.mMethod = RATIO;
|
||||
info.rMethod = RANSAC;
|
||||
info.outDir = "";
|
||||
info.scanServer = false;
|
||||
|
||||
int c;
|
||||
opterr = 0;
|
||||
//reade the command line and get the options
|
||||
while ((c = getopt (argc, argv, "F:W:H:p:N:P:f:d:m:D:E:I:M:r:V:O:s:e:")) != -1)
|
||||
while ((c = getopt (argc, argv, "F:W:H:p:N:P:f:d:m:D:E:I:M:r:V:O:s:e:S")) != -1)
|
||||
switch (c)
|
||||
{
|
||||
case 's':
|
||||
|
@ -162,6 +165,9 @@ void parssArgs(int argc, char** argv, information& info){
|
|||
case 'O':
|
||||
info.outDir = optarg;
|
||||
break;
|
||||
case 'S':
|
||||
info.scanServer = true;
|
||||
break;
|
||||
case '?':
|
||||
cout<<"Unknown option character "<<optopt<<endl;
|
||||
usage(argc, argv);
|
||||
|
@ -292,12 +298,13 @@ void info_yml(information info, double bError, double bErrorIdx, double* bAlign)
|
|||
}
|
||||
|
||||
int main(int argc, char** argv){
|
||||
cout<<CV_VERSION<<endl;
|
||||
string out;
|
||||
cv::Mat outImage;
|
||||
parssArgs(argc, argv, info);
|
||||
if(info.verbose >= 1) informationDescription(info);
|
||||
|
||||
scan_cv fScan (info.dir, info.fScanNumber, info.sFormat);
|
||||
scan_cv fScan (info.dir, info.fScanNumber, info.sFormat, info.scanServer);
|
||||
if(info.verbose >= 4) info.fSTime = (double)cv::getTickCount();
|
||||
fScan.convertScanToMat();
|
||||
if(info.verbose >= 4) info.fSTime = ((double)cv::getTickCount() - info.fSTime)/cv::getTickFrequency();
|
||||
|
@ -328,7 +335,7 @@ int main(int argc, char** argv){
|
|||
if(info.verbose >= 4) info.fDTime = ((double)cv::getTickCount() - info.fDTime)/cv::getTickFrequency();
|
||||
if(info.verbose >= 2) fFeature.getDescription();
|
||||
|
||||
scan_cv sScan (info.dir, info.sScanNumber, info.sFormat);
|
||||
scan_cv sScan (info.dir, info.sScanNumber, info.sFormat, info.scanServer);
|
||||
if(info.verbose >= 4) info.sSTime = (double)cv::getTickCount();
|
||||
sScan.convertScanToMat();
|
||||
if(info.verbose >= 4) info.sSTime = ((double)cv::getTickCount() - info.sSTime)/cv::getTickFrequency();
|
||||
|
|
|
@ -46,6 +46,11 @@ namespace fbr{
|
|||
void feature_matcher::match(feature qFeature, feature tFeature){
|
||||
vector< cv::DMatch > qtInitialMatches, tqInitialMatches, gMatches;
|
||||
vector<vector<cv::DMatch> > qtInitialMatchesVector, tqInitialMatchesVector;
|
||||
if(qFeature.getFeatures().size() == 0 || tFeature.getFeatures().size() == 0){
|
||||
cout<<"No features has found in one or both scans!!"<<endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
//Matching descriptors using one of the mMethods for SURF and SIFT feature descriptors
|
||||
if(qFeature.getDescriptorMethod() != tFeature.getDescriptorMethod()){
|
||||
cout<<"inputs features don't have the same descriptors!"<<endl;
|
||||
|
@ -99,10 +104,15 @@ namespace fbr{
|
|||
}
|
||||
}
|
||||
if(mMethod == BRUTEFORCE){
|
||||
//opencv 2.4
|
||||
#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 4)
|
||||
cv::BFMatcher matcher (cv::NORM_L2);
|
||||
#else //older version of opencv than 2.4
|
||||
cv::BruteForceMatcher< cv::L2<float> > matcher;
|
||||
#endif
|
||||
matcher.match(qFeature.getDescriptors(), tFeature.getDescriptors(), qtInitialMatches);
|
||||
matcher.match(tFeature.getDescriptors(), qFeature.getDescriptors(), tqInitialMatches);
|
||||
}
|
||||
}
|
||||
if(mMethod == FLANN){
|
||||
cv::FlannBasedMatcher matcher;
|
||||
matcher.match(qFeature.getDescriptors(), tFeature.getDescriptors(), qtInitialMatches);
|
||||
|
@ -123,12 +133,22 @@ namespace fbr{
|
|||
//Matching descriptors using BruteFore with Hamming distance for ORB descriptor
|
||||
else if(qFeature.getDescriptorMethod() == ORB_DES){
|
||||
if(mMethod == KNN){
|
||||
//opencv 2.4
|
||||
#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 4)
|
||||
cv::BFMatcher matcher (cv::NORM_HAMMING);
|
||||
#else //older version of opencv than 2.4
|
||||
cv::BruteForceMatcher< cv::Hamming > matcher;
|
||||
#endif
|
||||
matcher.knnMatch(qFeature.getDescriptors(), tFeature.getDescriptors(), qtInitialMatchesVector, knn);
|
||||
matcher.knnMatch(tFeature.getDescriptors(), qFeature.getDescriptors(), tqInitialMatchesVector, knn);
|
||||
}
|
||||
if(mMethod == RADIUS){
|
||||
//opencv 2.4
|
||||
#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 4)
|
||||
cv::BFMatcher matcher (cv::NORM_HAMMING);
|
||||
#else //older version of opencv than 2.4
|
||||
cv::BruteForceMatcher< cv::Hamming > matcher;
|
||||
#endif
|
||||
matcher.radiusMatch(qFeature.getDescriptors(), tFeature.getDescriptors(), qtInitialMatchesVector, radius);
|
||||
matcher.radiusMatch(tFeature.getDescriptors(), qFeature.getDescriptors(), tqInitialMatchesVector, radius);
|
||||
}
|
||||
|
@ -146,7 +166,12 @@ namespace fbr{
|
|||
}
|
||||
}
|
||||
if(mMethod == RATIO){
|
||||
//opencv 2.4
|
||||
#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 4)
|
||||
cv::BFMatcher matcher (cv::NORM_HAMMING);
|
||||
#else //older version of opencv than 2.4
|
||||
cv::BruteForceMatcher< cv::Hamming > matcher;
|
||||
#endif
|
||||
matcher.knnMatch(qFeature.getDescriptors(), tFeature.getDescriptors(), qtInitialMatchesVector, 2);
|
||||
for(unsigned int i = 0; i < qtInitialMatchesVector.size(); i++){
|
||||
float ratio = qtInitialMatchesVector[i][0].distance/qtInitialMatchesVector[i][1].distance;
|
||||
|
@ -167,7 +192,12 @@ namespace fbr{
|
|||
}
|
||||
}
|
||||
if(mMethod == BRUTEFORCE){
|
||||
//opencv 2.4
|
||||
#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 4)
|
||||
cv::BFMatcher matcher (cv::NORM_HAMMING);
|
||||
#else //older version of opencv than 2.4
|
||||
cv::BruteForceMatcher< cv::Hamming > matcher;
|
||||
#endif
|
||||
matcher.match(qFeature.getDescriptors(), tFeature.getDescriptors(), qtInitialMatches);
|
||||
matcher.match(tFeature.getDescriptors(), qFeature.getDescriptors(), tqInitialMatches);
|
||||
for(unsigned int i = 0; i < qtInitialMatches.size(); i++){
|
||||
|
|
|
@ -678,7 +678,7 @@ namespace fbr{
|
|||
float x = col * 1. / xFactor - fabs(xmin);
|
||||
float y = (heightMax - row) * 1. / yFactor - fabs(ymin);
|
||||
float theta = asin((C - (x*x + (Rho0 - y) * (Rho0 - y)) * n * n) / (2 * n));
|
||||
float phi = Long0 + (1./n) * atan2(x, Rho0 - y);
|
||||
float phi = Long0 + (1./n) * ::atan2(x, Rho0 - y);
|
||||
|
||||
phi *= 180.0 / M_PI;
|
||||
phi = 360.0 - phi;
|
||||
|
|
|
@ -13,17 +13,17 @@ using namespace std;
|
|||
|
||||
namespace fbr{
|
||||
|
||||
scan_cv::scan_cv(string dir, unsigned int number, IOType format){
|
||||
scan_cv::scan_cv(string dir, unsigned int number, IOType format, bool scanServer){
|
||||
sDir = dir;
|
||||
sNumber = number;
|
||||
sFormat = format;
|
||||
zMax = numeric_limits<double>::min();
|
||||
zMin = numeric_limits<double>::max();
|
||||
nPoints = 0;
|
||||
scanserver = scanServer;
|
||||
}
|
||||
|
||||
void scan_cv::convertScanToMat(){
|
||||
bool scanserver = false;
|
||||
Scan::openDirectory(scanserver, sDir, sFormat, sNumber, sNumber);
|
||||
if(Scan::allScans.size() == 0){
|
||||
cerr << "No scans found. Did you use the correct format?" <<endl;
|
||||
|
|
|
@ -226,8 +226,11 @@ DataPointer ManagedScan::create(const std::string& identifier, unsigned int size
|
|||
if(identifier == "xyz reduced original") {
|
||||
return m_shared_scan->createXYZReducedOriginal(size / (3*sizeof(double)));
|
||||
} else
|
||||
{
|
||||
throw runtime_error(string("Identifier '") + identifier + "' not compatible with ManagedScan::create. Upgrade SharedScan for this data field.");
|
||||
if(identifier == "reflectance") {
|
||||
return m_shared_scan->createReflectance(size / (1*sizeof(double)));
|
||||
} else
|
||||
{
|
||||
throw runtime_error(string("Identifier '") + identifier + "' not compatible with ManagedScan::create. Upgrade SharedScan for this data field.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue