Commit d822989c authored by Leonid Beynenson's avatar Leonid Beynenson

Added template method cv::Algorithm::set(const char* _name, const Ptr<_Tp>& value),

which allows to pass as the second parameter of the method set any cv::Ptr<_Tp> object.
parent 00b02f9f
......@@ -4323,6 +4323,7 @@ public:
CV_WRAP_AS(setMat) void set(const string& name, const Mat& value);
CV_WRAP_AS(setMatVector) void set(const string& name, const vector<Mat>& value);
CV_WRAP_AS(setAlgorithm) void set(const string& name, const Ptr<Algorithm>& value);
template<typename _Tp> void set(const string& name, const Ptr<_Tp>& value);
void set(const char* name, int value);
void set(const char* name, double value);
......@@ -4331,6 +4332,7 @@ public:
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);
template<typename _Tp> void set(const char* name, const Ptr<_Tp>& value);
CV_WRAP string paramHelp(const string& name) const;
int paramType(const char* name) const;
......
......@@ -3842,6 +3842,22 @@ template<typename _Tp> inline Ptr<_Tp> Algorithm::create(const string& name)
return _create(name).ptr<_Tp>();
}
template<typename _Tp>
void Algorithm::set(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>
void Algorithm::set(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
{
typename ParamType<_Tp>::member_type value;
......
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