Commit fc610979 authored by berak's avatar berak

export BOW to script wrappers

parent 09f9b35b
...@@ -1528,17 +1528,17 @@ CV_EXPORTS void evaluateGenericDescriptorMatcher( const Mat& img1, const Mat& im ...@@ -1528,17 +1528,17 @@ CV_EXPORTS void evaluateGenericDescriptorMatcher( const Mat& img1, const Mat& im
/* /*
* Abstract base class for training of a 'bag of visual words' vocabulary from a set of descriptors * Abstract base class for training of a 'bag of visual words' vocabulary from a set of descriptors
*/ */
class CV_EXPORTS BOWTrainer class CV_EXPORTS_W BOWTrainer
{ {
public: public:
BOWTrainer(); BOWTrainer();
virtual ~BOWTrainer(); virtual ~BOWTrainer();
void add( const Mat& descriptors ); CV_WRAP void add( const Mat& descriptors );
const vector<Mat>& getDescriptors() const; CV_WRAP const vector<Mat>& getDescriptors() const;
int descripotorsCount() const; CV_WRAP int descripotorsCount() const;
virtual void clear(); CV_WRAP virtual void clear();
/* /*
* Train visual words vocabulary, that is cluster training descriptors and * Train visual words vocabulary, that is cluster training descriptors and
...@@ -1547,8 +1547,8 @@ public: ...@@ -1547,8 +1547,8 @@ public:
* *
* descriptors Training descriptors computed on images keypoints. * descriptors Training descriptors computed on images keypoints.
*/ */
virtual Mat cluster() const = 0; CV_WRAP virtual Mat cluster() const = 0;
virtual Mat cluster( const Mat& descriptors ) const = 0; CV_WRAP virtual Mat cluster( const Mat& descriptors ) const = 0;
protected: protected:
vector<Mat> descriptors; vector<Mat> descriptors;
...@@ -1558,16 +1558,16 @@ protected: ...@@ -1558,16 +1558,16 @@ protected:
/* /*
* This is BOWTrainer using cv::kmeans to get vocabulary. * This is BOWTrainer using cv::kmeans to get vocabulary.
*/ */
class CV_EXPORTS BOWKMeansTrainer : public BOWTrainer class CV_EXPORTS_W BOWKMeansTrainer : public BOWTrainer
{ {
public: public:
BOWKMeansTrainer( int clusterCount, const TermCriteria& termcrit=TermCriteria(), CV_WRAP BOWKMeansTrainer( int clusterCount, const TermCriteria& termcrit=TermCriteria(),
int attempts=3, int flags=KMEANS_PP_CENTERS ); int attempts=3, int flags=KMEANS_PP_CENTERS );
virtual ~BOWKMeansTrainer(); virtual ~BOWKMeansTrainer();
// Returns trained vocabulary (i.e. cluster centers). // Returns trained vocabulary (i.e. cluster centers).
virtual Mat cluster() const; CV_WRAP virtual Mat cluster() const;
virtual Mat cluster( const Mat& descriptors ) const; CV_WRAP virtual Mat cluster( const Mat& descriptors ) const;
protected: protected:
...@@ -1580,21 +1580,24 @@ protected: ...@@ -1580,21 +1580,24 @@ protected:
/* /*
* Class to compute image descriptor using bag of visual words. * Class to compute image descriptor using bag of visual words.
*/ */
class CV_EXPORTS BOWImgDescriptorExtractor class CV_EXPORTS_W BOWImgDescriptorExtractor
{ {
public: public:
BOWImgDescriptorExtractor( const Ptr<DescriptorExtractor>& dextractor, CV_WRAP BOWImgDescriptorExtractor( const Ptr<DescriptorExtractor>& dextractor,
const Ptr<DescriptorMatcher>& dmatcher ); const Ptr<DescriptorMatcher>& dmatcher );
virtual ~BOWImgDescriptorExtractor(); virtual ~BOWImgDescriptorExtractor();
void setVocabulary( const Mat& vocabulary ); CV_WRAP void setVocabulary( const Mat& vocabulary );
const Mat& getVocabulary() const; CV_WRAP const Mat& getVocabulary() const;
void compute( const Mat& image, vector<KeyPoint>& keypoints, Mat& imgDescriptor, void compute( const Mat& image, vector<KeyPoint>& keypoints, Mat& imgDescriptor,
vector<vector<int> >* pointIdxsOfClusters=0, Mat* descriptors=0 ); vector<vector<int> >* pointIdxsOfClusters=0, Mat* descriptors=0 );
// compute() is not constant because DescriptorMatcher::match is not constant // compute() is not constant because DescriptorMatcher::match is not constant
int descriptorSize() const; CV_WRAP_AS(compute) void compute2( const Mat& image, vector<KeyPoint>& keypoints, Mat& imgDescriptor )
int descriptorType() const; { compute(image,keypoints,imgDescriptor); }
CV_WRAP int descriptorSize() const;
CV_WRAP int descriptorType() const;
protected: protected:
Mat vocabulary; Mat vocabulary;
......
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