Class FileStorage
XML/YAML File Storage Class.
Inheritance
System.Object
FileStorage
Assembly: OpenCvSharp.dll
Syntax
public class FileStorage : DisposableCvObject, ICvPtrHolder
Constructors
|
Improve this Doc
View Source
FileStorage()
Default constructor.
You should call FileStorage::open() after initialization.
Declaration
|
Improve this Doc
View Source
FileStorage(String, FileStorage.Modes, String)
Declaration
public FileStorage(string source, FileStorage.Modes flags, string encoding = null)
Parameters
Type |
Name |
Description |
System.String |
source |
Name of the file to open or the text string to read the data from.
Extension of the file (.xml or .yml/.yaml) determines its format
(XML or YAML respectively). Also you can append .gz to work with
compressed files, for example myHugeMatrix.xml.gz.
If both FileStorage::WRITE and FileStorage::MEMORY flags are specified,
source is used just to specify the output file format
(e.g. mydata.xml, .yml etc.).
|
FileStorage.Modes |
flags |
|
System.String |
encoding |
Encoding of the file. Note that UTF-16 XML encoding is not supported
currently and you should use 8-bit encoding instead of it.
|
Properties
|
Improve this Doc
View Source
ElName
the currently written element
Declaration
public string ElName { get; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Item[String]
Returns the specified element of the top-level mapping
Declaration
public FileNode this[string nodeName] { get; }
Parameters
Type |
Name |
Description |
System.String |
nodeName |
|
Property Value
|
Improve this Doc
View Source
State
Declaration
public FileStorage.States State { get; }
Property Value
Methods
|
Improve this Doc
View Source
Add(IEnumerable<DMatch>)
Writes data to a file storage.
Declaration
public FileStorage Add(IEnumerable<DMatch> val)
Parameters
Type |
Name |
Description |
IEnumerable<OpenCvSharp.DMatch> |
val |
|
Returns
|
Improve this Doc
View Source
Add(IEnumerable<KeyPoint>)
Writes data to a file storage.
Declaration
public FileStorage Add(IEnumerable<KeyPoint> val)
Parameters
Type |
Name |
Description |
IEnumerable<OpenCvSharp.KeyPoint> |
val |
|
Returns
|
Improve this Doc
View Source
Add(DMatch)
Writes data to a file storage.
Declaration
public FileStorage Add(DMatch val)
Parameters
Type |
Name |
Description |
OpenCvSharp.DMatch |
val |
|
Returns
|
Improve this Doc
View Source
Add(KeyPoint)
Writes data to a file storage.
Declaration
public FileStorage Add(KeyPoint val)
Parameters
Type |
Name |
Description |
OpenCvSharp.KeyPoint |
val |
|
Returns
|
Improve this Doc
View Source
Add(Mat)
Writes data to a file storage.
Declaration
public FileStorage Add(Mat val)
Parameters
Type |
Name |
Description |
Mat |
val |
|
Returns
|
Improve this Doc
View Source
Add(Point)
/Writes data to a file storage.
Declaration
public FileStorage Add(Point val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Point |
val |
|
Returns
|
Improve this Doc
View Source
Add(Point2d)
Writes data to a file storage.
Declaration
public FileStorage Add(Point2d val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Point2d |
val |
|
Returns
|
Improve this Doc
View Source
Add(Point2f)
Writes data to a file storage.
Declaration
public FileStorage Add(Point2f val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Point2f |
val |
|
Returns
|
Improve this Doc
View Source
Add(Point3d)
Writes data to a file storage.
Declaration
public FileStorage Add(Point3d val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Point3d |
val |
|
Returns
|
Improve this Doc
View Source
Add(Point3f)
Writes data to a file storage.
Declaration
public FileStorage Add(Point3f val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Point3f |
val |
|
Returns
|
Improve this Doc
View Source
Add(Point3i)
Writes data to a file storage.
Declaration
public FileStorage Add(Point3i val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Point3i |
val |
|
Returns
|
Improve this Doc
View Source
Add(Range)
Writes data to a file storage.
Declaration
public FileStorage Add(Range val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Range |
val |
|
Returns
|
Improve this Doc
View Source
Add(Rect)
Writes data to a file storage.
Declaration
public FileStorage Add(Rect val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Rect |
val |
|
Returns
|
Improve this Doc
View Source
Add(Rect2d)
Writes data to a file storage.
Declaration
public FileStorage Add(Rect2d val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Rect2d |
val |
|
Returns
|
Improve this Doc
View Source
Add(Rect2f)
Writes data to a file storage.
Declaration
public FileStorage Add(Rect2f val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Rect2f |
val |
|
Returns
|
Improve this Doc
View Source
Add(Scalar)
Writes data to a file storage.
Declaration
public FileStorage Add(Scalar val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Scalar |
val |
|
Returns
|
Improve this Doc
View Source
Add(Size)
Writes data to a file storage.
Declaration
public FileStorage Add(Size val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Size |
val |
|
Returns
|
Improve this Doc
View Source
Add(Size2d)
Writes data to a file storage.
Declaration
public FileStorage Add(Size2d val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Size2d |
val |
|
Returns
|
Improve this Doc
View Source
Add(Size2f)
Writes data to a file storage.
Declaration
public FileStorage Add(Size2f val)
Parameters
Type |
Name |
Description |
OpenCvSharp.Size2f |
val |
|
Returns
|
Improve this Doc
View Source
Add(SparseMat)
Writes data to a file storage.
Declaration
public FileStorage Add(SparseMat val)
Parameters
Returns
|
Improve this Doc
View Source
Add(Vec2b)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec2b val)
Parameters
Type |
Name |
Description |
Vec2b |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec2d)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec2d val)
Parameters
Type |
Name |
Description |
Vec2d |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec2f)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec2f val)
Parameters
Type |
Name |
Description |
Vec2f |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec2i)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec2i val)
Parameters
Type |
Name |
Description |
Vec2i |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec2s)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec2s val)
Parameters
Type |
Name |
Description |
Vec2s |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec2w)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec2w val)
Parameters
Type |
Name |
Description |
Vec2w |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec3b)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec3b val)
Parameters
Type |
Name |
Description |
Vec3b |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec3d)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec3d val)
Parameters
Type |
Name |
Description |
Vec3d |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec3f)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec3f val)
Parameters
Type |
Name |
Description |
Vec3f |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec3i)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec3i val)
Parameters
Type |
Name |
Description |
Vec3i |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec3s)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec3s val)
Parameters
Type |
Name |
Description |
Vec3s |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec3w)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec3w val)
Parameters
Type |
Name |
Description |
Vec3w |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec4b)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec4b val)
Parameters
Type |
Name |
Description |
Vec4b |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec4d)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec4d val)
Parameters
Type |
Name |
Description |
Vec4d |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec4f)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec4f val)
Parameters
Type |
Name |
Description |
Vec4f |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec4i)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec4i val)
Parameters
Type |
Name |
Description |
Vec4i |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec4s)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec4s val)
Parameters
Type |
Name |
Description |
Vec4s |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec4w)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec4w val)
Parameters
Type |
Name |
Description |
Vec4w |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec6b)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec6b val)
Parameters
Type |
Name |
Description |
Vec6b |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec6d)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec6d val)
Parameters
Type |
Name |
Description |
Vec6d |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec6f)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec6f val)
Parameters
Type |
Name |
Description |
Vec6f |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec6i)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec6i val)
Parameters
Type |
Name |
Description |
Vec6i |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec6s)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec6s val)
Parameters
Type |
Name |
Description |
Vec6s |
val |
|
Returns
|
Improve this Doc
View Source
Add(Vec6w)
Writes data to a file storage.
Declaration
public FileStorage Add(Vec6w val)
Parameters
Type |
Name |
Description |
Vec6w |
val |
|
Returns
|
Improve this Doc
View Source
Add(Double)
Writes data to a file storage.
Declaration
public FileStorage Add(double val)
Parameters
Type |
Name |
Description |
System.Double |
val |
|
Returns
|
Improve this Doc
View Source
Add(Int32)
Writes data to a file storage.
Declaration
public FileStorage Add(int val)
Parameters
Type |
Name |
Description |
System.Int32 |
val |
|
Returns
|
Improve this Doc
View Source
Add(Single)
Writes data to a file storage.
Declaration
public FileStorage Add(float val)
Parameters
Type |
Name |
Description |
System.Single |
val |
|
Returns
|
Improve this Doc
View Source
Add(String)
Writes data to a file storage.
Declaration
public FileStorage Add(string val)
Parameters
Type |
Name |
Description |
System.String |
val |
|
Returns
|
Improve this Doc
View Source
DisposeUnmanaged()
Releases unmanaged resources
Declaration
protected override void DisposeUnmanaged()
Overrides
|
Improve this Doc
View Source
EndWriteStruct()
Declaration
public void EndWriteStruct()
|
Improve this Doc
View Source
GetDefaultObjectName(String)
Returns the normalized object name for the specified file name
Declaration
public static string GetDefaultObjectName(string fileName)
Parameters
Type |
Name |
Description |
System.String |
fileName |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
GetFirstTopLevelNode()
Returns the first element of the top-level mapping
Declaration
public FileNode GetFirstTopLevelNode()
Returns
Type |
Description |
FileNode |
The first element of the top-level mapping.
|
|
Improve this Doc
View Source
IsOpened()
Returns true if the object is associated with currently opened file.
Declaration
public virtual bool IsOpened()
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Open(String, FileStorage.Modes, String)
operator that performs PCA. The previously stored data, if any, is released
Declaration
public virtual bool Open(string fileName, FileStorage.Modes flags, string encoding = null)
Parameters
Type |
Name |
Description |
System.String |
fileName |
Name of the file to open or the text string to read the data from.
Extension of the file (.xml, .yml/.yaml or .json) determines its format (XML, YAML or JSON respectively).
Also you can append .gz to work with compressed files, for example myHugeMatrix.xml.gz.
If both FileStorage::WRITE and FileStorage::MEMORY flags are specified, source is used just to specify the output file format (e.g. mydata.xml, .yml etc.).
A file name can also contain parameters. You can use this format, "*?base64" (e.g. "file.json?base64" (case sensitive)),
as an alternative to FileStorage::BASE64 flag.
|
FileStorage.Modes |
flags |
Mode of operation.
|
System.String |
encoding |
Encoding of the file. Note that UTF-16 XML encoding is not supported
currently and you should use 8-bit encoding instead of it.
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Release()
Closes the file and releases all the memory buffers
Declaration
public virtual void Release()
|
Improve this Doc
View Source
ReleaseAndGetString()
Closes the file, releases all the memory buffers and returns the text string
Declaration
public string ReleaseAndGetString()
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Root(Int32)
Returns the top-level mapping. YAML supports multiple streams
Declaration
public FileNode Root(int streamIdx = 0)
Parameters
Type |
Name |
Description |
System.Int32 |
streamIdx |
Zero-based index of the stream. In most cases there is only one stream in the file.
However, YAML supports multiple streams and so there can be several.
|
Returns
Type |
Description |
FileNode |
The top-level mapping.
|
|
Improve this Doc
View Source
StartWriteStruct(String, Int32, String)
Declaration
public void StartWriteStruct(string name, int flags, string typeName)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Int32 |
flags |
|
System.String |
typeName |
|
|
Improve this Doc
View Source
Write(String, IEnumerable<DMatch>)
Declaration
public void Write(string name, IEnumerable<DMatch> value)
Parameters
Type |
Name |
Description |
System.String |
name |
|
IEnumerable<OpenCvSharp.DMatch> |
value |
|
|
Improve this Doc
View Source
Write(String, IEnumerable<KeyPoint>)
Declaration
public void Write(string name, IEnumerable<KeyPoint> value)
Parameters
Type |
Name |
Description |
System.String |
name |
|
IEnumerable<OpenCvSharp.KeyPoint> |
value |
|
|
Improve this Doc
View Source
Write(String, Mat)
Declaration
public void Write(string name, Mat value)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Mat |
value |
|
|
Improve this Doc
View Source
Write(String, SparseMat)
Declaration
public void Write(string name, SparseMat value)
Parameters
Type |
Name |
Description |
System.String |
name |
|
SparseMat |
value |
|
|
Improve this Doc
View Source
Write(String, Double)
Declaration
public void Write(string name, double value)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Double |
value |
|
|
Improve this Doc
View Source
Write(String, Int32)
Declaration
public void Write(string name, int value)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Int32 |
value |
|
|
Improve this Doc
View Source
Write(String, Single)
Declaration
public void Write(string name, float value)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Single |
value |
|
|
Improve this Doc
View Source
Write(String, String)
Declaration
public void Write(string name, string value)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.String |
value |
|
|
Improve this Doc
View Source
Writes a comment.
The function writes a comment into file storage. The comments are skipped when the storage is read.
Declaration
public void WriteComment(string comment, bool append = false)
Parameters
Type |
Name |
Description |
System.String |
comment |
The written comment, single-line or multi-line
|
System.Boolean |
append |
If true, the function tries to put the comment at the end of current line.
Else if the comment is multi-line, or if it does not fit at the end of the current line, the comment starts a new line.
|
|
Improve this Doc
View Source
WriteRaw(String, IntPtr, Int32)
Writes one or more numbers of the specified format to the currently written structure
Declaration
public void WriteRaw(string fmt, IntPtr vec, int len)
Parameters
Type |
Name |
Description |
System.String |
fmt |
Specification of each array element, see @ref format_spec "format specification"
|
IntPtr |
vec |
Pointer to the written array.
|
System.Int32 |
len |
Number of the uchar elements to write.
|
|
Improve this Doc
View Source
WriteScalar(Double)
Declaration
public void WriteScalar(double value)
Parameters
Type |
Name |
Description |
System.Double |
value |
|
|
Improve this Doc
View Source
WriteScalar(Int32)
Declaration
public void WriteScalar(int value)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
|
|
Improve this Doc
View Source
WriteScalar(Single)
Declaration
public void WriteScalar(float value)
Parameters
Type |
Name |
Description |
System.Single |
value |
|
|
Improve this Doc
View Source
WriteScalar(String)
Declaration
public void WriteScalar(string value)
Parameters
Type |
Name |
Description |
System.String |
value |
|
Implements