diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp index 58be977cae..f8aeddfb11 100644 --- a/modules/core/include/opencv2/core/operations.hpp +++ b/modules/core/include/opencv2/core/operations.hpp @@ -445,13 +445,13 @@ int print(const Matx<_Tp, m, n>& matx, FILE* stream = stdout) template inline Ptr<_Tp> Algorithm::create(const String& name) { - return _create(name).ptr<_Tp>(); + return _create(name).dynamicCast<_Tp>(); } template inline void Algorithm::set(const char* _name, const Ptr<_Tp>& value) { - Ptr algo_ptr = value. template ptr(); + Ptr algo_ptr = value. template dynamicCast(); if (!algo_ptr) { CV_Error( Error::StsUnsupportedFormat, "unknown/unsupported Ptr type of the second parameter of the method Algorithm::set"); }