diff --git a/modules/core/include/opencv2/core/core.hpp b/modules/core/include/opencv2/core/core.hpp index b33fdea2a8..ba9da11bae 100644 --- a/modules/core/include/opencv2/core/core.hpp +++ b/modules/core/include/opencv2/core/core.hpp @@ -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& value); CV_WRAP_AS(setAlgorithm) void set(const string& name, const Ptr& value); + template 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& value); void set(const char* name, const Ptr& value); + template void set(const char* name, const Ptr<_Tp>& value); CV_WRAP string paramHelp(const string& name) const; int paramType(const char* name) const; diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp index c7bc94ca1a..1f81848904 100644 --- a/modules/core/include/opencv2/core/operations.hpp +++ b/modules/core/include/opencv2/core/operations.hpp @@ -3842,6 +3842,22 @@ template inline Ptr<_Tp> Algorithm::create(const string& name) return _create(name).ptr<_Tp>(); } +template +void Algorithm::set(const char* _name, const Ptr<_Tp>& value) +{ + Ptr algo_ptr = value. template ptr(); + 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::type, &algo_ptr); +} +template +void Algorithm::set(const string& _name, const Ptr<_Tp>& value) +{ + this->set<_Tp>(_name.c_str(), value); +} + + template inline typename ParamType<_Tp>::member_type Algorithm::get(const string& _name) const { typename ParamType<_Tp>::member_type value;