Wraped SimpleBlobDetector for Python

This commit is contained in:
Ilya Lysenkov 2012-03-12 11:39:48 +00:00
parent 3df41c1d62
commit df6a95ed87
2 changed files with 34 additions and 19 deletions

View File

@ -1552,38 +1552,38 @@ private:
mutable ORB orb_;
};
class CV_EXPORTS SimpleBlobDetector : public cv::FeatureDetector
class CV_EXPORTS_W SimpleBlobDetector : public FeatureDetector
{
public:
struct CV_EXPORTS Params
struct CV_EXPORTS_W_SIMPLE Params
{
Params();
float thresholdStep;
float minThreshold;
float maxThreshold;
size_t minRepeatability;
float minDistBetweenBlobs;
CV_WRAP Params();
CV_PROP_RW float thresholdStep;
CV_PROP_RW float minThreshold;
CV_PROP_RW float maxThreshold;
CV_PROP_RW size_t minRepeatability;
CV_PROP_RW float minDistBetweenBlobs;
bool filterByColor;
uchar blobColor;
CV_PROP_RW bool filterByColor;
CV_PROP_RW uchar blobColor;
bool filterByArea;
float minArea, maxArea;
CV_PROP_RW bool filterByArea;
CV_PROP_RW float minArea, maxArea;
bool filterByCircularity;
float minCircularity, maxCircularity;
CV_PROP_RW bool filterByCircularity;
CV_PROP_RW float minCircularity, maxCircularity;
bool filterByInertia;
float minInertiaRatio, maxInertiaRatio;
CV_PROP_RW bool filterByInertia;
CV_PROP_RW float minInertiaRatio, maxInertiaRatio;
bool filterByConvexity;
float minConvexity, maxConvexity;
CV_PROP_RW bool filterByConvexity;
CV_PROP_RW float minConvexity, maxConvexity;
void read( const FileNode& fn );
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 write( FileStorage& fs ) const;

View File

@ -87,6 +87,8 @@ typedef Ptr<FeatureDetector> Ptr_FeatureDetector;
typedef Ptr<DescriptorExtractor> Ptr_DescriptorExtractor;
typedef Ptr<DescriptorMatcher> Ptr_DescriptorMatcher;
typedef SimpleBlobDetector::Params SimpleBlobDetector_Params;
typedef cvflann::flann_distance_t cvflann_flann_distance_t;
typedef cvflann::flann_algorithm_t cvflann_flann_algorithm_t;
typedef Ptr<flann::IndexParams> Ptr_flann_IndexParams;
@ -357,6 +359,19 @@ static bool pyopencv_to(PyObject* obj, int& value, const char* name = "<unknown>
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)
{
return PyFloat_FromDouble(value);