Ajout commentaires
This commit is contained in:
parent
1cd55aba7a
commit
6b4be0fecb
17 changed files with 73897 additions and 43726 deletions
|
@ -1,10 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Image matching using Affine-SIFT algorithm.
|
||||||
|
* Allow to find matching keypoints, filter, compute ROI & center of an object in an image, after having built the references (with at least 1 image).
|
||||||
|
* @author : antoine.harle@etu.upmc.Fr
|
||||||
|
* Reference: J.M. Morel and G.Yu, ASIFT: A New Framework for Fully Affine Invariant Image
|
||||||
|
* Comparison, SIAM Journal on Imaging Sciences, vol. 2, issue 2, pp. 438-469, 2009.
|
||||||
|
* Reference: ASIFT online demo (You can try ASIFT with your own images online.)
|
||||||
|
* http://www.ipol.im/pub/algo/my_affine_sift/
|
||||||
|
*/
|
||||||
|
|
||||||
#include "ASIFT_matcher.hpp"
|
#include "ASIFT_matcher.hpp"
|
||||||
|
|
||||||
|
//Default constructor
|
||||||
ASIFT_matcher::ASIFT_matcher(): _nb_refs(0), _total_num_matchings(0), _resize_imgs(false), _showDebug(false), _showInfo(true)
|
ASIFT_matcher::ASIFT_matcher(): _nb_refs(0), _total_num_matchings(0), _resize_imgs(false), _showDebug(false), _showInfo(true)
|
||||||
{
|
{
|
||||||
default_sift_parameters(_siftParam);
|
default_sift_parameters(_siftParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Constuctor from keypoints references (.txt)
|
||||||
|
* ref_path : path to a text file with keypoints reference following the convention of saveReference function.
|
||||||
|
*/
|
||||||
ASIFT_matcher::ASIFT_matcher(const char* ref_path): ASIFT_matcher()
|
ASIFT_matcher::ASIFT_matcher(const char* ref_path): ASIFT_matcher()
|
||||||
{
|
{
|
||||||
if(!loadReferences(ref_path))
|
if(!loadReferences(ref_path))
|
||||||
|
@ -18,7 +32,12 @@ ASIFT_matcher::ASIFT_matcher(const char* ref_path): ASIFT_matcher()
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//Return true if successfull
|
/*
|
||||||
|
* Add a reference image.
|
||||||
|
* image_path : path to the image file (support the same format than CImg / ImageMagick).
|
||||||
|
* num_tilts : Number of virtual tilts applied to the image. More tilts equal to better matching but slower process. Default : 1 (no tilt). Recommended : 8.
|
||||||
|
* Return true if the reference was loaded with success.
|
||||||
|
*/
|
||||||
bool ASIFT_matcher::addReference(const char* image_path, unsigned int num_tilts)
|
bool ASIFT_matcher::addReference(const char* image_path, unsigned int num_tilts)
|
||||||
{
|
{
|
||||||
///// Read input
|
///// Read input
|
||||||
|
@ -69,7 +88,14 @@ bool ASIFT_matcher::addReference(const char* image_path, unsigned int num_tilts)
|
||||||
return addReference(ipixels1, w1, h1, num_tilts);
|
return addReference(ipixels1, w1, h1, num_tilts);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Image : Gray scale image (image size = w*h)
|
/*
|
||||||
|
* Add a reference image.
|
||||||
|
* image : Gray scale image. Image size must be equal to width * height.
|
||||||
|
* w : Width of the image.
|
||||||
|
* h : Height of the image.
|
||||||
|
* num_tilts : Number of virtual tilts applied to the image. More tilts equal to better matching but slower process. Default : 1 (no tilt). Recommended : 8.
|
||||||
|
* Return true if the reference was loaded with success.
|
||||||
|
*/
|
||||||
bool ASIFT_matcher::addReference(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts)
|
bool ASIFT_matcher::addReference(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts)
|
||||||
{
|
{
|
||||||
if(image.size()!=w*h)
|
if(image.size()!=w*h)
|
||||||
|
@ -180,7 +206,12 @@ bool ASIFT_matcher::addReference(const vector<float>& image, unsigned int w, uns
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return number of match
|
/*
|
||||||
|
* Perform matching between an image and the references.
|
||||||
|
* image_path : path to the image file (support the same format than CImg / ImageMagick).
|
||||||
|
* num_tilts : Number of virtual tilts applied to the image. More tilts equal to better matching but slower process. Default : 1 (no tilt). Recommended : 8.
|
||||||
|
* Return number of matching keypoints found.
|
||||||
|
*/
|
||||||
unsigned int ASIFT_matcher::match(const char* image_path, unsigned int num_tilts)
|
unsigned int ASIFT_matcher::match(const char* image_path, unsigned int num_tilts)
|
||||||
{
|
{
|
||||||
if(_nb_refs<=0)
|
if(_nb_refs<=0)
|
||||||
|
@ -234,8 +265,14 @@ unsigned int ASIFT_matcher::match(const char* image_path, unsigned int num_tilts
|
||||||
return match(ipixels1, w1, h1, num_tilts);
|
return match(ipixels1, w1, h1, num_tilts);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Image : Gray scale image (image size = w*h)
|
/*
|
||||||
//Return number of match
|
* Perform matching between an image and the references.
|
||||||
|
* image : Gray scale image. Image size must be equal to width * height.
|
||||||
|
* w : Width of the image.
|
||||||
|
* h : Height of the image.
|
||||||
|
* num_tilts : Number of virtual tilts applied to the image. More tilts equal to better matching but slower process. Default : 1 (no tilt). Recommended : 8.
|
||||||
|
* Return number of matching keypoints found.
|
||||||
|
*/
|
||||||
unsigned int ASIFT_matcher::match(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts)
|
unsigned int ASIFT_matcher::match(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts)
|
||||||
{
|
{
|
||||||
if(image.size()!=w*h)
|
if(image.size()!=w*h)
|
||||||
|
@ -366,7 +403,15 @@ unsigned int ASIFT_matcher::match(const vector<float>& image, unsigned int w, un
|
||||||
return _total_num_matchings;
|
return _total_num_matchings;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return true if successfull
|
/*
|
||||||
|
* Compute the bounding rectangle of the matching keypoints.
|
||||||
|
* Match function must have been called before and found at least one matching keypoint.
|
||||||
|
* x : X-coordinate of the upper-left point.
|
||||||
|
* y : Y-coordinate of the upper-left point.
|
||||||
|
* h : Height of the rectangle.
|
||||||
|
* w : Width of the rectangle.
|
||||||
|
* Return true if the ROI was succesfully found and arguments modified.
|
||||||
|
*/
|
||||||
bool ASIFT_matcher::computeROI(int& x, int& y, unsigned int& h, unsigned int& w) const
|
bool ASIFT_matcher::computeROI(int& x, int& y, unsigned int& h, unsigned int& w) const
|
||||||
{
|
{
|
||||||
if(getNbMatch()==0)
|
if(getNbMatch()==0)
|
||||||
|
@ -410,7 +455,13 @@ bool ASIFT_matcher::computeROI(int& x, int& y, unsigned int& h, unsigned int& w)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return true if successfull
|
/*
|
||||||
|
* Compute the centroid of the matching keypoints.
|
||||||
|
* Match function must have been called before and found at least one matching keypoint.
|
||||||
|
* cx : X-coordinate of the centroid.
|
||||||
|
* cy : Y-coordinate of the centroid.
|
||||||
|
* Return true if the ROI was succesfully found and arguments modified.
|
||||||
|
*/
|
||||||
bool ASIFT_matcher::computeCenter(int& cx, int& cy) const
|
bool ASIFT_matcher::computeCenter(int& cx, int& cy) const
|
||||||
{
|
{
|
||||||
if(getNbMatch()==0)
|
if(getNbMatch()==0)
|
||||||
|
@ -437,11 +488,13 @@ bool ASIFT_matcher::computeCenter(int& cx, int& cy) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Filter keypoint which are far (Euclidian distance) from the center.
|
/*
|
||||||
//Not optimized
|
* Perform a standard deviation filtering on the matching keypoints.
|
||||||
//threshold : 1-68%/2-95%/3-99%
|
* Match function must have been called before and found at least one matching keypoint.
|
||||||
//Return true if successfull
|
* threshold : Filtering coefficient. 1-Keep 68% of the keypoints / 2-Keep 95% of the keypoints / 3-Keep 99% of the keypoints. Default : 2.
|
||||||
bool ASIFT_matcher::distFilter(int threshold=2)
|
* Return true if the filtering is done.
|
||||||
|
*/
|
||||||
|
bool ASIFT_matcher::distFilter(int threshold)
|
||||||
{
|
{
|
||||||
if(_showInfo)
|
if(_showInfo)
|
||||||
cout<<"filtering keypoint..."<<endl;
|
cout<<"filtering keypoint..."<<endl;
|
||||||
|
@ -520,8 +573,16 @@ bool ASIFT_matcher::distFilter(int threshold=2)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save reference data necessary for the matching
|
/*
|
||||||
//Doesn't save references images or Sift parameters
|
* Save reference data necessary for the matching.
|
||||||
|
* ref_path : path were the reference data will be saved (.txt).
|
||||||
|
* Follow a modified convention of David Lowe (SIFT keypoints) :
|
||||||
|
* - Number of reference.
|
||||||
|
* - Number of keypoints in the reference / Length of the descriptors (128) / Width of the reference / Height of the reference / Number of tilts.
|
||||||
|
* -
|
||||||
|
* - Keypoints (row, col, scale, orientation, desciptor (128 integers)).
|
||||||
|
* Return true if the reference data was successfully saved.
|
||||||
|
*/
|
||||||
bool ASIFT_matcher::saveReferences(const char* ref_path) const
|
bool ASIFT_matcher::saveReferences(const char* ref_path) const
|
||||||
{
|
{
|
||||||
// Write all the keypoints (row, col, scale, orientation, desciptor (128 integers))
|
// Write all the keypoints (row, col, scale, orientation, desciptor (128 integers))
|
||||||
|
@ -572,8 +633,16 @@ bool ASIFT_matcher::saveReferences(const char* ref_path) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load reference data necessary for the matching
|
/*
|
||||||
//Doesn't load references images or Sift parameters
|
* Load reference data necessary for the matching.
|
||||||
|
* ref_path : path from were the reference data will be loaded (.txt).
|
||||||
|
* Follow a modified convention of David Lowe (SIFT keypoints) :
|
||||||
|
* - Number of reference.
|
||||||
|
* - Number of keypoints in the reference / Length of the descriptors (128) / Width of the reference / Height of the reference / Number of tilts.
|
||||||
|
* -
|
||||||
|
* - Keypoints (row, col, scale, orientation, desciptor (128 integers)).
|
||||||
|
* Return true if the reference data was successfully loaded.
|
||||||
|
*/
|
||||||
bool ASIFT_matcher::loadReferences(const char* ref_path)
|
bool ASIFT_matcher::loadReferences(const char* ref_path)
|
||||||
{
|
{
|
||||||
std::ifstream ref_file(ref_path);
|
std::ifstream ref_file(ref_path);
|
||||||
|
@ -838,6 +907,10 @@ bool ASIFT_matcher::loadReferences(const char* ref_path)
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Assignation operator.
|
||||||
|
* m : ASIFT matcher object to copy.
|
||||||
|
*/
|
||||||
ASIFT_matcher& ASIFT_matcher::operator=(const ASIFT_matcher& m)
|
ASIFT_matcher& ASIFT_matcher::operator=(const ASIFT_matcher& m)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -862,7 +935,7 @@ ASIFT_matcher& ASIFT_matcher::operator=(const ASIFT_matcher& m)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Debugging function
|
//Debugging function : print content form the ASIFT matcher.
|
||||||
void ASIFT_matcher::print() const
|
void ASIFT_matcher::print() const
|
||||||
{
|
{
|
||||||
for(unsigned int i=0; i< _keys.size();i++)
|
for(unsigned int i=0; i< _keys.size();i++)
|
||||||
|
@ -892,13 +965,3 @@ void ASIFT_matcher::print() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// unsigned int ASIFT_matcher::getNbMatch() const
|
|
||||||
// {
|
|
||||||
// unsigned int res = 0;
|
|
||||||
// for (unsigned int i=0;i<_num_matchings.size();i++)
|
|
||||||
// {
|
|
||||||
// res+=_num_matchings[i];
|
|
||||||
// }
|
|
||||||
// return res;
|
|
||||||
// }
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
/*
|
||||||
|
* Image matching using Affine-SIFT algorithm.
|
||||||
|
* Allow to find matching keypoints, filter, compute ROI & center of an object in an image, after having built the references (with at least 1 image).
|
||||||
|
* @author : antoine.harle@etu.upmc.Fr
|
||||||
|
* Reference: J.M. Morel and G.Yu, ASIFT: A New Framework for Fully Affine Invariant Image
|
||||||
|
* Comparison, SIAM Journal on Imaging Sciences, vol. 2, issue 2, pp. 438-469, 2009.
|
||||||
|
* Reference: ASIFT online demo (You can try ASIFT with your own images online.)
|
||||||
|
* http://www.ipol.im/pub/algo/my_affine_sift/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef ASIFTMATCHER_HPP
|
#ifndef ASIFTMATCHER_HPP
|
||||||
#define ASIFTMATCHER_HPP
|
#define ASIFTMATCHER_HPP
|
||||||
|
|
||||||
|
@ -30,28 +41,28 @@ using namespace std;
|
||||||
|
|
||||||
typedef vector< vector< keypointslist > > asift_keypoints;
|
typedef vector< vector< keypointslist > > asift_keypoints;
|
||||||
|
|
||||||
//ASIFT wrapper
|
|
||||||
class ASIFT_matcher
|
class ASIFT_matcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ASIFT_matcher();
|
ASIFT_matcher();//Default constructor.
|
||||||
ASIFT_matcher(const char* ref_path);
|
ASIFT_matcher(const char* ref_path); //Constuctor from keypoints references (.txt).
|
||||||
ASIFT_matcher(const ASIFT_matcher& matcher) { *this = matcher;}
|
ASIFT_matcher(const ASIFT_matcher& matcher) { *this = matcher;} //Copy constructor.
|
||||||
// virtual ~ASIFT_matcher();
|
// virtual ~ASIFT_matcher();
|
||||||
|
|
||||||
bool addReference(const char* image_path, unsigned int num_tilts=1);
|
bool addReference(const char* image_path, unsigned int num_tilts =1); //Add a reference image.
|
||||||
bool addReference(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts =1);
|
bool addReference(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts =1); //Add a reference image.
|
||||||
unsigned int match(const char* image_path, unsigned int num_tilts =1);
|
unsigned int match(const char* image_path, unsigned int num_tilts =1); //Perform matching between an image and the references.
|
||||||
unsigned int match(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts =1);
|
unsigned int match(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts =1); //Perform matching between an image and the references.
|
||||||
bool computeROI(int& x, int& y, unsigned int& h, unsigned int& w) const; //Compute the bounding rectangle of the keypoints
|
bool computeROI(int& x, int& y, unsigned int& h, unsigned int& w) const; //Compute the bounding rectangle of the mathcing keypoints.
|
||||||
bool computeCenter(int& cx, int& cy) const;
|
bool computeCenter(int& cx, int& cy) const; //Compute the centroid of the matching keypoints.
|
||||||
bool distFilter(int threshold); //Filter keypoint which are far (Euclidian distance) from the center.
|
bool distFilter(int threshold =2); //Perform a standard deviation filtering on the matching keypoints.
|
||||||
|
|
||||||
bool saveReferences(const char* ref_path) const;
|
bool saveReferences(const char* ref_path) const; //Save reference data necessary for the matching.
|
||||||
bool loadReferences(const char* ref_path);
|
bool loadReferences(const char* ref_path); //Load reference data necessary for the matching.
|
||||||
|
|
||||||
ASIFT_matcher& operator=(const ASIFT_matcher& m);
|
ASIFT_matcher& operator=(const ASIFT_matcher& m); //Assignation operator.
|
||||||
|
|
||||||
|
//Setter/Getter
|
||||||
unsigned int getNbRef() const{ return _nb_refs;}
|
unsigned int getNbRef() const{ return _nb_refs;}
|
||||||
const vector< vector< float > >& getRefImgs() const{ return _im_refs;}
|
const vector< vector< float > >& getRefImgs() const{ return _im_refs;}
|
||||||
const vector< pair<int,int> >& getSizeRef() const{ return _size_refs;}
|
const vector< pair<int,int> >& getSizeRef() const{ return _size_refs;}
|
||||||
|
@ -72,31 +83,31 @@ public:
|
||||||
bool isShowingInfo() const{ return _showInfo;}
|
bool isShowingInfo() const{ return _showInfo;}
|
||||||
void showInfo(bool showInfo){ _showInfo=showInfo;}
|
void showInfo(bool showInfo){ _showInfo=showInfo;}
|
||||||
|
|
||||||
void print() const; //Debugging function
|
void print() const; //Debugging function : print content form the ASIFT matcher.
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//Reference Images
|
//Reference Images
|
||||||
unsigned int _nb_refs;// = 0; //Number of reference images
|
unsigned int _nb_refs;//Number of reference images
|
||||||
vector< vector< float > > _im_refs; //Reference images used for matching
|
vector< vector< float > > _im_refs; //Reference images used for matching
|
||||||
vector< pair<int,int> > _size_refs; //Width/Height
|
vector< pair<int,int> > _size_refs; //Width/Height
|
||||||
vector<float> _zoom_refs; //Zoom coeffs
|
vector<float> _zoom_refs; //Zoom coeffs
|
||||||
|
|
||||||
//ASIFT Keypoints
|
//Reference ASIFT Keypoints
|
||||||
vector< int > _num_keys; //Number of keypoint/reference
|
vector< int > _num_keys; //Number of keypoint/reference
|
||||||
vector< int > _num_tilts; //Number of tilts/reference (Speed VS Precision)
|
vector< int > _num_tilts; //Number of tilts/reference (Speed VS Precision)
|
||||||
vector< asift_keypoints > _keys; //Keypoints
|
vector< asift_keypoints > _keys; //Reference keypoints
|
||||||
|
|
||||||
//Matchs
|
//Matchs
|
||||||
unsigned int _total_num_matchings;
|
unsigned int _total_num_matchings; //Number of matching keypoints.
|
||||||
vector < unsigned int > _num_matchings; //Number of match/reference
|
vector < unsigned int > _num_matchings; //Number of match/reference
|
||||||
vector< matchingslist > _matchings; //Matchs
|
vector< matchingslist > _matchings; //Matching keypoints
|
||||||
|
|
||||||
siftPar _siftParam; //SIFT parameters
|
siftPar _siftParam; //SIFT parameters
|
||||||
|
|
||||||
//Flags
|
//Flags
|
||||||
bool _resize_imgs;// = false; //Resize images to IM_X/IM_Y ?
|
bool _resize_imgs;//Resize images to IM_X/IM_Y ?
|
||||||
bool _showDebug;// = 0; //Show debugging messages ?
|
bool _showDebug;//Show debugging messages ?
|
||||||
bool _showInfo; //Show info messages
|
bool _showInfo; //Show info messages
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,10 @@ unixio.h
|
||||||
zconf.h
|
zconf.h
|
||||||
./io_png/libs/zlib/zconf.h
|
./io_png/libs/zlib/zconf.h
|
||||||
|
|
||||||
|
/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
|
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/ASIFT_matcher.hpp
|
||||||
stdio.h
|
stdio.h
|
||||||
-
|
-
|
||||||
|
|
|
@ -1,436 +1,4 @@
|
||||||
539 7
|
0 3
|
||||||
0
|
0
|
||||||
315.444 258.335 287.672 258.758
|
|
||||||
426.906 295.66 440.176 317.661
|
|
||||||
306.55 228.25 274.809 227.61
|
|
||||||
312.679 317.378 268.687 338.554
|
|
||||||
311.468 251.003 283.062 249.146
|
|
||||||
309.987 301.593 266.551 319.799
|
|
||||||
312.535 318.82 268.482 339.697
|
|
||||||
283.63 241.967 0 0
|
|
||||||
343.019 242.391 0 0
|
|
||||||
395.144 313.545 0 0
|
|
||||||
303.021 195.407 8.55526e-38 5.89486e-38
|
|
||||||
314.336 253.198 0 0
|
|
||||||
321.116 255.156 74494.9 64824.8
|
|
||||||
314.134 248.42 11892.7 10251.7
|
|
||||||
364.865 309.114 571.198 564.546
|
|
||||||
310.986 314.466 -637.359 -795.004
|
|
||||||
389.821 328.222 8095.35 7442.99
|
|
||||||
388.092 268.632 781.242 551.196
|
|
||||||
310.763 317.685 1068.32 1345.51
|
|
||||||
296.858 306.912 29288.6 36097.9
|
|
||||||
359.635 237.516 41402.9 37189.9
|
|
||||||
310.25 306.607 2411.67 2911.07
|
|
||||||
359.629 259.769 706.376 536.012
|
|
||||||
311.133 252.134 5070.64 4503.94
|
|
||||||
263.032 282.079 29830.8 36533.8
|
|
||||||
261.705 281.305 644.163 786.087
|
|
||||||
290.293 324.426 477.522 665.354
|
|
||||||
306.268 240.576 2216.5 1899.34
|
|
||||||
409.254 299.176 4571.17 3548.1
|
|
||||||
404.268 337.255 2024.92 1818.79
|
|
||||||
397.534 326.475 1581.33 1413.61
|
|
||||||
343.423 242.142 40846.6 30507.3
|
|
||||||
245.403 300.282 5373.09 8106.63
|
|
||||||
427.752 290.847 393.004 137.497
|
|
||||||
265.624 279.468 0 0
|
|
||||||
427.196 278.253 0 0
|
|
||||||
269.907 286.773 1830.06 2105.53
|
|
||||||
321.196 251.016 2692.79 2255.98
|
|
||||||
319.28 280.167 284.902 292.662
|
|
||||||
272.162 279.013 5821.68 6480.73
|
|
||||||
354.189 256.061 0 0
|
|
||||||
310.978 252.721 0 0
|
|
||||||
318.32 306.393 0 0
|
|
||||||
269.128 333.098 0 0
|
|
||||||
301.284 310.745 1796.82 2253.94
|
|
||||||
394.503 314.288 8615 7180.51
|
|
||||||
341.087 247.786 657.814 504.132
|
|
||||||
369.019 263.22 0 0
|
|
||||||
319.746 255.075 887.436 772.239
|
|
||||||
343.394 276.393 0 0
|
|
||||||
309.982 244.483 0 0
|
|
||||||
387.011 252.057 3118.89 2063.11
|
|
||||||
354.904 243.256 49682.4 35674.9
|
|
||||||
267.73 317.634 14598.2 21120.3
|
|
||||||
393.302 272.704 1599.54 1132.27
|
|
||||||
325.013 309.256 1711.25 2014.27
|
|
||||||
349.2 264.32 48166.7 38595.3
|
|
||||||
365.576 269.939 1086.77 834.093
|
|
||||||
322.318 333.276 0 0
|
|
||||||
325.364 307.405 0 0
|
|
||||||
264.51 286.175 11744.5 14229.6
|
|
||||||
325.589 238.837 8160.97 6473.84
|
|
||||||
296.241 247.122 2627.53 2431.02
|
|
||||||
319.537 253.996 30963.8 26842.1
|
|
||||||
368.228 244.225 38070.8 26485.3
|
|
||||||
357.32 238.355 0 0
|
|
||||||
352.531 262.45 0 0
|
|
||||||
288.85 238.642 0 0
|
|
||||||
300.151 273.886 1590.95 1647
|
|
||||||
369.683 252.202 7800.05 5426.99
|
|
||||||
361.815 311.12 1393.12 1391.24
|
|
||||||
305.399 242.426 8114.79 7167.87
|
|
||||||
346.218 264.965 0 0
|
|
||||||
332.406 288.152 613.468 622.116
|
|
||||||
294.831 304.374 759.525 923.763
|
|
||||||
316.902 313.934 0 0
|
|
||||||
286.876 232.557 1941.8 1786.57
|
|
||||||
402.667 265.105 9143.57 6167.83
|
|
||||||
335.681 265.567 313.471 268.596
|
|
||||||
409.484 260.111 0 0
|
|
||||||
297.608 234.142 2124.83 1853.74
|
|
||||||
286.432 243.757 1744.83 1665.72
|
|
||||||
294.667 307.894 0 0
|
|
||||||
283.426 255.372 0 0
|
|
||||||
363.569 295.696 49156.8 46627.3
|
|
||||||
425.53 281.433 37971.5 15751.4
|
|
||||||
342.647 280.375 0 0
|
|
||||||
348.579 264.902 0 0
|
|
||||||
381.633 272.249 53601.6 41730
|
|
||||||
296.867 323.421 21794.2 29371.3
|
|
||||||
329.516 303.01 0 0
|
|
||||||
265.848 352.511 0 0
|
|
||||||
407.703 312.019 24882.5 20575.7
|
|
||||||
332.091 317.175 2044.53 2441.33
|
|
||||||
296.055 307.557 0 0
|
|
||||||
444.294 125.151 1565.88 416.272
|
|
||||||
342.298 296.163 33491 33843.9
|
|
||||||
300.142 285.289 5272.72 5823.2
|
|
||||||
359.754 246.222 2160.04 1530.11
|
|
||||||
353.568 268.641 1342.79 1120.49
|
|
||||||
331.55 300.466 1464.53 1635.42
|
|
||||||
290.86 317.736 988.952 1296.62
|
|
||||||
375.264 324.194 0 0
|
|
||||||
296.392 237.649 527.388 476.942
|
|
||||||
412.595 265.126 0 0
|
|
||||||
358.168 293.516 335.679 326.18
|
|
||||||
373.619 253.514 3795.93 2698.32
|
|
||||||
311.271 168.823 1111.34 639.82
|
|
||||||
401.217 261.185 2077.66 1333.29
|
|
||||||
382.668 318.73 2217.16 2097.43
|
|
||||||
346.813 281.22 0 0
|
|
||||||
373.804 300.838 0 0
|
|
||||||
374.134 303.545 3223.5 3063.42
|
|
||||||
389.348 303.899 23619.7 20811.4
|
|
||||||
408.698 261.44 2996.5 1925.09
|
|
||||||
389.632 299.192 1145.44 999.426
|
|
||||||
288.348 320.634 21743.2 29283.9
|
|
||||||
345.135 336.567 20856.5 25179.4
|
|
||||||
288.348 320.634 0 0
|
|
||||||
366.271 272.74 0 0
|
|
||||||
305.439 173.737 28347.8 16385.3
|
|
||||||
334.061 242.239 43779.6 34537.4
|
|
||||||
331.651 288.835 622.236 626.668
|
|
||||||
434.417 107.519 0 0
|
|
||||||
363.091 273.811 3438.61 3003.18
|
|
||||||
293.874 356.488 705.063 1067.37
|
|
||||||
370.197 304.97 0 0
|
|
||||||
282.805 264.13 0 0
|
|
||||||
360.322 331.099 7301.11 5067.38
|
|
||||||
334.52 293.223 7256.71 7375.52
|
|
||||||
368.493 300.185 346.867 333.365
|
|
||||||
334.061 242.239 0 0
|
|
||||||
1
|
1
|
||||||
399.718 288.062 277.33 326.888
|
|
||||||
396.156 187.19 411.45 231.444
|
|
||||||
295.236 216.447 348.989 232.799
|
|
||||||
294.391 216.291 346.461 238.332
|
|
||||||
335.279 108.273 363.052 244.661
|
|
||||||
288.392 161.936 354.401 243.317
|
|
||||||
331.205 316.229 308.971 278.104
|
|
||||||
353.149 271.48 0 0
|
|
||||||
420.158 130.627 0 0
|
|
||||||
287.235 150.893 0 0
|
|
||||||
281.825 107.517 9.9238e-38 8.29566e-38
|
|
||||||
334.52 293.223 0 0
|
|
||||||
295.787 239.941 84296.2 61041.8
|
|
||||||
305.174 101.745 14844.3 9246.4
|
|
||||||
380.191 150.726 607.052 355.205
|
|
||||||
382.588 284.484 -602.438 -748.12
|
|
||||||
306.001 95.6839 7700.34 4476.44
|
|
||||||
326 289.157 649.716 646.544
|
|
||||||
379.107 156.775 1451.93 883.936
|
|
||||||
370.665 137.782 49649.4 28934.7
|
|
||||||
242.405 95.8541 42214.1 37096.1
|
|
||||||
414.896 268.39 2749.2 3183.61
|
|
||||||
326.609 287.896 686.092 644.26
|
|
||||||
305.788 316.286 5741.93 6242.99
|
|
||||||
299.54 327.777 40136.5 52731.5
|
|
||||||
362.082 292.882 1143.1 883.176
|
|
||||||
181.107 38.3101 863.158 503.8
|
|
||||||
365.118 91.1141 3603.11 1967.16
|
|
||||||
249.806 171.61 4203.24 3287.7
|
|
||||||
248.845 172.232 1910.85 1495.44
|
|
||||||
265.848 352.511 1209.93 1536.16
|
|
||||||
202.375 126.468 39881 24727.4
|
|
||||||
316.741 30.4016 10443.3 9743.85
|
|
||||||
163.845 128.749 242.354 273.886
|
|
||||||
371.079 308.799 0 0
|
|
||||||
405.639 100.986 0 0
|
|
||||||
259.714 304.239 2570.62 3053.5
|
|
||||||
409.871 262.759 2825.59 3502.82
|
|
||||||
443.762 165.05 210.739 286.967
|
|
||||||
410.385 156.962 7488.55 5266.83
|
|
||||||
343.309 340.396 0 0
|
|
||||||
314.576 223.709 0 0
|
|
||||||
350.276 227.305 0 0
|
|
||||||
324.818 307.043 0 0
|
|
||||||
272.913 147.353 3248.17 1927.65
|
|
||||||
338.369 98.4246 8493.32 2579.28
|
|
||||||
408.285 291.778 693.292 269.38
|
|
||||||
365.403 307.681 0 0
|
|
||||||
332.693 230.119 1392.13 780.507
|
|
||||||
343.056 27.169 0 0
|
|
||||||
365.67 236.885 0 0
|
|
||||||
290.392 323.935 2193.52 1596.24
|
|
||||||
403.516 260.281 40128.2 24871.3
|
|
||||||
241.516 162.412 20000.5 11983.5
|
|
||||||
287.967 195.201 1184.21 672.988
|
|
||||||
334.161 106.906 2822.46 1829.35
|
|
||||||
316.116 238.015 62188 47402.3
|
|
||||||
362.775 97.8837 1347.81 1002.82
|
|
||||||
225.668 130.918 0 0
|
|
||||||
374.116 199.668 0 0
|
|
||||||
242.724 43.0635 17653 6543.99
|
|
||||||
2
|
2
|
||||||
335.279 108.273 293.316 320.27
|
|
||||||
297.007 307.701 278.345 299.513
|
|
||||||
426.761 279.107 432.432 229.327
|
|
||||||
419.921 312.477 418.514 259.301
|
|
||||||
426.842 290.503 429.598 250.529
|
|
||||||
373.655 148.51 292.586 283.03
|
|
||||||
418.235 284.603 421.399 222.742
|
|
||||||
420.434 264.926 0 0
|
|
||||||
352.788 335.807 0 0
|
|
||||||
415.416 313.132 0 0
|
|
||||||
263.815 294.09 1.10484e-37 6.4847e-38
|
|
||||||
305.535 110.065 0 0
|
|
||||||
412.595 265.126 106723 53235.5
|
|
||||||
427.752 290.847 17837.2 9773.14
|
|
||||||
408.305 313.745 669.344 416.753
|
|
||||||
371.823 244.933 -692.27 -730.191
|
|
||||||
402.457 146.538 6341.08 4468.78
|
|
||||||
381.789 177.569 579.074 509.046
|
|
||||||
274.875 343.767 1633.16 724.912
|
|
||||||
166.112 97.4101 32377.7 33654.5
|
|
||||||
370.878 201.527 35279.3 39546.4
|
|
||||||
397.812 314.803 3592.43 2312.06
|
|
||||||
296.884 213.551 577.334 500.25
|
|
||||||
426.188 126.052 5660.75 5655.29
|
|
||||||
427.315 314.18 59916.9 33616.2
|
|
||||||
431.397 170.804 906.726 660.777
|
|
||||||
400.686 325.265 811.16 534.716
|
|
||||||
406.86 280.189 2376.87 1954.84
|
|
||||||
416.817 179.554 3148.69 3984.16
|
|
||||||
252.425 172.859 1479.71 969.08
|
|
||||||
243.542 167.584 1054.68 1170.54
|
|
||||||
399.353 268.087 46561.3 21383.7
|
|
||||||
285.28 148.61 7844.96 7348.98
|
|
||||||
363.665 100.581 322.701 385.172
|
|
||||||
247.437 171.242 0 0
|
|
||||||
314.514 259.285 0 0
|
|
||||||
293.749 303.981 2065.82 2061.82
|
|
||||||
333.91 295 3324.34 2350.35
|
|
||||||
315.398 261.309 329.16 311.05
|
|
||||||
316.128 260.593 9633.23 5710.5
|
|
||||||
272.051 149.168 0 0
|
|
||||||
353.832 279.852 0 0
|
|
||||||
387.011 252.057 0 0
|
|
||||||
326.729 353.269 0 0
|
|
||||||
387.34 133.756 1872.7 1284.81
|
|
||||||
181.296 90.8006 8085.02 4931.67
|
|
||||||
266.011 359.243 429.942 550.296
|
|
||||||
294.12 356.712 0 0
|
|
||||||
347.414 106.03 1152.89 460.938
|
|
||||||
367.814 243.994 0 0
|
|
||||||
355.437 262.124 0 0
|
|
||||||
276.116 330.028 1952 1870.14
|
|
||||||
245.682 283.175 30593.3 40367.9
|
|
||||||
402.196 280.041 18874.5 25204.7
|
|
||||||
402.042 281.31 1094.17 1461.14
|
|
||||||
334.629 104.275 2227.37 1661.22
|
|
||||||
340.604 99.2014 53221.5 39571.3
|
|
||||||
274.939 286.578 736.908 663.669
|
|
||||||
312.246 85.0304 0 0
|
|
||||||
221.133 93.7771 0 0
|
|
||||||
406.724 181.606 13917.5 9148.03
|
|
||||||
323.202 29.8539 5857.92 6777.65
|
|
||||||
426.245 280.928 2586.42 1900.16
|
|
||||||
260.451 282.346 44694.7 27185.2
|
|
||||||
359.068 259.876 24606.2 20138.1
|
|
||||||
273.922 279.28 0 0
|
|
||||||
315.191 30.302 0 0
|
|
||||||
315.191 30.302 0 0
|
|
||||||
305.196 244.343 2197.48 2254.45
|
|
||||||
263.032 282.079 4625.92 4033.72
|
|
||||||
343.056 27.169 763.856 762.812
|
|
||||||
419.921 312.477 12555.4 7779.03
|
|
||||||
3
|
|
||||||
295.787 239.941 327.113 241.468
|
|
||||||
288.016 312.978 324.56 154.569
|
|
||||||
406.981 181.27 313.085 192.006
|
|
||||||
409.622 156.738 255.664 257.307
|
|
||||||
240.185 45.8944 326.634 199.284
|
|
||||||
192.247 38.5606 400.039 269.443
|
|
||||||
254.941 19.1675 323.848 147.479
|
|
||||||
346.521 97.2295 0 0
|
|
||||||
333.428 104.49 0 0
|
|
||||||
443.762 165.05 0 0
|
|
||||||
299.82 116.172 1.03035e-37 4.68266e-38
|
|
||||||
305.569 314.319 0 0
|
|
||||||
397.884 269.926 78667.3 48778.1
|
|
||||||
309.148 216.613 13085.2 10293.6
|
|
||||||
282.013 159.02 514.543 398.765
|
|
||||||
295.236 216.447 -750.967 -845.493
|
|
||||||
364.446 101.421 7554.75 6391.98
|
|
||||||
271.543 97.2385 610.084 181.188
|
|
||||||
181.25 54.7159 1256.32 714.692
|
|
||||||
263.994 293.329 40653 38883
|
|
||||||
408.698 261.44 41100 17804.8
|
|
||||||
353.822 279.499 2730.41 2397.22
|
|
||||||
319.348 229.23 611.064 694.17
|
|
||||||
248.303 171.551 5551.43 6253.04
|
|
||||||
343.453 350.469 42415.4 52057.9
|
|
||||||
248.103 163.264 1058.88 500.181
|
|
||||||
351.767 237.628 710.112 607.616
|
|
||||||
403.235 308.051 2840.57 2705.22
|
|
||||||
356.193 101.327 4469.91 2918.3
|
|
||||||
361.509 212.926 1789.72 746.505
|
|
||||||
326.729 353.269 1135.64 221.141
|
|
||||||
192.664 66.0166 47135.3 39752.2
|
|
||||||
422.925 305.489 10545.2 4330.54
|
|
||||||
251.919 34.0013 368.641 146.207
|
|
||||||
371.643 267.371 0 0
|
|
||||||
301.358 67.9768 0 0
|
|
||||||
338.448 297.443 2989.35 1886.22
|
|
||||||
315.191 30.302 3419.99 1696.27
|
|
||||||
282.86 225.062 274.304 166.415
|
|
||||||
392.102 332.007 9488.22 9165.17
|
|
||||||
373.4 108.098 0 0
|
|
||||||
351.356 332.102 0 0
|
|
||||||
271.845 150.977 0 0
|
|
||||||
272.826 151.95 0 0
|
|
||||||
298.303 116.572 1878.42 884.044
|
|
||||||
264.599 280.372 8349.59 3651.67
|
|
||||||
414.621 263.536 755.64 318.89
|
|
||||||
267.478 285.116 0 0
|
|
||||||
266.254 281.022 1145.67 528.936
|
|
||||||
260.7 283.611 0 0
|
|
||||||
228.901 101.484 0 0
|
|
||||||
424.669 265.691 2089.66 2893.42
|
|
||||||
296.665 111.453 37341.7 17283.1
|
|
||||||
299.041 110.262 18116.5 8033.05
|
|
||||||
261.828 292.432 1572.14 1040.04
|
|
||||||
351.247 333.123 2336.26 1221.97
|
|
||||||
369.369 137.12 37249.3 11630.9
|
|
||||||
346.973 242.49 770.226 189.503
|
|
||||||
244.898 104.021 0 0
|
|
||||||
384.189 157.394 0 0
|
|
||||||
319.406 353.887 13593 7799.06
|
|
||||||
382.779 91.4915 11543 7359.17
|
|
||||||
272.025 217.951 2564.88 3573.12
|
|
||||||
290.402 213.275 26526.3 24223.5
|
|
||||||
343.056 27.169 25479.8 12931.7
|
|
||||||
272.025 217.951 0 0
|
|
||||||
4
|
|
||||||
5
|
|
||||||
400.989 334.183 422.047 414.724
|
|
||||||
313.356 60.9414 125.826 279.853
|
|
||||||
431.595 280.967 465.697 333.614
|
|
||||||
358.61 244.591 370.732 238.845
|
|
||||||
368.31 313.691 423.186 184.998
|
|
||||||
289.624 184.547 302.475 223.25
|
|
||||||
400.686 325.265 426.843 414.985
|
|
||||||
387.881 192.38 0 0
|
|
||||||
375.877 170.355 0 0
|
|
||||||
346.689 295.032 0 0
|
|
||||||
425.693 277.997 1.36351e-37 1.01756e-37
|
|
||||||
272.132 149.347 0 0
|
|
||||||
356.018 269.283 110482 86978.2
|
|
||||||
290.113 114.274 14743.6 12418.8
|
|
||||||
310.023 326.464 679.756 655.473
|
|
||||||
434.242 221.135 -650.438 -624.074
|
|
||||||
346.789 96.6478 8450.53 6624.66
|
|
||||||
372.378 118.139 745.478 523.338
|
|
||||||
276.795 260.641 1705.25 699.672
|
|
||||||
388.234 262.424 51063.2 30217.9
|
|
||||||
357.376 317.348 46950.4 36224.3
|
|
||||||
417.924 312.039 3283.53 1964.79
|
|
||||||
268.756 275.036 780.072 620.704
|
|
||||||
284.23 148.854 3853.1 4747.09
|
|
||||||
346.422 234.012 61136.2 33666.2
|
|
||||||
399.52 166.664 1116.39 989.154
|
|
||||||
282.264 340.608 751.744 581.762
|
|
||||||
371.08 265.905 2936.82 2359.9
|
|
||||||
316.615 221.693 4062.7 3429.69
|
|
||||||
398.745 305.813 1795.16 1221.89
|
|
||||||
228.696 88.3114 1259.54 847.908
|
|
||||||
320.275 252.553 48114 42793.9
|
|
||||||
364.778 310.381 10662.8 8791.21
|
|
||||||
364.865 309.114 366.987 301.237
|
|
||||||
434.305 111.202 0 0
|
|
||||||
386.775 230.137 0 0
|
|
||||||
340.604 99.2014 3578.44 2892.94
|
|
||||||
430.824 110.997 4082.31 2029.64
|
|
||||||
167.12 107.527 165.674 273.175
|
|
||||||
350.276 227.305 11440.8 5490.88
|
|
||||||
401.504 273.88 0 0
|
|
||||||
415.668 177.131 0 0
|
|
||||||
309.488 56.6346 0 0
|
|
||||||
299.281 373.312 0 0
|
|
||||||
216.989 69.9899 3064.14 2746.17
|
|
||||||
167.12 107.527 3644.83 6009.85
|
|
||||||
6
|
|
||||||
353.822 279.499 300.108 249.188
|
|
||||||
427.54 288.564 350.247 248.64
|
|
||||||
201.598 128.841 421.513 322.452
|
|
||||||
318.787 103.48 453.075 307.593
|
|
||||||
323.629 93.6823 270.415 129.889
|
|
||||||
274.656 111.233 431.017 306.75
|
|
||||||
322.024 244.067 325.105 246.355
|
|
||||||
200.809 129.725 0 0
|
|
||||||
326.729 353.269 0 0
|
|
||||||
267.969 91.93 0 0
|
|
||||||
399.372 298.281 8.02993e-38 8.36956e-38
|
|
||||||
323.489 249.839 0 0
|
|
||||||
427.075 283.229 67052.8 56948.3
|
|
||||||
422.562 288.6 15676.3 11465.7
|
|
||||||
369.494 140.566 319.604 445.693
|
|
||||||
249.922 92.0149 -570.899 -670.775
|
|
||||||
367.161 307.536 5625.58 5952.81
|
|
||||||
365.403 307.681 533.752 571.45
|
|
||||||
341.648 335.838 1078.6 854.912
|
|
||||||
361.815 311.12 30811.6 33750
|
|
||||||
325.49 219.844 40717.4 34745.2
|
|
||||||
324.371 91.2047 2355.77 1791.4
|
|
||||||
355.735 312.588 528.806 590.144
|
|
||||||
393.514 188.838 3217.28 5336.6
|
|
||||||
290.392 323.935 51548.6 40790.1
|
|
||||||
402.457 146.538 779.775 593.856
|
|
||||||
293.749 303.981 444.03 402.9
|
|
||||||
368.606 269.915 2368.36 1575.66
|
|
||||||
293.206 177.398 4491.48 3272.23
|
|
||||||
294.888 176.516 2043.6 1493.12
|
|
||||||
355.409 99.4525 926.452 696.672
|
|
||||||
200.755 101.405 29940.4 22336.7
|
|
||||||
329.48 294.824 6627.52 9327.5
|
|
||||||
356.386 236.479 469.476 315.524
|
|
||||||
374.576 128.273 0 0
|
|
||||||
343.532 242.2 0 0
|
|
||||||
167.293 78.7971 1505.88 2610.12
|
|
||||||
264.69 301.195 2082.85 3041.78
|
|
||||||
326.46 335.593 464.791 329.794
|
|
||||||
191.405 45.3841 6087.32 8594.15
|
|
||||||
268.514 117.022 0 0
|
|
||||||
342.753 92.4752 0 0
|
|
||||||
365.118 91.1141 0 0
|
|
||||||
351.247 333.123 0 0
|
|
||||||
272.389 335.171 1356.36 2558.36
|
|
||||||
393.004 181.793 5085.28 3041.72
|
|
||||||
391.573 182.046 462.298 276.52
|
|
||||||
351.43 336.666 0 0
|
|
||||||
295.925 112.383 658.173 1067.39
|
|
||||||
184.393 42.515 0 0
|
|
||||||
354.596 105.569 0 0
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
@ -137,59 +137,59 @@ int main(int argc, char **argv)
|
||||||
zoom1 = 1;
|
zoom1 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unsigned int nb_ref =3;
|
unsigned int nb_ref =3;
|
||||||
// std::string refData[] = {
|
|
||||||
// "book_training/train_image_000.png",
|
|
||||||
// "book_training/train_image_001.png",
|
|
||||||
// "book_training/000.png",
|
|
||||||
// "book_training/train_image_003.png"};
|
|
||||||
|
|
||||||
unsigned int nb_ref =7;
|
|
||||||
std::string refData[] = {
|
std::string refData[] = {
|
||||||
// "robobo_references/0.jpg",
|
"book_training/train_image_000.png",
|
||||||
// "robobo_references/1.jpg",
|
"book_training/train_image_001.png",
|
||||||
// "robobo_references/2.jpg",
|
"book_training/000.png",
|
||||||
// "robobo_references/3.jpg",
|
"book_training/train_image_003.png"};
|
||||||
// "robobo_references/4.jpg",
|
|
||||||
// "robobo_references/5.jpg",
|
|
||||||
// "robobo_references/6.jpg",
|
|
||||||
|
|
||||||
"robobo_references/000.jpg",
|
// unsigned int nb_ref =7;
|
||||||
"robobo_references/001.jpg",
|
// std::string refData[] = {
|
||||||
"robobo_references/002.jpg",
|
// // "robobo_references/0.jpg",
|
||||||
"robobo_references/003.jpg",
|
// // "robobo_references/1.jpg",
|
||||||
"robobo_references/004.jpg",
|
// // "robobo_references/2.jpg",
|
||||||
"robobo_references/005.jpg",
|
// // "robobo_references/3.jpg",
|
||||||
"robobo_references/006.jpg",
|
// // "robobo_references/4.jpg",
|
||||||
|
// // "robobo_references/5.jpg",
|
||||||
|
// // "robobo_references/6.jpg",
|
||||||
|
|
||||||
"robobo_references/000_2.jpg",
|
// "robobo_references/000.jpg",
|
||||||
"robobo_references/001_2.jpg",
|
// "robobo_references/001.jpg",
|
||||||
"robobo_references/002_2.jpg",
|
// "robobo_references/002.jpg",
|
||||||
"robobo_references/003_2.jpg",
|
// "robobo_references/003.jpg",
|
||||||
"robobo_references/004_2.jpg",
|
// "robobo_references/004.jpg",
|
||||||
"robobo_references/005_2.jpg",
|
// "robobo_references/005.jpg",
|
||||||
"robobo_references/006_2.jpg",
|
// "robobo_references/006.jpg",
|
||||||
"robobo_references/007_2.jpg",
|
|
||||||
|
|
||||||
"robobo_references/000.png",
|
// "robobo_references/000_2.jpg",
|
||||||
"robobo_references/001.png",
|
// "robobo_references/001_2.jpg",
|
||||||
"robobo_references/002.png",
|
// "robobo_references/002_2.jpg",
|
||||||
"robobo_references/003.png",
|
// "robobo_references/003_2.jpg",
|
||||||
"robobo_references/004.png",
|
// "robobo_references/004_2.jpg",
|
||||||
"robobo_references/005.png",
|
// "robobo_references/005_2.jpg",
|
||||||
"robobo_references/006.png",
|
// "robobo_references/006_2.jpg",
|
||||||
"robobo_references/000_a.png",
|
// "robobo_references/007_2.jpg",
|
||||||
"robobo_references/001_a.png",
|
|
||||||
"robobo_references/002_a.png",
|
// "robobo_references/000.png",
|
||||||
"robobo_references/003_a.png",
|
// "robobo_references/001.png",
|
||||||
"robobo_references/004_a.png",
|
// "robobo_references/002.png",
|
||||||
"robobo_references/006_a.png",
|
// "robobo_references/003.png",
|
||||||
"robobo_references/000_2.png",
|
// "robobo_references/004.png",
|
||||||
"robobo_references/001_2.png",
|
// "robobo_references/005.png",
|
||||||
"robobo_references/002_2.png",
|
// "robobo_references/006.png",
|
||||||
"robobo_references/003_2.png",
|
// "robobo_references/000_a.png",
|
||||||
"robobo_references/004_2.png",
|
// "robobo_references/001_a.png",
|
||||||
"robobo_references/006_2.png"};
|
// "robobo_references/002_a.png",
|
||||||
|
// "robobo_references/003_a.png",
|
||||||
|
// "robobo_references/004_a.png",
|
||||||
|
// "robobo_references/006_a.png",
|
||||||
|
// "robobo_references/000_2.png",
|
||||||
|
// "robobo_references/001_2.png",
|
||||||
|
// "robobo_references/002_2.png",
|
||||||
|
// "robobo_references/003_2.png",
|
||||||
|
// "robobo_references/004_2.png",
|
||||||
|
// "robobo_references/006_2.png"};
|
||||||
|
|
||||||
// unsigned int nb_ref =21;
|
// unsigned int nb_ref =21;
|
||||||
// std::string refData[] = {
|
// std::string refData[] = {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,10 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Image matching using Affine-SIFT algorithm.
|
||||||
|
* Allow to find matching keypoints, filter, compute ROI & center of an object in an image, after having built the references (with at least 1 image).
|
||||||
|
* @author : antoine.harle@etu.upmc.Fr
|
||||||
|
* Reference: J.M. Morel and G.Yu, ASIFT: A New Framework for Fully Affine Invariant Image
|
||||||
|
* Comparison, SIAM Journal on Imaging Sciences, vol. 2, issue 2, pp. 438-469, 2009.
|
||||||
|
* Reference: ASIFT online demo (You can try ASIFT with your own images online.)
|
||||||
|
* http://www.ipol.im/pub/algo/my_affine_sift/
|
||||||
|
*/
|
||||||
|
|
||||||
#include "ASIFT_matcher.hpp"
|
#include "ASIFT_matcher.hpp"
|
||||||
|
|
||||||
|
//Default constructor
|
||||||
ASIFT_matcher::ASIFT_matcher(): _nb_refs(0), _total_num_matchings(0), _resize_imgs(false), _showDebug(false), _showInfo(true)
|
ASIFT_matcher::ASIFT_matcher(): _nb_refs(0), _total_num_matchings(0), _resize_imgs(false), _showDebug(false), _showInfo(true)
|
||||||
{
|
{
|
||||||
default_sift_parameters(_siftParam);
|
default_sift_parameters(_siftParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Constuctor from keypoints references (.txt)
|
||||||
|
* ref_path : path to a text file with keypoints reference following the convention of saveReference function.
|
||||||
|
*/
|
||||||
ASIFT_matcher::ASIFT_matcher(const char* ref_path): ASIFT_matcher()
|
ASIFT_matcher::ASIFT_matcher(const char* ref_path): ASIFT_matcher()
|
||||||
{
|
{
|
||||||
if(!loadReferences(ref_path))
|
if(!loadReferences(ref_path))
|
||||||
|
@ -18,7 +32,12 @@ ASIFT_matcher::ASIFT_matcher(const char* ref_path): ASIFT_matcher()
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//Return true if successfull
|
/*
|
||||||
|
* Add a reference image.
|
||||||
|
* image_path : path to the image file (support the same format than CImg / ImageMagick).
|
||||||
|
* num_tilts : Number of virtual tilts applied to the image. More tilts equal to better matching but slower process. Default : 1 (no tilt). Recommended : 8.
|
||||||
|
* Return true if the reference was loaded with success.
|
||||||
|
*/
|
||||||
bool ASIFT_matcher::addReference(const char* image_path, unsigned int num_tilts)
|
bool ASIFT_matcher::addReference(const char* image_path, unsigned int num_tilts)
|
||||||
{
|
{
|
||||||
///// Read input
|
///// Read input
|
||||||
|
@ -69,7 +88,14 @@ bool ASIFT_matcher::addReference(const char* image_path, unsigned int num_tilts)
|
||||||
return addReference(ipixels1, w1, h1, num_tilts);
|
return addReference(ipixels1, w1, h1, num_tilts);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Image : Gray scale image (image size = w*h)
|
/*
|
||||||
|
* Add a reference image.
|
||||||
|
* image : Gray scale image. Image size must be equal to width * height.
|
||||||
|
* w : Width of the image.
|
||||||
|
* h : Height of the image.
|
||||||
|
* num_tilts : Number of virtual tilts applied to the image. More tilts equal to better matching but slower process. Default : 1 (no tilt). Recommended : 8.
|
||||||
|
* Return true if the reference was loaded with success.
|
||||||
|
*/
|
||||||
bool ASIFT_matcher::addReference(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts)
|
bool ASIFT_matcher::addReference(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts)
|
||||||
{
|
{
|
||||||
if(image.size()!=w*h)
|
if(image.size()!=w*h)
|
||||||
|
@ -180,7 +206,12 @@ bool ASIFT_matcher::addReference(const vector<float>& image, unsigned int w, uns
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return number of match
|
/*
|
||||||
|
* Perform matching between an image and the references.
|
||||||
|
* image_path : path to the image file (support the same format than CImg / ImageMagick).
|
||||||
|
* num_tilts : Number of virtual tilts applied to the image. More tilts equal to better matching but slower process. Default : 1 (no tilt). Recommended : 8.
|
||||||
|
* Return number of matching keypoints found.
|
||||||
|
*/
|
||||||
unsigned int ASIFT_matcher::match(const char* image_path, unsigned int num_tilts)
|
unsigned int ASIFT_matcher::match(const char* image_path, unsigned int num_tilts)
|
||||||
{
|
{
|
||||||
if(_nb_refs<=0)
|
if(_nb_refs<=0)
|
||||||
|
@ -234,8 +265,14 @@ unsigned int ASIFT_matcher::match(const char* image_path, unsigned int num_tilts
|
||||||
return match(ipixels1, w1, h1, num_tilts);
|
return match(ipixels1, w1, h1, num_tilts);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Image : Gray scale image (image size = w*h)
|
/*
|
||||||
//Return number of match
|
* Perform matching between an image and the references.
|
||||||
|
* image : Gray scale image. Image size must be equal to width * height.
|
||||||
|
* w : Width of the image.
|
||||||
|
* h : Height of the image.
|
||||||
|
* num_tilts : Number of virtual tilts applied to the image. More tilts equal to better matching but slower process. Default : 1 (no tilt). Recommended : 8.
|
||||||
|
* Return number of matching keypoints found.
|
||||||
|
*/
|
||||||
unsigned int ASIFT_matcher::match(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts)
|
unsigned int ASIFT_matcher::match(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts)
|
||||||
{
|
{
|
||||||
if(image.size()!=w*h)
|
if(image.size()!=w*h)
|
||||||
|
@ -366,7 +403,15 @@ unsigned int ASIFT_matcher::match(const vector<float>& image, unsigned int w, un
|
||||||
return _total_num_matchings;
|
return _total_num_matchings;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return true if successfull
|
/*
|
||||||
|
* Compute the bounding rectangle of the matching keypoints.
|
||||||
|
* Match function must have been called before and found at least one matching keypoint.
|
||||||
|
* x : X-coordinate of the upper-left point.
|
||||||
|
* y : Y-coordinate of the upper-left point.
|
||||||
|
* h : Height of the rectangle.
|
||||||
|
* w : Width of the rectangle.
|
||||||
|
* Return true if the ROI was succesfully found and arguments modified.
|
||||||
|
*/
|
||||||
bool ASIFT_matcher::computeROI(int& x, int& y, unsigned int& h, unsigned int& w) const
|
bool ASIFT_matcher::computeROI(int& x, int& y, unsigned int& h, unsigned int& w) const
|
||||||
{
|
{
|
||||||
if(getNbMatch()==0)
|
if(getNbMatch()==0)
|
||||||
|
@ -410,7 +455,13 @@ bool ASIFT_matcher::computeROI(int& x, int& y, unsigned int& h, unsigned int& w)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return true if successfull
|
/*
|
||||||
|
* Compute the centroid of the matching keypoints.
|
||||||
|
* Match function must have been called before and found at least one matching keypoint.
|
||||||
|
* cx : X-coordinate of the centroid.
|
||||||
|
* cy : Y-coordinate of the centroid.
|
||||||
|
* Return true if the ROI was succesfully found and arguments modified.
|
||||||
|
*/
|
||||||
bool ASIFT_matcher::computeCenter(int& cx, int& cy) const
|
bool ASIFT_matcher::computeCenter(int& cx, int& cy) const
|
||||||
{
|
{
|
||||||
if(getNbMatch()==0)
|
if(getNbMatch()==0)
|
||||||
|
@ -437,11 +488,13 @@ bool ASIFT_matcher::computeCenter(int& cx, int& cy) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Filter keypoint which are far (Euclidian distance) from the center.
|
/*
|
||||||
//Not optimized
|
* Perform a standard deviation filtering on the matching keypoints.
|
||||||
//threshold : 1-68%/2-95%/3-99%
|
* Match function must have been called before and found at least one matching keypoint.
|
||||||
//Return true if successfull
|
* threshold : Filtering coefficient. 1-Keep 68% of the keypoints / 2-Keep 95% of the keypoints / 3-Keep 99% of the keypoints. Default : 2.
|
||||||
bool ASIFT_matcher::distFilter(int threshold=2)
|
* Return true if the filtering is done.
|
||||||
|
*/
|
||||||
|
bool ASIFT_matcher::distFilter(int threshold)
|
||||||
{
|
{
|
||||||
if(_showInfo)
|
if(_showInfo)
|
||||||
cout<<"filtering keypoint..."<<endl;
|
cout<<"filtering keypoint..."<<endl;
|
||||||
|
@ -520,8 +573,16 @@ bool ASIFT_matcher::distFilter(int threshold=2)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save reference data necessary for the matching
|
/*
|
||||||
//Doesn't save references images or Sift parameters
|
* Save reference data necessary for the matching.
|
||||||
|
* ref_path : path were the reference data will be saved (.txt).
|
||||||
|
* Follow a modified convention of David Lowe (SIFT keypoints) :
|
||||||
|
* - Number of reference.
|
||||||
|
* - Number of keypoints in the reference / Length of the descriptors (128) / Width of the reference / Height of the reference / Number of tilts.
|
||||||
|
* -
|
||||||
|
* - Keypoints (row, col, scale, orientation, desciptor (128 integers)).
|
||||||
|
* Return true if the reference data was successfully saved.
|
||||||
|
*/
|
||||||
bool ASIFT_matcher::saveReferences(const char* ref_path) const
|
bool ASIFT_matcher::saveReferences(const char* ref_path) const
|
||||||
{
|
{
|
||||||
// Write all the keypoints (row, col, scale, orientation, desciptor (128 integers))
|
// Write all the keypoints (row, col, scale, orientation, desciptor (128 integers))
|
||||||
|
@ -572,8 +633,16 @@ bool ASIFT_matcher::saveReferences(const char* ref_path) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load reference data necessary for the matching
|
/*
|
||||||
//Doesn't load references images or Sift parameters
|
* Load reference data necessary for the matching.
|
||||||
|
* ref_path : path from were the reference data will be loaded (.txt).
|
||||||
|
* Follow a modified convention of David Lowe (SIFT keypoints) :
|
||||||
|
* - Number of reference.
|
||||||
|
* - Number of keypoints in the reference / Length of the descriptors (128) / Width of the reference / Height of the reference / Number of tilts.
|
||||||
|
* -
|
||||||
|
* - Keypoints (row, col, scale, orientation, desciptor (128 integers)).
|
||||||
|
* Return true if the reference data was successfully loaded.
|
||||||
|
*/
|
||||||
bool ASIFT_matcher::loadReferences(const char* ref_path)
|
bool ASIFT_matcher::loadReferences(const char* ref_path)
|
||||||
{
|
{
|
||||||
std::ifstream ref_file(ref_path);
|
std::ifstream ref_file(ref_path);
|
||||||
|
@ -838,6 +907,10 @@ bool ASIFT_matcher::loadReferences(const char* ref_path)
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Assignation operator.
|
||||||
|
* m : ASIFT matcher object to copy.
|
||||||
|
*/
|
||||||
ASIFT_matcher& ASIFT_matcher::operator=(const ASIFT_matcher& m)
|
ASIFT_matcher& ASIFT_matcher::operator=(const ASIFT_matcher& m)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -862,7 +935,7 @@ ASIFT_matcher& ASIFT_matcher::operator=(const ASIFT_matcher& m)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Debugging function
|
//Debugging function : print content form the ASIFT matcher.
|
||||||
void ASIFT_matcher::print() const
|
void ASIFT_matcher::print() const
|
||||||
{
|
{
|
||||||
for(unsigned int i=0; i< _keys.size();i++)
|
for(unsigned int i=0; i< _keys.size();i++)
|
||||||
|
@ -892,13 +965,3 @@ void ASIFT_matcher::print() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// unsigned int ASIFT_matcher::getNbMatch() const
|
|
||||||
// {
|
|
||||||
// unsigned int res = 0;
|
|
||||||
// for (unsigned int i=0;i<_num_matchings.size();i++)
|
|
||||||
// {
|
|
||||||
// res+=_num_matchings[i];
|
|
||||||
// }
|
|
||||||
// return res;
|
|
||||||
// }
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
/*
|
||||||
|
* Image matching using Affine-SIFT algorithm.
|
||||||
|
* Allow to find matching keypoints, filter, compute ROI & center of an object in an image, after having built the references (with at least 1 image).
|
||||||
|
* @author : antoine.harle@etu.upmc.Fr
|
||||||
|
* Reference: J.M. Morel and G.Yu, ASIFT: A New Framework for Fully Affine Invariant Image
|
||||||
|
* Comparison, SIAM Journal on Imaging Sciences, vol. 2, issue 2, pp. 438-469, 2009.
|
||||||
|
* Reference: ASIFT online demo (You can try ASIFT with your own images online.)
|
||||||
|
* http://www.ipol.im/pub/algo/my_affine_sift/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef ASIFTMATCHER_HPP
|
#ifndef ASIFTMATCHER_HPP
|
||||||
#define ASIFTMATCHER_HPP
|
#define ASIFTMATCHER_HPP
|
||||||
|
|
||||||
|
@ -30,28 +41,28 @@ using namespace std;
|
||||||
|
|
||||||
typedef vector< vector< keypointslist > > asift_keypoints;
|
typedef vector< vector< keypointslist > > asift_keypoints;
|
||||||
|
|
||||||
//ASIFT wrapper
|
|
||||||
class ASIFT_matcher
|
class ASIFT_matcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ASIFT_matcher();
|
ASIFT_matcher();//Default constructor.
|
||||||
ASIFT_matcher(const char* ref_path);
|
ASIFT_matcher(const char* ref_path); //Constuctor from keypoints references (.txt).
|
||||||
ASIFT_matcher(const ASIFT_matcher& matcher) { *this = matcher;}
|
ASIFT_matcher(const ASIFT_matcher& matcher) { *this = matcher;} //Copy constructor.
|
||||||
// virtual ~ASIFT_matcher();
|
// virtual ~ASIFT_matcher();
|
||||||
|
|
||||||
bool addReference(const char* image_path, unsigned int num_tilts=1);
|
bool addReference(const char* image_path, unsigned int num_tilts =1); //Add a reference image.
|
||||||
bool addReference(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts =1);
|
bool addReference(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts =1); //Add a reference image.
|
||||||
unsigned int match(const char* image_path, unsigned int num_tilts =1);
|
unsigned int match(const char* image_path, unsigned int num_tilts =1); //Perform matching between an image and the references.
|
||||||
unsigned int match(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts =1);
|
unsigned int match(const vector<float>& image, unsigned int w, unsigned int h, unsigned int num_tilts =1); //Perform matching between an image and the references.
|
||||||
bool computeROI(int& x, int& y, unsigned int& h, unsigned int& w) const; //Compute the bounding rectangle of the keypoints
|
bool computeROI(int& x, int& y, unsigned int& h, unsigned int& w) const; //Compute the bounding rectangle of the mathcing keypoints.
|
||||||
bool computeCenter(int& cx, int& cy) const;
|
bool computeCenter(int& cx, int& cy) const; //Compute the centroid of the matching keypoints.
|
||||||
bool distFilter(int threshold); //Filter keypoint which are far (Euclidian distance) from the center.
|
bool distFilter(int threshold =2); //Perform a standard deviation filtering on the matching keypoints.
|
||||||
|
|
||||||
bool saveReferences(const char* ref_path) const;
|
bool saveReferences(const char* ref_path) const; //Save reference data necessary for the matching.
|
||||||
bool loadReferences(const char* ref_path);
|
bool loadReferences(const char* ref_path); //Load reference data necessary for the matching.
|
||||||
|
|
||||||
ASIFT_matcher& operator=(const ASIFT_matcher& m);
|
ASIFT_matcher& operator=(const ASIFT_matcher& m); //Assignation operator.
|
||||||
|
|
||||||
|
//Setter/Getter
|
||||||
unsigned int getNbRef() const{ return _nb_refs;}
|
unsigned int getNbRef() const{ return _nb_refs;}
|
||||||
const vector< vector< float > >& getRefImgs() const{ return _im_refs;}
|
const vector< vector< float > >& getRefImgs() const{ return _im_refs;}
|
||||||
const vector< pair<int,int> >& getSizeRef() const{ return _size_refs;}
|
const vector< pair<int,int> >& getSizeRef() const{ return _size_refs;}
|
||||||
|
@ -72,31 +83,31 @@ public:
|
||||||
bool isShowingInfo() const{ return _showInfo;}
|
bool isShowingInfo() const{ return _showInfo;}
|
||||||
void showInfo(bool showInfo){ _showInfo=showInfo;}
|
void showInfo(bool showInfo){ _showInfo=showInfo;}
|
||||||
|
|
||||||
void print() const; //Debugging function
|
void print() const; //Debugging function : print content form the ASIFT matcher.
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//Reference Images
|
//Reference Images
|
||||||
unsigned int _nb_refs;// = 0; //Number of reference images
|
unsigned int _nb_refs;//Number of reference images
|
||||||
vector< vector< float > > _im_refs; //Reference images used for matching
|
vector< vector< float > > _im_refs; //Reference images used for matching
|
||||||
vector< pair<int,int> > _size_refs; //Width/Height
|
vector< pair<int,int> > _size_refs; //Width/Height
|
||||||
vector<float> _zoom_refs; //Zoom coeffs
|
vector<float> _zoom_refs; //Zoom coeffs
|
||||||
|
|
||||||
//ASIFT Keypoints
|
//Reference ASIFT Keypoints
|
||||||
vector< int > _num_keys; //Number of keypoint/reference
|
vector< int > _num_keys; //Number of keypoint/reference
|
||||||
vector< int > _num_tilts; //Number of tilts/reference (Speed VS Precision)
|
vector< int > _num_tilts; //Number of tilts/reference (Speed VS Precision)
|
||||||
vector< asift_keypoints > _keys; //Keypoints
|
vector< asift_keypoints > _keys; //Reference keypoints
|
||||||
|
|
||||||
//Matchs
|
//Matchs
|
||||||
unsigned int _total_num_matchings;
|
unsigned int _total_num_matchings; //Number of matching keypoints.
|
||||||
vector < unsigned int > _num_matchings; //Number of match/reference
|
vector < unsigned int > _num_matchings; //Number of match/reference
|
||||||
vector< matchingslist > _matchings; //Matchs
|
vector< matchingslist > _matchings; //Matching keypoints
|
||||||
|
|
||||||
siftPar _siftParam; //SIFT parameters
|
siftPar _siftParam; //SIFT parameters
|
||||||
|
|
||||||
//Flags
|
//Flags
|
||||||
bool _resize_imgs;// = false; //Resize images to IM_X/IM_Y ?
|
bool _resize_imgs;//Resize images to IM_X/IM_Y ?
|
||||||
bool _showDebug;// = 0; //Show debugging messages ?
|
bool _showDebug;//Show debugging messages ?
|
||||||
bool _showInfo; //Show info messages
|
bool _showInfo; //Show info messages
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
/*
|
||||||
|
* ROS wrapper for the ASIFT_matcher object.
|
||||||
|
* Track an object described in the references in a RGBD stream and publish it's center.
|
||||||
|
* @author : antoine.harle@etu.upmc.Fr
|
||||||
|
* @see : ASIFT_matcher.cpp/.hpp, asift_match.launch
|
||||||
|
*/
|
||||||
|
|
||||||
#include "ROS_matcher.hpp"
|
#include "ROS_matcher.hpp"
|
||||||
|
|
||||||
ROS_matcher::ROS_matcher(): _status(MATCHER_STATUS_WAITING_INIT)
|
ROS_matcher::ROS_matcher(): _status(MATCHER_STATUS_WAITING_INIT)
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Rviz interactive object.
|
||||||
|
* @author : antoine.harle@etu.upmc.Fr
|
||||||
|
* @see : RvizInterface.cpp/.hpp
|
||||||
|
*/
|
||||||
|
|
||||||
#include "InteractiveObject.hpp"
|
#include "InteractiveObject.hpp"
|
||||||
|
|
||||||
unsigned int InteractiveObject::nextObjectID = 1;
|
unsigned int InteractiveObject::nextObjectID = 1;
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Rviz interactive object.
|
||||||
|
* @author : antoine.harle@etu.upmc.Fr
|
||||||
|
* @see : RvizInterface.cpp/.hpp
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef INTERACTIVEOBJECT_HPP
|
#ifndef INTERACTIVEOBJECT_HPP
|
||||||
#define INTERACTIVEOBJECT_HPP
|
#define INTERACTIVEOBJECT_HPP
|
||||||
|
|
||||||
|
|
|
@ -1,35 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Rviz panel for the configuration of the RvizInterface.
|
||||||
|
* @author : antoine.harle@etu.upmc.Fr
|
||||||
|
* @see : RvizInterface.cpp/.hpp
|
||||||
|
*/
|
||||||
|
|
||||||
#include "InterfacePanel.hpp"
|
#include "InterfacePanel.hpp"
|
||||||
|
|
||||||
namespace rviz_interface
|
namespace rviz_interface
|
||||||
{
|
{
|
||||||
|
|
||||||
// BEGIN_TUTORIAL
|
|
||||||
// Here is the implementation of the InterfacePanel class. InterfacePanel
|
|
||||||
// has these responsibilities:
|
|
||||||
//
|
|
||||||
// - Act as a container for GUI elements DriveWidget and QLineEdit.
|
|
||||||
// - Publish command velocities 10 times per second (whether 0 or not).
|
|
||||||
// - Saving and restoring internal state from a config file.
|
|
||||||
//
|
|
||||||
// We start with the constructor, doing the standard Qt thing of
|
|
||||||
// passing the optional *parent* argument on to the superclass
|
|
||||||
// constructor, and also zero-ing the velocities we will be
|
|
||||||
// publishing.
|
|
||||||
InterfacePanel::InterfacePanel( QWidget* parent ): rviz::Panel( parent )
|
InterfacePanel::InterfacePanel( QWidget* parent ): rviz::Panel( parent )
|
||||||
{
|
{
|
||||||
// Next we lay out the "output topic" text entry field using a
|
|
||||||
// QLabel and a QLineEdit in a QHBoxLayout.
|
|
||||||
QHBoxLayout* error_layout = new QHBoxLayout;
|
QHBoxLayout* error_layout = new QHBoxLayout;
|
||||||
error_layout->addWidget( new QLabel( "Max Error:" ));
|
error_layout->addWidget( new QLabel( "Max Error:" ));
|
||||||
_max_error_editor = new QLineEdit;
|
_max_error_editor = new QLineEdit;
|
||||||
// max_error_editor->setValidator( new QDoubleValidator(0,MAX_ERROR,1000,max_error_editor)); // Ne gère pas les exceptions tout seul (retourne QValidator::Intermediate pour les valeurs hors bornes)
|
|
||||||
error_layout->addWidget( _max_error_editor );
|
error_layout->addWidget( _max_error_editor );
|
||||||
//setLayout( error_layout );
|
|
||||||
|
|
||||||
// Then create the control widget.
|
|
||||||
// drive_widget_ = new DriveWidget;
|
|
||||||
|
|
||||||
// Lay out the topic field above the control widget.
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout;
|
QVBoxLayout* layout = new QVBoxLayout;
|
||||||
_objective_type_editor = new QCheckBox( "Precise Objective" );
|
_objective_type_editor = new QCheckBox( "Precise Objective" );
|
||||||
_show_visuals_editor = new QCheckBox( "Show Visuals" );
|
_show_visuals_editor = new QCheckBox( "Show Visuals" );
|
||||||
|
@ -41,29 +27,14 @@ InterfacePanel::InterfacePanel( QWidget* parent ): rviz::Panel( parent )
|
||||||
layout->addWidget( _show_visuals_editor );
|
layout->addWidget( _show_visuals_editor );
|
||||||
setLayout( layout );
|
setLayout( layout );
|
||||||
|
|
||||||
// Create a timer for sending the output. Motor controllers want to
|
|
||||||
// be reassured frequently that they are doing the right thing, so
|
|
||||||
// we keep re-sending velocities even when they aren't changing.
|
|
||||||
//
|
|
||||||
// Here we take advantage of QObject's memory management behavior:
|
|
||||||
// since "this" is passed to the new QTimer as its parent, the
|
|
||||||
// QTimer is deleted by the QObject destructor when this InterfacePanel
|
|
||||||
// object is destroyed. Therefore we don't need to keep a pointer
|
|
||||||
// to the timer.
|
|
||||||
// QTimer* output_timer = new QTimer( this );
|
|
||||||
|
|
||||||
// Next we make signal/slot connections.
|
// Next we make signal/slot connections.
|
||||||
connect( _max_error_editor, SIGNAL( editingFinished() ), this, SLOT( updateError() ));
|
connect( _max_error_editor, SIGNAL( editingFinished() ), this, SLOT( updateError() ));
|
||||||
connect( _objective_type_editor, SIGNAL( stateChanged(int) ), this, SLOT( updateType(int) ));
|
connect( _objective_type_editor, SIGNAL( stateChanged(int) ), this, SLOT( updateType(int) ));
|
||||||
connect(_reset_button, SIGNAL (released()), this, SLOT (handleResetButton()));
|
connect(_reset_button, SIGNAL (released()), this, SLOT (handleResetButton()));
|
||||||
connect( _show_visuals_editor, SIGNAL( stateChanged(int) ), this, SLOT( updateVisuals(int) ));
|
connect( _show_visuals_editor, SIGNAL( stateChanged(int) ), this, SLOT( updateVisuals(int) ));
|
||||||
// connect( output_timer, SIGNAL( timeout() ), this, SLOT( sendVel() ));
|
|
||||||
|
|
||||||
// Start the timer.
|
//Error editor disabled by default
|
||||||
// output_timer->start( 100 );
|
|
||||||
|
|
||||||
// Make the control widget start disabled, since we don't start with an output topic.
|
|
||||||
// drive_widget_->setEnabled( false );
|
|
||||||
_max_error_editor->setEnabled( false );
|
_max_error_editor->setEnabled( false );
|
||||||
|
|
||||||
_config_publisher = _nh.advertise<rviz_interface::InterfaceConfig>( "/RvizInterface/interface_config", 1 );
|
_config_publisher = _nh.advertise<rviz_interface::InterfaceConfig>( "/RvizInterface/interface_config", 1 );
|
||||||
|
@ -75,10 +46,7 @@ InterfacePanel::~InterfacePanel()
|
||||||
delete _objective_type_editor;
|
delete _objective_type_editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the topic name from the QLineEdit and call setTopic() with the
|
//Update the error in the current_configuration & publish the configuration.
|
||||||
// results. This is connected to QLineEdit::editingFinished() which
|
|
||||||
// fires when the user presses Enter or Tab or otherwise moves focus
|
|
||||||
// away.
|
|
||||||
void InterfacePanel::updateError()
|
void InterfacePanel::updateError()
|
||||||
{
|
{
|
||||||
current_config.max_error = _max_error_editor->text().toDouble();
|
current_config.max_error = _max_error_editor->text().toDouble();
|
||||||
|
@ -89,6 +57,7 @@ void InterfacePanel::updateError()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Update the objective type (ie Precise or not) in the current_configuration & publish the configuration.
|
||||||
void InterfacePanel::updateType(int state)
|
void InterfacePanel::updateType(int state)
|
||||||
{
|
{
|
||||||
current_config.objective_type = state;
|
current_config.objective_type = state;
|
||||||
|
@ -107,6 +76,7 @@ void InterfacePanel::updateType(int state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Update the visual flag (ie Show visuals or not) in the current_configuration & publish the configuration.
|
||||||
void InterfacePanel::updateVisuals(int state)
|
void InterfacePanel::updateVisuals(int state)
|
||||||
{
|
{
|
||||||
current_config.show_visuals = state;
|
current_config.show_visuals = state;
|
||||||
|
@ -116,6 +86,7 @@ void InterfacePanel::updateVisuals(int state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Send a signal through the configuration telling the subscriber to follow the object it's linked to.
|
||||||
void InterfacePanel::handleResetButton()
|
void InterfacePanel::handleResetButton()
|
||||||
{
|
{
|
||||||
current_config.follow_object = true;
|
current_config.follow_object = true;
|
||||||
|
@ -126,15 +97,6 @@ void InterfacePanel::handleResetButton()
|
||||||
current_config.follow_object = false;
|
current_config.follow_object = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void InterfacePanel::setError( const QString& error )
|
|
||||||
// {
|
|
||||||
// current_config.max_error = error.toDouble();
|
|
||||||
// if( ros::ok() && _config_publisher )
|
|
||||||
// {
|
|
||||||
// _config_publisher.publish( current_config );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Save all configuration data from this panel to the given
|
// Save all configuration data from this panel to the given
|
||||||
// Config object. It is important here that you call save()
|
// Config object. It is important here that you call save()
|
||||||
// on the parent class so the class id and panel name get saved.
|
// on the parent class so the class id and panel name get saved.
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* Rviz panel for the configuration of the RvizInterface.
|
||||||
|
* @author : antoine.harle@etu.upmc.Fr
|
||||||
|
* @see : RvizInterface.cpp/.hpp
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef INTERFACE_PANEL_HPP
|
#ifndef INTERFACE_PANEL_HPP
|
||||||
#define INTERFACE_PANEL_HPP
|
#define INTERFACE_PANEL_HPP
|
||||||
|
|
||||||
|
@ -27,24 +33,13 @@ class QLineEdit;
|
||||||
|
|
||||||
namespace rviz_interface
|
namespace rviz_interface
|
||||||
{
|
{
|
||||||
// BEGIN_TUTORIAL
|
|
||||||
// Here we declare our new subclass of rviz::Panel. Every panel which
|
|
||||||
// can be added via the Panels/Add_New_Panel menu is a subclass of
|
|
||||||
// rviz::Panel.
|
|
||||||
//
|
|
||||||
class InterfacePanel: public rviz::Panel
|
class InterfacePanel: public rviz::Panel
|
||||||
{
|
{
|
||||||
// This class uses Qt slots and is a subclass of QObject, so it needs
|
// This class uses Qt slots and is a subclass of QObject, so it needs
|
||||||
// the Q_OBJECT macro.
|
// the Q_OBJECT macro.
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
// QWidget subclass constructors usually take a parent widget
|
|
||||||
// parameter (which usually defaults to 0). At the same time,
|
|
||||||
// pluginlib::ClassLoader creates instances by calling the default
|
|
||||||
// constructor (with no arguments). Taking the parameter and giving
|
|
||||||
// a default of 0 lets the default constructor work and also lets
|
|
||||||
// someone using the class for something else to pass in a parent
|
|
||||||
// widget as they normally would with Qt.
|
|
||||||
InterfacePanel( QWidget* parent = 0 );
|
InterfacePanel( QWidget* parent = 0 );
|
||||||
~InterfacePanel();
|
~InterfacePanel();
|
||||||
|
|
||||||
|
@ -57,42 +52,30 @@ public:
|
||||||
// Next come a couple of public Qt slots.
|
// Next come a couple of public Qt slots.
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
|
||||||
// void setError( const QString& error );
|
|
||||||
|
|
||||||
// Here we declare some internal slots.
|
// Here we declare some internal slots.
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
|
|
||||||
|
|
||||||
void updateError();
|
void updateError(); //Update the error in the current_configuration & publish the configuration.
|
||||||
void updateType(int state);
|
void updateType(int state); //Update the objective type (ie Precise or not) in the current_configuration & publish the configuration.
|
||||||
void updateVisuals(int state);
|
void updateVisuals(int state); //Update the visual flag (ie Show visuals or not) in the current_configuration & publish the configuration.
|
||||||
void handleResetButton();
|
void handleResetButton(); //Send a signal through the configuration telling the subscriber to follow the object it's linked to.
|
||||||
|
|
||||||
|
|
||||||
// Then we finish up with protected member variables.
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
rviz_interface::InterfaceConfig current_config;
|
rviz_interface::InterfaceConfig current_config; //Current configuration which is sent at every interaction with the panel.
|
||||||
|
|
||||||
// One-line text editor for entering the outgoing ROS topic name.
|
QLineEdit* _max_error_editor; //Line editor used to let user cusomize the maximum error allowed.
|
||||||
QLineEdit* _max_error_editor;
|
QCheckBox* _objective_type_editor; //CheckBox used to modify the objective type.
|
||||||
QCheckBox* _objective_type_editor;
|
QCheckBox* _show_visuals_editor; //CheckBox used to choose if the error area should be shown.
|
||||||
QCheckBox* _show_visuals_editor;
|
QPushButton* _reset_button; //Button to reattach a marker to it's linked object.
|
||||||
QPushButton* _reset_button;
|
|
||||||
|
|
||||||
// The current name of the output topic.
|
//Publisher
|
||||||
// QString _max_error;
|
|
||||||
|
|
||||||
// The ROS publisher for the command velocity.
|
|
||||||
ros::Publisher _config_publisher;
|
ros::Publisher _config_publisher;
|
||||||
|
|
||||||
// The ROS node handle.
|
// The ROS node handle.
|
||||||
ros::NodeHandle _nh;
|
ros::NodeHandle _nh;
|
||||||
|
|
||||||
// The latest velocity values from the drive widget.
|
|
||||||
// float linear_velocity_;
|
|
||||||
// float angular_velocity_;
|
|
||||||
// END_TUTORIAL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace rviz_plugin_tutorials
|
} // end namespace rviz_plugin_tutorials
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
/*
|
||||||
|
* Rviz interface to send objective.
|
||||||
|
* Composed of 3D marker and a configuration panel.
|
||||||
|
* @author : antoine.harle@etu.upmc.Fr
|
||||||
|
* @see : InteractiveObject.cpp/.hpp, InterfacePanel.cpp/.hpp
|
||||||
|
*/
|
||||||
|
|
||||||
#include "RvizInterface.hpp"
|
#include "RvizInterface.hpp"
|
||||||
|
|
||||||
//Constructeur
|
//Constructeur
|
||||||
|
@ -86,6 +93,7 @@ void RvizInterface::configCallback(const rviz_interface::InterfaceConfig & new_c
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
//Fonction callback gérant la position des objets
|
||||||
void RvizInterface::positionCallback(const rviz_interface::NamedPoint & new_center)
|
void RvizInterface::positionCallback(const rviz_interface::NamedPoint & new_center)
|
||||||
{
|
{
|
||||||
for(unsigned int i=0;i<_objects.size();i++)
|
for(unsigned int i=0;i<_objects.size();i++)
|
||||||
|
@ -107,6 +115,7 @@ void RvizInterface::positionCallback(const rviz_interface::NamedPoint & new_cent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//RvizInterface node.
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
//Initiate ROS
|
//Initiate ROS
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
/*
|
||||||
|
* Rviz interface to send objective.
|
||||||
|
* Composed of 3D marker and a configuration panel.
|
||||||
|
* @author : antoine.harle@etu.upmc.Fr
|
||||||
|
* @see : InteractiveObject.cpp/.hpp, InterfacePanel.cpp/.hpp
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef RVIZINTERFACE_HPP
|
#ifndef RVIZINTERFACE_HPP
|
||||||
#define RVIZINTERFACE_HPP
|
#define RVIZINTERFACE_HPP
|
||||||
|
|
||||||
|
@ -38,8 +45,7 @@ public:
|
||||||
//Fonction Callback du panel Rviz gérant les configurations
|
//Fonction Callback du panel Rviz gérant les configurations
|
||||||
void configCallback(const rviz_interface::InterfaceConfig & new_config);
|
void configCallback(const rviz_interface::InterfaceConfig & new_config);
|
||||||
|
|
||||||
//Fonction callback gérant la position de l'objet
|
//Fonction callback gérant la position des objets
|
||||||
//PROVISOIRE : Pour un seul objet avec test PCL
|
|
||||||
void positionCallback(const rviz_interface::NamedPoint & new_center);
|
void positionCallback(const rviz_interface::NamedPoint & new_center);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue