Table of Contents

Class FileStorage

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

XML/YAML File Storage Class.

public class FileStorage : CvObject, IDisposable
Inheritance
FileStorage
Implements
Inherited Members

Constructors

FileStorage()

Default constructor. You should call FileStorage::open() after initialization.

FileStorage(string, Modes, string?)

The full constructor

Properties

ElName

the currently written element

this[string]

Returns the specified element of the top-level mapping, or null if the key is not present (or is explicitly stored as a "none" value).

State

the writer state

Methods

Add(DMatch)

Writes data to a file storage.

Add(KeyPoint)

Writes data to a file storage.

Add(Mat)

Writes data to a file storage.

Add(Point)

/Writes data to a file storage.

Add(Point2d)

Writes data to a file storage.

Add(Point2f)

Writes data to a file storage.

Add(Point3d)

Writes data to a file storage.

Add(Point3f)

Writes data to a file storage.

Add(Point3i)

Writes data to a file storage.

Add(Range)

Writes data to a file storage.

Add(Rect)

Writes data to a file storage.

Add(Rect2d)

Writes data to a file storage.

Add(Rect2f)

Writes data to a file storage.

Add(Scalar)

Writes data to a file storage.

Add(Size)

Writes data to a file storage.

Add(Size2d)

Writes data to a file storage.

Add(Size2f)

Writes data to a file storage.

Add(SparseMat)

Writes data to a file storage.

Add(Vec2b)

Writes data to a file storage.

Add(Vec2d)

Writes data to a file storage.

Add(Vec2f)

Writes data to a file storage.

Add(Vec2i)

Writes data to a file storage.

Add(Vec2s)

Writes data to a file storage.

Add(Vec2w)

Writes data to a file storage.

Add(Vec3b)

Writes data to a file storage.

Add(Vec3d)

Writes data to a file storage.

Add(Vec3f)

Writes data to a file storage.

Add(Vec3i)

Writes data to a file storage.

Add(Vec3s)

Writes data to a file storage.

Add(Vec3w)

Writes data to a file storage.

Add(Vec4b)

Writes data to a file storage.

Add(Vec4d)

Writes data to a file storage.

Add(Vec4f)

Writes data to a file storage.

Add(Vec4i)

Writes data to a file storage.

Add(Vec4s)

Writes data to a file storage.

Add(Vec4w)

Writes data to a file storage.

Add(Vec6b)

Writes data to a file storage.

Add(Vec6d)

Writes data to a file storage.

Add(Vec6f)

Writes data to a file storage.

Add(Vec6i)

Writes data to a file storage.

Add(Vec6s)

Writes data to a file storage.

Add(Vec6w)

Writes data to a file storage.

Add(IEnumerable<DMatch>)

Writes data to a file storage.

Add(IEnumerable<KeyPoint>)

Writes data to a file storage.

Add(double)

Writes data to a file storage.

Add(int)

Writes data to a file storage.

Add(float)

Writes data to a file storage.

Add(string)

Writes data to a file storage.

EndWriteStruct()
GetDefaultObjectName(string)

Returns the normalized object name for the specified file name

GetFirstTopLevelNode()

Returns the first element of the top-level mapping

GetFormat()

Returns the current format (one of the Modes.Format* flags).

GetPath(object[])

Navigates a chain of mapping keys (string) and/or sequence indices (int) starting from the top-level mapping, disposing every intermediate FileNode along the way. Equivalent to repeated indexer chaining (e.g. fs["a"][2]["b"]), except that the indexer chain leaves every intermediate node unreferenced - each one is still a real native allocation that would otherwise sit around until the GC finalizes it.

IsOpened()

Returns true if the object is associated with currently opened file.

Open(string, Modes, string?)

operator that performs PCA. The previously stored data, if any, is released

Release()

Closes the file and releases all the memory buffers

ReleaseAndGetString()

Closes the file, releases all the memory buffers and returns the text string

Root(int)

Returns the top-level mapping. YAML supports multiple streams

StartWriteStruct(string, Types, string?)

Starts to write a nested structure (sequence or a mapping).

Write(string, Mat)
Write(string, SparseMat)
Write(string, bool)
Write(string, IEnumerable<DMatch>)
Write(string, IEnumerable<KeyPoint>)
Write(string, IEnumerable<string>)
Write(string, double)
Write(string, int)
Write(string, long)
Write(string, float)
Write(string, string)
Write(string, JsonNode?)

Writes a JsonNode tree (scalars, arrays, objects) under the given key, recursively, via the ordinary Write(string, int)/WriteStruct(string, Types, string?) calls - the counterpart to ToJsonNode(). Native FileStorage remains the actual XML/YAML/JSON engine; this only lets callers build the data to write using System.Text.Json types instead of one-call-per-value/struct-scope calls.

WriteComment(string, bool)

Writes a comment. The function writes a comment into file storage. The comments are skipped when the storage is read.

WriteRaw(string, ReadOnlySpan<byte>)

Writes one or more numbers of the specified format to the currently written structure

WriteScalar(double)
WriteScalar(int)
WriteScalar(float)
WriteScalar(string)
WriteStruct(string, Types, string?)

Starts writing a nested structure (sequence or mapping) and returns a disposable scope that calls EndWriteStruct() automatically, so the structure can be written inside a using block instead of manually pairing StartWriteStruct(string, Types, string?)/EndWriteStruct() calls.