This commit is contained in:
Vadim Pisarevsky
2011-08-14 19:46:39 +00:00
parent 4c74b28ee3
commit a51a8ad577
7 changed files with 38 additions and 21 deletions

View File

@@ -762,11 +762,25 @@ static bool pyopencv_to(PyObject *o, cv::flann::IndexParams& p, const char *name
break;
std::string k = PyString_AsString(key);
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) )
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) )
p.setDouble(k, PyFloat_AsDouble(item));
{
double value = PyFloat_AsDouble(item);
p.setDouble(k, value);
}
else
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>")
{
int d = 0;
int d = (int)dist;
bool ok = pyopencv_to(o, d, name);
dist = (cvflann::flann_distance_t)d;
return ok;

View File

@@ -357,9 +357,9 @@ class FuncVariant(object):
continue
if a.returnarg:
outlist.append((a.name, argno))
if not a.inputarg or a.returnarg:
if a.isbig():
outarr_list.append((a.name, argno))
if (not a.inputarg or a.returnarg) and a.isbig():
outarr_list.append((a.name, argno))
if not a.inputarg:
continue
if not a.defval:
arglist.append((a.name, argno))