diff --git a/ASIFT_tests/demo_ASIFT_src/ASIFT_matcher.cpp b/ASIFT_tests/demo_ASIFT_src/ASIFT_matcher.cpp index 9def179..7a57408 100644 --- a/ASIFT_tests/demo_ASIFT_src/ASIFT_matcher.cpp +++ b/ASIFT_tests/demo_ASIFT_src/ASIFT_matcher.cpp @@ -1,6 +1,6 @@ #include "ASIFT_matcher.hpp" -ASIFT_matcher::ASIFT_matcher(): _showDebug(0), _nb_refs(0), _resize_imgs(false) +ASIFT_matcher::ASIFT_matcher(): _nb_refs(0), _resize_imgs(false), _showDebug(false) { default_sift_parameters(_siftParam); } @@ -10,6 +10,7 @@ ASIFT_matcher::ASIFT_matcher(): _showDebug(0), _nb_refs(0), _resize_imgs(false) // } +//Return true if successfull bool ASIFT_matcher::addReference(const char* image, unsigned int num_tilts) { ///// Read input @@ -112,6 +113,7 @@ bool ASIFT_matcher::addReference(const char* image, unsigned int num_tilts) //Save data _im_refs.push_back(ipixels1_zoom); _size_refs.push_back(make_pair(wS1,hS1)); + _zoom_refs.push_back(zoom1); _num_keys.push_back(num_keys); _num_tilts.push_back(num_tilts); @@ -125,6 +127,7 @@ bool ASIFT_matcher::addReference(const char* image, unsigned int num_tilts) return true; } +//Return true if successfull bool ASIFT_matcher::match(const char* image, unsigned int num_tilts) { if(_nb_refs<=0) @@ -256,6 +259,7 @@ bool ASIFT_matcher::match(const char* image, unsigned int num_tilts) return true; } +//Return true if successfull bool ASIFT_matcher::match(vector& image, unsigned int w, unsigned int h, unsigned int num_tilts) { if(image.size()!=w*h) @@ -308,6 +312,7 @@ bool ASIFT_matcher::match(vector& image, unsigned int w, unsigned int h, return true; } +//Return true if successfull bool ASIFT_matcher::computeROI(int& x, int& y, unsigned int& h, unsigned int& w) const { if(getNbMatch()==0) @@ -351,6 +356,7 @@ bool ASIFT_matcher::computeROI(int& x, int& y, unsigned int& h, unsigned int& w) return true; } +//Return true if successfull bool ASIFT_matcher::computeCenter(int& cx, int& cy) const { if(getNbMatch()==0) @@ -380,6 +386,7 @@ bool ASIFT_matcher::computeCenter(int& cx, int& cy) const //Filter keypoint which are far (Euclidian distance) from the center. //Not optimized //threshold : 1-68%/2-95%/3-99% +//Return true if successfull bool ASIFT_matcher::distFilter(int threshold=2) { cout<<"filtering keypoint..."< filtered_match; @@ -441,7 +448,7 @@ bool ASIFT_matcher::distFilter(int threshold=2) { euc_dist =kp_euc_dist[i][j]; - if(euc_dist > asift_keypoints; +//ASIFT wrapper class ASIFT_matcher { public: @@ -44,33 +45,41 @@ public: bool computeCenter(int& cx, int& cy) const; bool distFilter(int threshold); //Filter keypoint which are far (Euclidian distance) from the center. - void setResizeImg(bool resize_imgs){ _resize_imgs=resize_imgs;} - void showDebug(bool showDebug){ _showDebug=showDebug;} + + unsigned int getNbRef() const{ return _nb_refs;} + const vector< vector< float > >& getRefImgs() const{ return _im_refs;} + const vector< pair >& getSizeRef() const{ return _size_refs;} + const vector& getZoomRef() const{ return _zoom_refs;} const vector < unsigned int >& getNbMatchs() const{ return _num_matchings;} unsigned int getNbMatch() const; const vector< matchingslist >& getMatch() const{ return _matchings;} vector< matchingslist >& getMatch(){ return _matchings;} + const siftPar& getSiftPar(){ return _siftParam;} + void setSiftPar(const siftPar &newSiftPar){ _siftParam = newSiftPar;} + void setResizeImg(bool resize_imgs){ _resize_imgs=resize_imgs;} + void showDebug(bool showDebug){ _showDebug=showDebug;} protected: - int _showDebug;// = 0; //Reference Images // vector< image > _im_refs; - unsigned int _nb_refs;// = 0; - vector< vector< float > > _im_refs; + unsigned int _nb_refs;// = 0; //Number of reference images + vector< vector< float > > _im_refs; //Reference images used for matching vector< pair > _size_refs; //Width/Height + vector _zoom_refs; //Zoom coeffs //ASIFT Keypoints - vector< int > _num_keys; - vector< int > _num_tilts; //Speed VS Precision - vector< asift_keypoints > _keys; + vector< int > _num_keys; //Number of keypoint/reference + vector< int > _num_tilts; //Number of tilts/reference (Speed VS Precision) + vector< asift_keypoints > _keys; //Keypoints //Matchs - vector < unsigned int > _num_matchings; - vector< matchingslist > _matchings; + vector < unsigned int > _num_matchings; //Number of match/reference + vector< matchingslist > _matchings; //Matchs - siftPar _siftParam; + siftPar _siftParam; //SIFT parameters //Flags - bool _resize_imgs;// = false; + bool _resize_imgs;// = false; //Resize images to IM_X/IM_Y ? + bool _showDebug;// = 0; //Show debugging messages ? }; \ No newline at end of file diff --git a/ASIFT_tests/demo_ASIFT_src/CMakeFiles/test_ASIFT.dir/ASIFT_matcher.cpp.o b/ASIFT_tests/demo_ASIFT_src/CMakeFiles/test_ASIFT.dir/ASIFT_matcher.cpp.o index 2610ec8..334431a 100644 Binary files a/ASIFT_tests/demo_ASIFT_src/CMakeFiles/test_ASIFT.dir/ASIFT_matcher.cpp.o and b/ASIFT_tests/demo_ASIFT_src/CMakeFiles/test_ASIFT.dir/ASIFT_matcher.cpp.o differ diff --git a/ASIFT_tests/demo_ASIFT_src/CMakeFiles/test_ASIFT.dir/CXX.includecache b/ASIFT_tests/demo_ASIFT_src/CMakeFiles/test_ASIFT.dir/CXX.includecache index 74baa54..2065e94 100644 --- a/ASIFT_tests/demo_ASIFT_src/CMakeFiles/test_ASIFT.dir/CXX.includecache +++ b/ASIFT_tests/demo_ASIFT_src/CMakeFiles/test_ASIFT.dir/CXX.includecache @@ -6,6 +6,10 @@ #IncludeRegexTransform: +/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/ASIFT_matcher.cpp +ASIFT_matcher.hpp +/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/ASIFT_matcher.hpp + /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/ASIFT_matcher.hpp stdio.h - diff --git a/ASIFT_tests/demo_ASIFT_src/CMakeFiles/test_ASIFT.dir/test_ASIFT.cpp.o b/ASIFT_tests/demo_ASIFT_src/CMakeFiles/test_ASIFT.dir/test_ASIFT.cpp.o index 1fa2c24..b16b485 100644 Binary files a/ASIFT_tests/demo_ASIFT_src/CMakeFiles/test_ASIFT.dir/test_ASIFT.cpp.o and b/ASIFT_tests/demo_ASIFT_src/CMakeFiles/test_ASIFT.dir/test_ASIFT.cpp.o differ diff --git a/ASIFT_tests/demo_ASIFT_src/results/res.png b/ASIFT_tests/demo_ASIFT_src/results/res.png index 9f4c0cc..9fc0b7f 100644 Binary files a/ASIFT_tests/demo_ASIFT_src/results/res.png and b/ASIFT_tests/demo_ASIFT_src/results/res.png differ diff --git a/ASIFT_tests/demo_ASIFT_src/test_ASIFT b/ASIFT_tests/demo_ASIFT_src/test_ASIFT index 33e0f89..5fbe8dc 100755 Binary files a/ASIFT_tests/demo_ASIFT_src/test_ASIFT and b/ASIFT_tests/demo_ASIFT_src/test_ASIFT differ diff --git a/ASIFT_tests/demo_ASIFT_src/test_ASIFT.cpp b/ASIFT_tests/demo_ASIFT_src/test_ASIFT.cpp index ccb6688..9d5819b 100644 --- a/ASIFT_tests/demo_ASIFT_src/test_ASIFT.cpp +++ b/ASIFT_tests/demo_ASIFT_src/test_ASIFT.cpp @@ -9,7 +9,7 @@ int main(int argc, char **argv) << "Usage: " << argv[0] << " imgIn.png [Tilt number option] [Filter option] [Resize option] " << std::endl << "- imgIn.png: input image (in PNG format). " << std::endl << "- [Tilt number option: 1..(32+ ?)] : 7: Recommended / 1: no tilt. " << std::endl - << "- [Filter option: 0..3]. Standard deviation filter coeff (1-68%/2-95%/3-99%). 0: no filtering. " << std::endl + << "- [Filter option: 0..3]. Standard deviation filter coeff (1-68%/2-95%/3-99%). 0: no filtering (default). " << std::endl << "- [Resize option: 0/1]. 1: input images resize to 800x600 (default). 0: no resize. " << std::endl << " ******************************************************************************* " << std::endl << " ********************* Jean-Michel Morel, Guoshen Yu, 2010 ******************** " << std::endl @@ -107,26 +107,23 @@ int main(int argc, char **argv) "book_training/train_image_000.png", "book_training/train_image_001.png"}; + int tilt_ref = 7, tilt_input = 1; + + if(argc>2) + { + tilt_ref = atoi(argv[2]); + tilt_input = atoi(argv[2]); + } + ASIFT_matcher matcher; matcher.setResizeImg(flag_resize); time_t tstart, tend; tstart = time(0); - // matcher.print(); - // matcher.match(refData[3].c_str(), 4); - if(argc>2) - { - matcher.addReference(refData[0].c_str(), atoi(argv[2])); - matcher.addReference(refData[1].c_str(), atoi(argv[2])); - matcher.match(ipixels1_zoom, wS1, hS1, atoi(argv[2])); - } - else - { - matcher.addReference(refData[0].c_str(), 7); - matcher.addReference(refData[1].c_str(), 7); - matcher.match(ipixels1_zoom, wS1, hS1); - } + matcher.addReference(refData[0].c_str(), tilt_ref); + matcher.addReference(refData[1].c_str(), tilt_ref); + matcher.match(ipixels1_zoom, wS1, hS1, tilt_input); if(argc>3 && atoi(argv[3])>0) matcher.distFilter(atoi(argv[3]));