added Algorithm::get/set/addParam(vector<Mat>) (to be used by EM)

This commit is contained in:
Vadim Pisarevsky
2012-04-02 17:19:57 +00:00
parent 6fdf7b4d62
commit ff071d2cf6
4 changed files with 92 additions and 4 deletions

View File

@@ -4273,6 +4273,7 @@ public:
void set(const string& name, bool value);
void set(const string& name, const string& value);
void set(const string& name, const Mat& value);
void set(const string& name, const vector<Mat>& value);
void set(const string& name, const Ptr<Algorithm>& value);
void set(const char* name, int value);
@@ -4280,6 +4281,7 @@ public:
void set(const char* name, bool value);
void set(const char* name, const string& value);
void set(const char* name, const Mat& value);
void set(const char* name, const vector<Mat>& value);
void set(const char* name, const Ptr<Algorithm>& value);
string paramHelp(const string& name) const;
@@ -4347,6 +4349,11 @@ public:
Mat (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Mat&)=0,
const string& help=string());
void addParam(Algorithm& algo, const char* name,
vector<Mat>& value, bool readOnly=false,
vector<Mat> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const vector<Mat>&)=0,
const string& help=string());
void addParam(Algorithm& algo, const char* name,
Ptr<Algorithm>& value, bool readOnly=false,
Ptr<Algorithm> (Algorithm::*getter)()=0,
@@ -4359,7 +4366,7 @@ protected:
struct CV_EXPORTS Param
{
enum { INT=0, BOOLEAN=1, REAL=2, STRING=3, MAT=4, ALGORITHM=5 };
enum { INT=0, BOOLEAN=1, REAL=2, STRING=3, MAT=4, MAT_VECTOR=5, ALGORITHM=6 };
Param();
Param(int _type, bool _readonly, int _offset,
@@ -4414,6 +4421,14 @@ template<> struct ParamType<Mat>
enum { type = Param::MAT };
};
template<> struct ParamType<vector<Mat> >
{
typedef const vector<Mat>& const_param_type;
typedef vector<Mat> member_type;
enum { type = Param::MAT_VECTOR };
};
template<> struct ParamType<Algorithm>
{
typedef const Ptr<Algorithm>& const_param_type;

View File

@@ -2856,7 +2856,8 @@ operator << ( FileStorage& fs, const vector<_Tp>& vec )
CV_EXPORTS_W void write( FileStorage& fs, const string& name, const Mat& value );
CV_EXPORTS void write( FileStorage& fs, const string& name, const SparseMat& value );
CV_EXPORTS void write( FileStorage& fs, const string& name, const vector<Mat>& value );
template<typename _Tp> static inline FileStorage& operator << (FileStorage& fs, const _Tp& value)
{
if( !fs.isOpened() )
@@ -2956,7 +2957,8 @@ static inline void read(const FileNode& node, string& value, const string& defau
}
CV_EXPORTS_W void read(const FileNode& node, Mat& mat, const Mat& default_mat=Mat() );
CV_EXPORTS void read(const FileNode& node, SparseMat& mat, const SparseMat& default_mat=SparseMat() );
CV_EXPORTS void read(const FileNode& node, SparseMat& mat, const SparseMat& default_mat=SparseMat() );
CV_EXPORTS void read(const FileNode& node, vector<Mat>& mat, const vector<Mat>& default_mat_vector=vector<Mat>() );
inline FileNode::operator int() const
{