@@ -53,8 +53,8 @@ namespace cv
|
||||
|
||||
namespace flann
|
||||
{
|
||||
using namespace cvflann;
|
||||
|
||||
using namespace cvflann;
|
||||
|
||||
struct CV_EXPORTS IndexParams
|
||||
{
|
||||
@@ -70,7 +70,7 @@ struct CV_EXPORTS IndexParams
|
||||
void setDouble(const std::string& key, double value);
|
||||
void setFloat(const std::string& key, float 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,
|
||||
std::vector<int>& types,
|
||||
|
@@ -81,9 +81,9 @@ void IndexParams::setBool(const std::string& key, bool 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,
|
||||
@@ -293,7 +293,10 @@ template<typename Distance, typename IndexType> void
|
||||
buildIndex_(void*& index, const Mat& data, const IndexParams& params, const Distance& dist = Distance())
|
||||
{
|
||||
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);
|
||||
IndexType* _index = new IndexType(dataset, get_params(params), dist);
|
||||
|
Reference in New Issue
Block a user