Commit 42414b56 authored by Andrey Kamaev's avatar Andrey Kamaev

Merge pull request #92 from LeonidBeynenson/cv_algorithm_changes_2.4

parents 12747068 d6aa3bd8
...@@ -4341,15 +4341,24 @@ public: ...@@ -4341,15 +4341,24 @@ public:
CV_WRAP vector<Mat> getMatVector(const string& name) const; CV_WRAP vector<Mat> getMatVector(const string& name) const;
CV_WRAP Ptr<Algorithm> getAlgorithm(const string& name) const; CV_WRAP Ptr<Algorithm> getAlgorithm(const string& name) const;
CV_WRAP_AS(setInt) void set(const string& name, int value); void set(const string& name, int value);
CV_WRAP_AS(setDouble) void set(const string& name, double value); void set(const string& name, double value);
CV_WRAP_AS(setBool) void set(const string& name, bool value); void set(const string& name, bool value);
CV_WRAP_AS(setString) void set(const string& name, const string& value); void set(const string& name, const string& value);
CV_WRAP_AS(setMat) void set(const string& name, const Mat& value); void set(const string& name, const Mat& value);
CV_WRAP_AS(setMatVector) void set(const string& name, const vector<Mat>& value); void set(const string& name, const vector<Mat>& value);
CV_WRAP_AS(setAlgorithm) void set(const string& name, const Ptr<Algorithm>& value); void set(const string& name, const Ptr<Algorithm>& value);
template<typename _Tp> void set(const string& name, const Ptr<_Tp>& value); template<typename _Tp> void set(const string& name, const Ptr<_Tp>& value);
CV_WRAP void setInt(const string& name, int value);
CV_WRAP void setDouble(const string& name, double value);
CV_WRAP void setBool(const string& name, bool value);
CV_WRAP void setString(const string& name, const string& value);
CV_WRAP void setMat(const string& name, const Mat& value);
CV_WRAP void setMatVector(const string& name, const vector<Mat>& value);
CV_WRAP void setAlgorithm(const string& name, const Ptr<Algorithm>& value);
template<typename _Tp> void setAlgorithm(const string& name, const Ptr<_Tp>& value);
void set(const char* name, int value); void set(const char* name, int value);
void set(const char* name, double value); void set(const char* name, double value);
void set(const char* name, bool value); void set(const char* name, bool value);
...@@ -4359,6 +4368,15 @@ public: ...@@ -4359,6 +4368,15 @@ public:
void set(const char* name, const Ptr<Algorithm>& value); void set(const char* name, const Ptr<Algorithm>& value);
template<typename _Tp> void set(const char* name, const Ptr<_Tp>& value); template<typename _Tp> void set(const char* name, const Ptr<_Tp>& value);
void setInt(const char* name, int value);
void setDouble(const char* name, double value);
void setBool(const char* name, bool value);
void setString(const char* name, const string& value);
void setMat(const char* name, const Mat& value);
void setMatVector(const char* name, const vector<Mat>& value);
void setAlgorithm(const char* name, const Ptr<Algorithm>& value);
template<typename _Tp> void setAlgorithm(const char* name, const Ptr<_Tp>& value);
CV_WRAP string paramHelp(const string& name) const; CV_WRAP string paramHelp(const string& name) const;
int paramType(const char* name) const; int paramType(const char* name) const;
CV_WRAP int paramType(const string& name) const; CV_WRAP int paramType(const string& name) const;
......
...@@ -263,20 +263,20 @@ namespace cv ...@@ -263,20 +263,20 @@ namespace cv
} //namespace cv } //namespace cv
#define CV_INIT_ALGORITHM(classname, algname, memberinit) \ #define CV_INIT_ALGORITHM(classname, algname, memberinit) \
static Algorithm* create##classname() \ static ::cv::Algorithm* create##classname() \
{ \ { \
return new classname; \ return new classname; \
} \ } \
\ \
static AlgorithmInfo& classname##_info() \ static ::cv::AlgorithmInfo& classname##_info() \
{ \ { \
static AlgorithmInfo classname##_info_var(algname, create##classname); \ static ::cv::AlgorithmInfo classname##_info_var(algname, create##classname); \
return classname##_info_var; \ return classname##_info_var; \
} \ } \
\ \
static AlgorithmInfo& classname##_info_auto = classname##_info(); \ static ::cv::AlgorithmInfo& classname##_info_auto = classname##_info(); \
\ \
AlgorithmInfo* classname::info() const \ ::cv::AlgorithmInfo* classname::info() const \
{ \ { \
static volatile bool initialized = false; \ static volatile bool initialized = false; \
\ \
......
...@@ -3921,6 +3921,22 @@ inline void Algorithm::set(const string& _name, const Ptr<_Tp>& value) ...@@ -3921,6 +3921,22 @@ inline void Algorithm::set(const string& _name, const Ptr<_Tp>& value)
this->set<_Tp>(_name.c_str(), value); this->set<_Tp>(_name.c_str(), value);
} }
template<typename _Tp>
inline void Algorithm::setAlgorithm(const char* _name, const Ptr<_Tp>& value)
{
Ptr<Algorithm> algo_ptr = value. template ptr<cv::Algorithm>();
if (algo_ptr.empty()) {
CV_Error( CV_StsUnsupportedFormat, "unknown/unsupported Ptr type of the second parameter of the method Algorithm::set");
}
info()->set(this, _name, ParamType<Algorithm>::type, &algo_ptr);
}
template<typename _Tp>
inline void Algorithm::setAlgorithm(const string& _name, const Ptr<_Tp>& value)
{
this->set<_Tp>(_name.c_str(), value);
}
template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::get(const string& _name) const template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::get(const string& _name) const
{ {
typename ParamType<_Tp>::member_type value; typename ParamType<_Tp>::member_type value;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment