1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Python: wrap Algorithm::read and Algorithm::write

This commit is contained in:
Pavel Rojtberg
2017-07-27 14:34:32 +02:00
parent f071a48ec7
commit 6fbf0758bc
3 changed files with 31 additions and 4 deletions
+7 -2
View File
@@ -3093,13 +3093,18 @@ public:
*/
virtual void write(FileStorage& fs) const { (void)fs; }
/** @brief simplified API for language bindings
* @overload
*/
CV_WRAP void write(const Ptr<FileStorage>& fs, const String& name = String()) const;
/** @brief Reads algorithm parameters from a file storage
*/
virtual void read(const FileNode& fn) { (void)fn; }
CV_WRAP virtual void read(const FileNode& fn) { (void)fn; }
/** @brief Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
*/
virtual bool empty() const { return false; }
CV_WRAP virtual bool empty() const { return false; }
/** @brief Reads algorithm from the file node
+13
View File
@@ -55,6 +55,19 @@ Algorithm::~Algorithm()
CV_TRACE_FUNCTION();
}
void Algorithm::write(const Ptr<FileStorage>& fs, const String& name) const
{
CV_TRACE_FUNCTION();
if(name.empty())
{
write(*fs);
return;
}
*fs << name << "{";
write(*fs);
*fs << "}";
}
void Algorithm::save(const String& filename) const
{
CV_TRACE_FUNCTION();