From 6e3700593f46549206e52fa0659774c92e42ab13 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 9 Dec 2022 21:05:17 +0000 Subject: [PATCH] compatibility: keep Ptr stubs till OpenCV 5.0 --- modules/core/include/opencv2/core.hpp | 4 ++++ modules/core/src/algorithm.cpp | 8 ++++++++ modules/features2d/include/opencv2/features2d.hpp | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/modules/core/include/opencv2/core.hpp b/modules/core/include/opencv2/core.hpp index 1223651..0445be1 100644 --- a/modules/core/include/opencv2/core.hpp +++ b/modules/core/include/opencv2/core.hpp @@ -3101,6 +3101,10 @@ public: * @overload */ CV_WRAP void write(FileStorage& fs, const String& name) const; +#if CV_VERSION_MAJOR < 5 + /** @deprecated */ + void write(const Ptr& fs, const String& name = String()) const; +#endif /** @brief Reads algorithm parameters from a file storage */ diff --git a/modules/core/src/algorithm.cpp b/modules/core/src/algorithm.cpp index 7186585..798df39 100644 --- a/modules/core/src/algorithm.cpp +++ b/modules/core/src/algorithm.cpp @@ -68,6 +68,14 @@ void Algorithm::write(FileStorage& fs, const String& name) const fs << "}"; } +#if CV_VERSION_MAJOR < 5 +void Algorithm::write(const Ptr& fs, const String& name) const +{ + CV_Assert(fs); + write(*fs, name); +} +#endif + void Algorithm::save(const String& filename) const { CV_TRACE_FUNCTION(); diff --git a/modules/features2d/include/opencv2/features2d.hpp b/modules/features2d/include/opencv2/features2d.hpp index 633cd5c..401fe61 100644 --- a/modules/features2d/include/opencv2/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d.hpp @@ -213,6 +213,9 @@ public: // see corresponding cv::Algorithm method CV_WRAP inline void write(FileStorage& fs, const String& name) const { Algorithm::write(fs, name); } +#if CV_VERSION_MAJOR < 5 + inline void write(const Ptr& fs, const String& name) const { CV_Assert(fs); Algorithm::write(*fs, name); } +#endif }; /** Feature detectors in OpenCV have wrappers with a common interface that enables you to easily switch @@ -1102,6 +1105,9 @@ public: // see corresponding cv::Algorithm method CV_WRAP inline void write(FileStorage& fs, const String& name) const { Algorithm::write(fs, name); } +#if CV_VERSION_MAJOR < 5 + inline void write(const Ptr& fs, const String& name) const { CV_Assert(fs); Algorithm::write(*fs, name); } +#endif protected: /** -- 2.7.4