Commit df6a95ed authored by Ilya Lysenkov's avatar Ilya Lysenkov

Wraped SimpleBlobDetector for Python

parent 3df41c1d
...@@ -1552,38 +1552,38 @@ private: ...@@ -1552,38 +1552,38 @@ private:
mutable ORB orb_; mutable ORB orb_;
}; };
class CV_EXPORTS SimpleBlobDetector : public cv::FeatureDetector class CV_EXPORTS_W SimpleBlobDetector : public FeatureDetector
{ {
public: public:
struct CV_EXPORTS Params struct CV_EXPORTS_W_SIMPLE Params
{ {
Params(); CV_WRAP Params();
float thresholdStep; CV_PROP_RW float thresholdStep;
float minThreshold; CV_PROP_RW float minThreshold;
float maxThreshold; CV_PROP_RW float maxThreshold;
size_t minRepeatability; CV_PROP_RW size_t minRepeatability;
float minDistBetweenBlobs; CV_PROP_RW float minDistBetweenBlobs;
bool filterByColor; CV_PROP_RW bool filterByColor;
uchar blobColor; CV_PROP_RW uchar blobColor;
bool filterByArea; CV_PROP_RW bool filterByArea;
float minArea, maxArea; CV_PROP_RW float minArea, maxArea;
bool filterByCircularity; CV_PROP_RW bool filterByCircularity;
float minCircularity, maxCircularity; CV_PROP_RW float minCircularity, maxCircularity;
bool filterByInertia; CV_PROP_RW bool filterByInertia;
float minInertiaRatio, maxInertiaRatio; CV_PROP_RW float minInertiaRatio, maxInertiaRatio;
bool filterByConvexity; CV_PROP_RW bool filterByConvexity;
float minConvexity, maxConvexity; CV_PROP_RW float minConvexity, maxConvexity;
void read( const FileNode& fn ); void read( const FileNode& fn );
void write( FileStorage& fs ) const; void write( FileStorage& fs ) const;
}; };
SimpleBlobDetector(const SimpleBlobDetector::Params &parameters = SimpleBlobDetector::Params()); CV_WRAP SimpleBlobDetector(const SimpleBlobDetector::Params &parameters = SimpleBlobDetector::Params());
virtual void read( const FileNode& fn ); virtual void read( const FileNode& fn );
virtual void write( FileStorage& fs ) const; virtual void write( FileStorage& fs ) const;
......
...@@ -87,6 +87,8 @@ typedef Ptr<FeatureDetector> Ptr_FeatureDetector; ...@@ -87,6 +87,8 @@ typedef Ptr<FeatureDetector> Ptr_FeatureDetector;
typedef Ptr<DescriptorExtractor> Ptr_DescriptorExtractor; typedef Ptr<DescriptorExtractor> Ptr_DescriptorExtractor;
typedef Ptr<DescriptorMatcher> Ptr_DescriptorMatcher; typedef Ptr<DescriptorMatcher> Ptr_DescriptorMatcher;
typedef SimpleBlobDetector::Params SimpleBlobDetector_Params;
typedef cvflann::flann_distance_t cvflann_flann_distance_t; typedef cvflann::flann_distance_t cvflann_flann_distance_t;
typedef cvflann::flann_algorithm_t cvflann_flann_algorithm_t; typedef cvflann::flann_algorithm_t cvflann_flann_algorithm_t;
typedef Ptr<flann::IndexParams> Ptr_flann_IndexParams; typedef Ptr<flann::IndexParams> Ptr_flann_IndexParams;
...@@ -357,6 +359,19 @@ static bool pyopencv_to(PyObject* obj, int& value, const char* name = "<unknown> ...@@ -357,6 +359,19 @@ static bool pyopencv_to(PyObject* obj, int& value, const char* name = "<unknown>
return value != -1 || !PyErr_Occurred(); return value != -1 || !PyErr_Occurred();
} }
static PyObject* pyopencv_from(uchar value)
{
return PyInt_FromLong(value);
}
static bool pyopencv_to(PyObject* obj, uchar& value, const char* name = "<unknown>")
{
if(!obj || obj == Py_None)
return true;
value = (int)PyInt_AsLong(obj);
return value != -1 || !PyErr_Occurred();
}
static PyObject* pyopencv_from(double value) static PyObject* pyopencv_from(double value)
{ {
return PyFloat_FromDouble(value); return PyFloat_FromDouble(value);
......
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