Commit e39065bf authored by biagio montesano's avatar biagio montesano

Created nested namespace. Modified interface classes.

parent 92761997
...@@ -55,8 +55,10 @@ ...@@ -55,8 +55,10 @@
namespace cv namespace cv
{ {
namespace line_descriptor
{
CV_EXPORTS bool initModule_line_descriptor(); //CV_EXPORTS bool initModule_line_descriptor();
struct CV_EXPORTS KeyLine struct CV_EXPORTS KeyLine
{ {
...@@ -430,5 +432,6 @@ CV_EXPORTS void drawKeylines( const Mat& image, const std::vector<KeyLine>& keyl ...@@ -430,5 +432,6 @@ CV_EXPORTS void drawKeylines( const Mat& image, const std::vector<KeyLine>& keyl
int flags = DrawLinesMatchesFlags::DEFAULT ); int flags = DrawLinesMatchesFlags::DEFAULT );
} }
}
#endif #endif
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "perf_precomp.hpp" #include "perf_precomp.hpp"
using namespace cv; using namespace cv;
using namespace cv::line_descriptor;
using namespace std; using namespace std;
using namespace perf; using namespace perf;
using std::tr1::make_tuple; using std::tr1::make_tuple;
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "perf_precomp.hpp" #include "perf_precomp.hpp"
using namespace cv; using namespace cv;
using namespace cv::line_descriptor;
using namespace std; using namespace std;
using namespace perf; using namespace perf;
using std::tr1::make_tuple; using std::tr1::make_tuple;
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "perf_precomp.hpp" #include "perf_precomp.hpp"
using namespace cv; using namespace cv;
using namespace cv::line_descriptor;
using namespace std; using namespace std;
using namespace perf; using namespace perf;
using std::tr1::make_tuple; using std::tr1::make_tuple;
......
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
#include <iostream> #include <iostream>
using namespace cv; using namespace cv;
using namespace cv::line_descriptor;
static const char* keys = static const char* keys =
{ "{@image_path | | Image path }" }; { "{@image_path | | Image path }" };
...@@ -96,3 +98,5 @@ int main( int argc, char** argv ) ...@@ -96,3 +98,5 @@ int main( int argc, char** argv )
bd->compute( imageMat, keylines, descriptors); bd->compute( imageMat, keylines, descriptors);
} }
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <time.h> #include <time.h>
using namespace cv; using namespace cv;
using namespace cv::line_descriptor;
static const char* keys = static const char* keys =
{ "{@image_path1 | | Image path 1 }" { "{@image_path1 | | Image path 1 }"
...@@ -192,8 +193,6 @@ int main( int argc, char** argv ) ...@@ -192,8 +193,6 @@ int main( int argc, char** argv )
/* require knn match */ /* require knn match */
bdm->knnMatch( descr1, descr2, matches, 6 ); bdm->knnMatch( descr1, descr2, matches, 6 );
} }
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <iostream> #include <iostream>
using namespace cv; using namespace cv;
using namespace cv::line_descriptor;
using namespace std; using namespace std;
static const char* keys = static const char* keys =
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <iostream> #include <iostream>
using namespace cv; using namespace cv;
using namespace cv::line_descriptor;
using namespace std; using namespace std;
static const char* keys = static const char* keys =
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#define MATCHES_DIST_THRESHOLD 25 #define MATCHES_DIST_THRESHOLD 25
using namespace cv; using namespace cv;
using namespace cv::line_descriptor;
static const char* keys = static const char* keys =
{ "{@image_path1 | | Image path 1 }" { "{@image_path1 | | Image path 1 }"
...@@ -146,7 +147,7 @@ int main( int argc, char** argv ) ...@@ -146,7 +147,7 @@ int main( int argc, char** argv )
imshow( "Matches", outImg ); imshow( "Matches", outImg );
waitKey(); waitKey();
imwrite("/home/ubisum/Desktop/images/matches.jpg", outImg); imwrite("/home/ubisum/Desktop/images/env_match/matches.jpg", outImg);
/* create an LSD detector */ /* create an LSD detector */
Ptr<LSDDetector> lsd = LSDDetector::createLSDDetector(); Ptr<LSDDetector> lsd = LSDDetector::createLSDDetector();
...@@ -203,5 +204,7 @@ int main( int argc, char** argv ) ...@@ -203,5 +204,7 @@ int main( int argc, char** argv )
imshow( "LSD matches", lsd_outImg ); imshow( "LSD matches", lsd_outImg );
waitKey(); waitKey();
} }
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include <vector> #include <vector>
using namespace cv; using namespace cv;
using namespace cv::line_descriptor;
static const std::string images[] = static const std::string images[] =
{ "cameraman.jpg", "church.jpg", "church2.png", "einstein.jpg", "stuff.jpg" }; { "cameraman.jpg", "church.jpg", "church2.png", "einstein.jpg", "stuff.jpg" };
......
...@@ -41,8 +41,11 @@ ...@@ -41,8 +41,11 @@
#include "precomp.hpp" #include "precomp.hpp"
using namespace cv; //using namespace cv;
namespace cv
{
namespace line_descriptor
{
Ptr<LSDDetector> LSDDetector::createLSDDetector() Ptr<LSDDetector> LSDDetector::createLSDDetector()
{ {
return Ptr<LSDDetector>( new LSDDetector() ); return Ptr<LSDDetector>( new LSDDetector() );
...@@ -199,10 +202,12 @@ void LSDDetector::detectImpl( const Mat& imageSrc, std::vector<KeyLine>& keyline ...@@ -199,10 +202,12 @@ void LSDDetector::detectImpl( const Mat& imageSrc, std::vector<KeyLine>& keyline
for ( size_t keyCounter = 0; keyCounter < keylines.size(); keyCounter++ ) for ( size_t keyCounter = 0; keyCounter < keylines.size(); keyCounter++ )
{ {
KeyLine kl = keylines[keyCounter]; KeyLine kl = keylines[keyCounter];
if( mask.at<uchar>( (int)kl.startPointY, (int)kl.startPointX ) == 0 && mask.at<uchar>( (int)kl.endPointY, (int)kl.endPointX ) == 0 ) if( mask.at<uchar>( (int) kl.startPointY, (int) kl.startPointX ) == 0 && mask.at<uchar>( (int) kl.endPointY, (int) kl.endPointX ) == 0 )
keylines.erase( keylines.begin() + keyCounter ); keylines.erase( keylines.begin() + keyCounter );
} }
} }
} }
}
}
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
//using namespace cv; //using namespace cv;
namespace cv namespace cv
{ {
namespace line_descriptor
{
/* combinations of internal indeces for binary descriptor extractor */ /* combinations of internal indeces for binary descriptor extractor */
static const int combinations[32][2] = static const int combinations[32][2] =
...@@ -1345,3 +1347,4 @@ int BinaryDescriptor::computeLBD( ScaleLines &keyLines, bool useDetectionData ) ...@@ -1345,3 +1347,4 @@ int BinaryDescriptor::computeLBD( ScaleLines &keyLines, bool useDetectionData )
} }
} }
}
...@@ -41,7 +41,11 @@ ...@@ -41,7 +41,11 @@
#include "precomp.hpp" #include "precomp.hpp"
using namespace cv; //using namespace cv;
namespace cv
{
namespace line_descriptor
{
/* constructor */ /* constructor */
BinaryDescriptorMatcher::BinaryDescriptorMatcher() BinaryDescriptorMatcher::BinaryDescriptorMatcher()
...@@ -583,3 +587,5 @@ void BinaryDescriptorMatcher::radiusMatch( const Mat& queryDescriptors, std::vec ...@@ -583,3 +587,5 @@ void BinaryDescriptorMatcher::radiusMatch( const Mat& queryDescriptors, std::vec
delete numres; delete numres;
} }
}
}
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
namespace cv namespace cv
{ {
namespace line_descriptor
{
/* draw matches between two images */ /* draw matches between two images */
void drawLineMatches( const Mat& img1, const std::vector<KeyLine>& keylines1, const Mat& img2, const std::vector<KeyLine>& keylines2, void drawLineMatches( const Mat& img1, const std::vector<KeyLine>& keylines1, const Mat& img2, const std::vector<KeyLine>& keylines2,
const std::vector<DMatch>& matches1to2, Mat& outImg, const Scalar& matchColor, const Scalar& singleLineColor, const std::vector<DMatch>& matches1to2, Mat& outImg, const Scalar& matchColor, const Scalar& singleLineColor,
...@@ -185,3 +187,4 @@ void drawKeylines( const Mat& image, const std::vector<KeyLine>& keylines, Mat& ...@@ -185,3 +187,4 @@ void drawKeylines( const Mat& image, const std::vector<KeyLine>& keylines, Mat&
} }
} }
}
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
namespace cv namespace cv
{ {
namespace line_descriptor
{
CV_INIT_ALGORITHM( BinaryDescriptor, "BINARY.DESCRIPTOR", ); CV_INIT_ALGORITHM( BinaryDescriptor, "BINARY.DESCRIPTOR", );
CV_INIT_ALGORITHM( BinaryDescriptorMatcher, "BINARY.DESCRIPTOR.MATCHER", ); CV_INIT_ALGORITHM( BinaryDescriptorMatcher, "BINARY.DESCRIPTOR.MATCHER", );
...@@ -59,3 +61,4 @@ bool initModule_line_descriptor( void ) ...@@ -59,3 +61,4 @@ bool initModule_line_descriptor( void )
} }
} }
}
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
#include <time.h> #include <time.h>
#include <stdexcept> #include <stdexcept>
#include <sstream> #include <sstream>
#include <vector>
#include "opencv2/line_descriptor.hpp" #include "opencv2/line_descriptor.hpp"
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "test_precomp.hpp" #include "test_precomp.hpp"
using namespace cv; using namespace cv;
using namespace cv::line_descriptor;
/****************************************************************************************\ /****************************************************************************************\
* Regression tests for line detector comparing keylines. * * Regression tests for line detector comparing keylines. *
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "test_precomp.hpp" #include "test_precomp.hpp"
using namespace cv; using namespace cv;
using namespace cv::line_descriptor;
/****************************************************************************************\ /****************************************************************************************\
* Regression tests for line detector comparing keylines. * * Regression tests for line detector comparing keylines. *
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "test_precomp.hpp" #include "test_precomp.hpp"
using namespace cv; using namespace cv;
using namespace cv::line_descriptor;
class CV_BinaryDescriptorMatcherTest : public cvtest::BaseTest class CV_BinaryDescriptorMatcherTest : public cvtest::BaseTest
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment