fixed Algorithm

pull/13383/head
Maria Dimashova 13 years ago
parent 64a5c0b1cf
commit 85364ac9b1
  1. 11
      modules/core/src/algorithm.cpp

@ -329,7 +329,7 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
{ {
const Param& p = data->params.vec[i].second; const Param& p = data->params.vec[i].second;
const string& pname = data->params.vec[i].first; const string& pname = data->params.vec[i].first;
FileNode n = fn[pname]; const FileNode n = fn[pname];
if( n.empty() ) if( n.empty() )
continue; continue;
if( p.type == Param::INT ) if( p.type == Param::INT )
@ -343,13 +343,13 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
else if( p.type == Param::MAT ) else if( p.type == Param::MAT )
{ {
Mat m; Mat m;
cv::read(fn, m); cv::read(n, m);
algo->set(pname, m); algo->set(pname, m);
} }
else if( p.type == Param::MAT_VECTOR ) else if( p.type == Param::MAT_VECTOR )
{ {
vector<Mat> mv; vector<Mat> mv;
cv::read(fn, mv); cv::read(n, mv);
algo->set(pname, mv); algo->set(pname, mv);
} }
else if( p.type == Param::ALGORITHM ) else if( p.type == Param::ALGORITHM )
@ -537,7 +537,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* name, int argType, vo
} }
else if( argType == Param::MAT_VECTOR ) else if( argType == Param::MAT_VECTOR )
{ {
CV_Assert( p->type == Param::MAT ); CV_Assert( p->type == Param::MAT_VECTOR );
*(vector<Mat>*)value = p->getter ? (algo->*f.get_mat_vector)() : *(vector<Mat>*)value = p->getter ? (algo->*f.get_mat_vector)() :
*(vector<Mat>*)((uchar*)algo + p->offset); *(vector<Mat>*)((uchar*)algo + p->offset);
@ -585,7 +585,8 @@ void AlgorithmInfo::addParam_(Algorithm& algo, const char* name, int argType,
{ {
CV_Assert( argType == Param::INT || argType == Param::BOOLEAN || CV_Assert( argType == Param::INT || argType == Param::BOOLEAN ||
argType == Param::REAL || argType == Param::STRING || argType == Param::REAL || argType == Param::STRING ||
argType == Param::MAT || argType == Param::ALGORITHM ); argType == Param::MAT || argType == Param::MAT_VECTOR ||
argType == Param::ALGORITHM );
data->params.add(string(name), Param(argType, readOnly, data->params.add(string(name), Param(argType, readOnly,
(int)((size_t)value - (size_t)(void*)&algo), (int)((size_t)value - (size_t)(void*)&algo),
getter, setter, help)); getter, setter, help));

Loading…
Cancel
Save