parent
4c74b28ee3
commit
a51a8ad577
@ -616,7 +616,7 @@ void FlannBasedMatcher::read( const FileNode& fn)
|
|||||||
indexParams->setBool(name, (int) ip[i]["value"]);
|
indexParams->setBool(name, (int) ip[i]["value"]);
|
||||||
break;
|
break;
|
||||||
case CV_MAKETYPE(CV_USRTYPE1,3):
|
case CV_MAKETYPE(CV_USRTYPE1,3):
|
||||||
indexParams->setAlgorithm(name, (int) ip[i]["value"]);
|
indexParams->setAlgorithm((int) ip[i]["value"]);
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -655,7 +655,7 @@ void FlannBasedMatcher::read( const FileNode& fn)
|
|||||||
searchParams->setBool(name, (int) ip[i]["value"]);
|
searchParams->setBool(name, (int) ip[i]["value"]);
|
||||||
break;
|
break;
|
||||||
case CV_MAKETYPE(CV_USRTYPE1,3):
|
case CV_MAKETYPE(CV_USRTYPE1,3):
|
||||||
searchParams->setAlgorithm(name, (int) ip[i]["value"]);
|
searchParams->setAlgorithm((int) ip[i]["value"]);
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -53,8 +53,8 @@ namespace cv
|
|||||||
|
|
||||||
namespace flann
|
namespace flann
|
||||||
{
|
{
|
||||||
using namespace cvflann;
|
|
||||||
|
|
||||||
|
using namespace cvflann;
|
||||||
|
|
||||||
struct CV_EXPORTS IndexParams
|
struct CV_EXPORTS IndexParams
|
||||||
{
|
{
|
||||||
@ -70,7 +70,7 @@ struct CV_EXPORTS IndexParams
|
|||||||
void setDouble(const std::string& key, double value);
|
void setDouble(const std::string& key, double value);
|
||||||
void setFloat(const std::string& key, float value);
|
void setFloat(const std::string& key, float value);
|
||||||
void setBool(const std::string& key, bool value);
|
void setBool(const std::string& key, bool value);
|
||||||
void setAlgorithm(const std::string& key, int value);
|
void setAlgorithm(int value);
|
||||||
|
|
||||||
void getAll(std::vector<std::string>& names,
|
void getAll(std::vector<std::string>& names,
|
||||||
std::vector<int>& types,
|
std::vector<int>& types,
|
||||||
|
@ -81,9 +81,9 @@ void IndexParams::setBool(const std::string& key, bool value)
|
|||||||
setParam(*this, key, value);
|
setParam(*this, key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IndexParams::setAlgorithm(const std::string& key, int value)
|
void IndexParams::setAlgorithm(int value)
|
||||||
{
|
{
|
||||||
setParam(*this, key, (cvflann::flann_algorithm_t)value);
|
setParam(*this, "algorithm", (cvflann::flann_algorithm_t)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IndexParams::getAll(std::vector<std::string>& names,
|
void IndexParams::getAll(std::vector<std::string>& names,
|
||||||
@ -293,7 +293,10 @@ template<typename Distance, typename IndexType> void
|
|||||||
buildIndex_(void*& index, const Mat& data, const IndexParams& params, const Distance& dist = Distance())
|
buildIndex_(void*& index, const Mat& data, const IndexParams& params, const Distance& dist = Distance())
|
||||||
{
|
{
|
||||||
typedef typename Distance::ElementType ElementType;
|
typedef typename Distance::ElementType ElementType;
|
||||||
CV_Assert(DataType<ElementType>::type == data.type() && data.isContinuous());
|
if(DataType<ElementType>::type != data.type())
|
||||||
|
CV_Error_(CV_StsUnsupportedFormat, ("type=%d\n", data.type()));
|
||||||
|
if(!data.isContinuous())
|
||||||
|
CV_Error(CV_StsBadArg, "Only continuous arrays are supported");
|
||||||
|
|
||||||
::cvflann::Matrix<ElementType> dataset((ElementType*)data.data, data.rows, data.cols);
|
::cvflann::Matrix<ElementType> dataset((ElementType*)data.data, data.rows, data.cols);
|
||||||
IndexType* _index = new IndexType(dataset, get_params(params), dist);
|
IndexType* _index = new IndexType(dataset, get_params(params), dist);
|
||||||
|
@ -286,8 +286,9 @@ namespace cv
|
|||||||
|
|
||||||
///////////////////////////// Object Detection ////////////////////////////
|
///////////////////////////// Object Detection ////////////////////////////
|
||||||
|
|
||||||
CV_EXPORTS_W void groupRectangles(CV_IN_OUT vector<Rect>& rectList, int groupThreshold, double eps=0.2);
|
CV_EXPORTS void groupRectangles(CV_OUT CV_IN_OUT vector<Rect>& rectList, int groupThreshold, double eps=0.2);
|
||||||
CV_EXPORTS_W void groupRectangles(CV_IN_OUT vector<Rect>& rectList, CV_OUT vector<int>& weights, int groupThreshold, double eps=0.2);
|
CV_EXPORTS_W void groupRectangles(CV_OUT CV_IN_OUT vector<Rect>& rectList, CV_OUT vector<int>& weights, int groupThreshold, double eps=0.2);
|
||||||
|
CV_EXPORTS void groupRectangles( vector<Rect>& rectList, int groupThreshold, double eps, vector<int>* weights, vector<double>* levelWeights );
|
||||||
CV_EXPORTS void groupRectangles(vector<Rect>& rectList, vector<int>& rejectLevels,
|
CV_EXPORTS void groupRectangles(vector<Rect>& rectList, vector<int>& rejectLevels,
|
||||||
vector<double>& levelWeights, int groupThreshold, double eps=0.2);
|
vector<double>& levelWeights, int groupThreshold, double eps=0.2);
|
||||||
CV_EXPORTS void groupRectangles_meanshift(vector<Rect>& rectList, vector<double>& foundWeights, vector<double>& foundScales,
|
CV_EXPORTS void groupRectangles_meanshift(vector<Rect>& rectList, vector<double>& foundWeights, vector<double>& foundScales,
|
||||||
@ -430,7 +431,6 @@ protected:
|
|||||||
Ptr<CvHaarClassifierCascade> oldCascade;
|
Ptr<CvHaarClassifierCascade> oldCascade;
|
||||||
};
|
};
|
||||||
|
|
||||||
void CV_EXPORTS_W groupRectangles( vector<Rect>& rectList, int groupThreshold, double eps, vector<int>* weights, vector<double>* levelWeights );
|
|
||||||
|
|
||||||
//////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector //////////////
|
//////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector //////////////
|
||||||
|
|
||||||
@ -473,7 +473,7 @@ public:
|
|||||||
CV_WRAP bool checkDetectorSize() const;
|
CV_WRAP bool checkDetectorSize() const;
|
||||||
CV_WRAP double getWinSigma() const;
|
CV_WRAP double getWinSigma() const;
|
||||||
|
|
||||||
CV_WRAP virtual void setSVMDetector(const vector<float>& _svmdetector);
|
CV_WRAP virtual void setSVMDetector(InputArray _svmdetector);
|
||||||
|
|
||||||
virtual bool read(FileNode& fn);
|
virtual bool read(FileNode& fn);
|
||||||
virtual void write(FileStorage& fs, const String& objname) const;
|
virtual void write(FileStorage& fs, const String& objname) const;
|
||||||
|
@ -83,9 +83,9 @@ bool HOGDescriptor::checkDetectorSize() const
|
|||||||
detectorSize == descriptorSize + 1;
|
detectorSize == descriptorSize + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HOGDescriptor::setSVMDetector(const vector<float>& _svmDetector)
|
void HOGDescriptor::setSVMDetector(InputArray _svmDetector)
|
||||||
{
|
{
|
||||||
svmDetector = _svmDetector;
|
_svmDetector.getMat().convertTo(svmDetector, CV_32F);
|
||||||
CV_Assert( checkDetectorSize() );
|
CV_Assert( checkDetectorSize() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -762,11 +762,25 @@ static bool pyopencv_to(PyObject *o, cv::flann::IndexParams& p, const char *name
|
|||||||
break;
|
break;
|
||||||
std::string k = PyString_AsString(key);
|
std::string k = PyString_AsString(key);
|
||||||
if( PyString_Check(item) )
|
if( PyString_Check(item) )
|
||||||
p.setString(k, PyString_AsString(item));
|
{
|
||||||
|
const char* value = PyString_AsString(item);
|
||||||
|
p.setString(k, value);
|
||||||
|
}
|
||||||
|
else if( PyBool_Check(item) )
|
||||||
|
p.setBool(k, item == Py_True);
|
||||||
else if( PyInt_Check(item) )
|
else if( PyInt_Check(item) )
|
||||||
p.setInt(k, PyInt_AsLong(item));
|
{
|
||||||
|
int value = (int)PyInt_AsLong(item);
|
||||||
|
if( strcmp(k.c_str(), "algorithm") == 0 )
|
||||||
|
p.setAlgorithm(value);
|
||||||
|
else
|
||||||
|
p.setInt(k, value);
|
||||||
|
}
|
||||||
else if( PyFloat_Check(item) )
|
else if( PyFloat_Check(item) )
|
||||||
p.setDouble(k, PyFloat_AsDouble(item));
|
{
|
||||||
|
double value = PyFloat_AsDouble(item);
|
||||||
|
p.setDouble(k, value);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -780,7 +794,7 @@ static bool pyopencv_to(PyObject *o, cv::flann::IndexParams& p, const char *name
|
|||||||
|
|
||||||
static bool pyopencv_to(PyObject *o, cvflann::flann_distance_t& dist, const char *name="<unknown>")
|
static bool pyopencv_to(PyObject *o, cvflann::flann_distance_t& dist, const char *name="<unknown>")
|
||||||
{
|
{
|
||||||
int d = 0;
|
int d = (int)dist;
|
||||||
bool ok = pyopencv_to(o, d, name);
|
bool ok = pyopencv_to(o, d, name);
|
||||||
dist = (cvflann::flann_distance_t)d;
|
dist = (cvflann::flann_distance_t)d;
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -357,9 +357,9 @@ class FuncVariant(object):
|
|||||||
continue
|
continue
|
||||||
if a.returnarg:
|
if a.returnarg:
|
||||||
outlist.append((a.name, argno))
|
outlist.append((a.name, argno))
|
||||||
if not a.inputarg or a.returnarg:
|
if (not a.inputarg or a.returnarg) and a.isbig():
|
||||||
if a.isbig():
|
|
||||||
outarr_list.append((a.name, argno))
|
outarr_list.append((a.name, argno))
|
||||||
|
if not a.inputarg:
|
||||||
continue
|
continue
|
||||||
if not a.defval:
|
if not a.defval:
|
||||||
arglist.append((a.name, argno))
|
arglist.append((a.name, argno))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user