Class FileNode
- Namespace
- OpenCvSharp
- Assembly
- OpenCvSharp.dll
File Storage Node class
public class FileNode : CvObject, IDisposable, IEnumerable<FileNode>, IEnumerable
- Inheritance
-
FileNode
- Implements
- Inherited Members
Constructors
FileNode()
The default constructor
public FileNode()
FileNode(nint)
Initializes from cv::FileNode*
public FileNode(nint ptr)
Parameters
ptrnint
Properties
Empty
Returns true if the node is empty
public bool Empty { get; }
Property Value
IsInt
Returns true if the node is an integer
public bool IsInt { get; }
Property Value
IsMap
Returns true if the node is a mapping
public bool IsMap { get; }
Property Value
IsNamed
Returns true if the node has a name
public bool IsNamed { get; }
Property Value
IsNone
Returns true if the node is a "none" object
public bool IsNone { get; }
Property Value
IsReal
Returns true if the node is a floating-point number
public bool IsReal { get; }
Property Value
IsSeq
Returns true if the node is a sequence
public bool IsSeq { get; }
Property Value
IsString
Returns true if the node is a text string
public bool IsString { get; }
Property Value
this[int]
Returns the element of a sequence node at the given index, or null if the index is out of range (or the element is explicitly stored as a "none" value).
public FileNode? this[int i] { get; }
Parameters
iint
Property Value
this[string]
Returns the element of a mapping node with the given key, or null if the key is not present (or is explicitly stored as a "none" value).
public FileNode? this[string nodeName] { get; }
Parameters
nodeNamestring
Property Value
Keys
Returns the keys of a mapping node.
public string[] Keys { get; }
Property Value
- string[]
Name
Returns the node name or an empty string if the node is nameless
public string Name { get; }
Property Value
RawSize
Returns the raw size of the node in bytes.
public long RawSize { get; }
Property Value
Size
Returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise.
public long Size { get; }
Property Value
Type
Returns type of the node.
public FileNode.Types Type { get; }
Property Value
Methods
Begin()
returns iterator pointing to the first node element
public FileNodeIterator Begin()
Returns
End()
returns iterator pointing to the element following the last node element
public FileNodeIterator End()
Returns
GetEnumerator()
Get FileNode iterator
public IEnumerator<FileNode> GetEnumerator()
Returns
GetPath(params object[])
Navigates a chain of mapping keys (string) and/or sequence indices
(int), disposing every intermediate FileNode along the way.
Equivalent to repeated indexer chaining (e.g. node["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.
public FileNode? GetPath(params object[] path)
Parameters
pathobject[]One or more mapping keys / sequence indices to follow, in order.
Returns
- FileNode
The node at the end of the path, or null if any segment along the way is missing.
ReadDMatch()
Reads the node element as DMatch
public DMatch ReadDMatch()
Returns
ReadDMatches()
Reads the node element as DMatch[]
public DMatch[] ReadDMatches()
Returns
- DMatch[]
ReadDouble(double)
Reads the node element as Double
public double ReadDouble(double defaultValue = 0)
Parameters
defaultValuedouble
Returns
ReadFloat(float)
Reads the node element as Single (float)
public float ReadFloat(float defaultValue = 0)
Parameters
defaultValuefloat
Returns
ReadInt(int)
Reads the node element as Int32 (int)
public int ReadInt(int defaultValue = 0)
Parameters
defaultValueint
Returns
ReadInt64(long)
Reads the node element as Int64 (long)
public long ReadInt64(long defaultValue = 0)
Parameters
defaultValuelong
Returns
ReadKeyPoint()
Reads the node element as KeyPoint
public KeyPoint ReadKeyPoint()
Returns
ReadKeyPoints()
Reads the node element as KeyPoint[]
public KeyPoint[] ReadKeyPoints()
Returns
- KeyPoint[]
ReadMat(Mat?)
Reads the node element as Mat
public Mat ReadMat(Mat? defaultMat = null)
Parameters
defaultMatMat
Returns
ReadPoint()
Reads the node element as Point
public Point ReadPoint()
Returns
ReadPoint2d()
Reads the node element as Point2d
public Point2d ReadPoint2d()
Returns
ReadPoint2f()
Reads the node element as Point2f
public Point2f ReadPoint2f()
Returns
ReadPoint3d()
Reads the node element as Point3d
public Point3d ReadPoint3d()
Returns
ReadPoint3f()
Reads the node element as Point3f
public Point3f ReadPoint3f()
Returns
ReadPoint3i()
Reads the node element as Point3i
public Point3i ReadPoint3i()
Returns
ReadRange()
Reads the node element as Range
public Range ReadRange()
Returns
ReadRaw(string, Span<byte>)
Reads node elements to the buffer with the specified format
public void ReadRaw(string fmt, Span<byte> vec)
Parameters
ReadRect()
Reads the node element as Rect
public Rect ReadRect()
Returns
ReadRect2d()
Reads the node element as Rect2d
public Rect2d ReadRect2d()
Returns
ReadRect2f()
Reads the node element as Rect2f
public Rect2f ReadRect2f()
Returns
ReadScalar()
Reads the node element as Scalar
public Scalar ReadScalar()
Returns
ReadSize()
Reads the node element as Size
public Size ReadSize()
Returns
ReadSize2d()
Reads the node element as Size2d
public Size2d ReadSize2d()
Returns
ReadSize2f()
Reads the node element as Size2f
public Size2f ReadSize2f()
Returns
ReadSparseMat(SparseMat?)
Reads the node element as SparseMat
public SparseMat ReadSparseMat(SparseMat? defaultMat = null)
Parameters
defaultMatSparseMat
Returns
ReadString(string?)
Reads the node element as String
public string ReadString(string? defaultValue = null)
Parameters
defaultValuestring
Returns
ReadVec2b()
Reads the node element as Vector
public Vec2b ReadVec2b()
Returns
ReadVec2d()
Reads the node element as Vector
public Vec2d ReadVec2d()
Returns
ReadVec2f()
Reads the node element as Vector
public Vec2f ReadVec2f()
Returns
ReadVec2i()
Reads the node element as Vector
public Vec2i ReadVec2i()
Returns
ReadVec2s()
Reads the node element as Vector
public Vec2s ReadVec2s()
Returns
ReadVec2w()
Reads the node element as Vector
public Vec2w ReadVec2w()
Returns
ReadVec3b()
public Vec3b ReadVec3b()
Returns
ReadVec3d()
Reads the node element as Vector
public Vec3d ReadVec3d()
Returns
ReadVec3f()
Reads the node element as Vector
public Vec3f ReadVec3f()
Returns
ReadVec3i()
Reads the node element as Vector
public Vec3i ReadVec3i()
Returns
ReadVec3s()
Reads the node element as Vector
public Vec3s ReadVec3s()
Returns
ReadVec3w()
Reads the node element as Vector
public Vec3w ReadVec3w()
Returns
ReadVec4b()
Reads the node element as Vector
public Vec4b ReadVec4b()
Returns
ReadVec4d()
Reads the node element as Vector
public Vec4d ReadVec4d()
Returns
ReadVec4f()
Reads the node element as Vector
public Vec4f ReadVec4f()
Returns
ReadVec4i()
Reads the node element as Vector
public Vec4i ReadVec4i()
Returns
ReadVec4s()
Reads the node element as Vector
public Vec4s ReadVec4s()
Returns
ReadVec4w()
Reads the node element as Vector
public Vec4w ReadVec4w()
Returns
ReadVec6b()
Reads the node element as Vector
public Vec6b ReadVec6b()
Returns
ReadVec6d()
Reads the node element as Vector
public Vec6d ReadVec6d()
Returns
ReadVec6f()
Reads the node element as Vector
public Vec6f ReadVec6f()
Returns
ReadVec6i()
Reads the node element as Vector
public Vec6i ReadVec6i()
Returns
ReadVec6s()
Reads the node element as Vector
public Vec6s ReadVec6s()
Returns
ReadVec6w()
Reads the node element as Vector
public Vec6w ReadVec6w()
Returns
ToDouble()
Returns the node content as double
public double ToDouble()
Returns
ToInt32()
Returns the node content as an integer. If the node stores floating-point number, it is rounded.
public int ToInt32()
Returns
ToInt64()
Returns the node content as a signed 64-bit integer. If the node stores a floating-point number, it is rounded.
public long ToInt64()
Returns
ToJsonNode()
Converts this node (and, recursively, its children) into a JsonNode tree,
regardless of whether the underlying FileStorage was opened as XML, YAML or
JSON. This is a generic structural conversion (scalars, sequences, mappings) - it does not
give special treatment to OpenCV-specific encodings such as Mat/KeyPoint/
DMatch, which come through as their raw mapping/sequence shape (e.g. a Mat becomes a
JSON object with "rows"/"cols"/"dt"/"data" members, not an Mat).
The result can be fed to JsonSerializer or queried directly.
public JsonNode? ToJsonNode()
Returns
ToMat()
Returns the node content as OpenCV Mat
public Mat ToMat()
Returns
ToSingle()
Returns the node content as System.Single
public float ToSingle()
Returns
ToString()
Returns the node content as text string
public override string ToString()
Returns
Operators
explicit operator Mat(FileNode)
Returns the node content as OpenCV Mat
public static explicit operator Mat(FileNode node)
Parameters
nodeFileNode
Returns
explicit operator double(FileNode)
Returns the node content as double
public static explicit operator double(FileNode node)
Parameters
nodeFileNode
Returns
explicit operator int(FileNode)
Returns the node content as an integer. If the node stores floating-point number, it is rounded.
public static explicit operator int(FileNode node)
Parameters
nodeFileNode
Returns
explicit operator long(FileNode)
Returns the node content as a signed 64-bit integer. If the node stores a floating-point number, it is rounded.
public static explicit operator long(FileNode node)
Parameters
nodeFileNode
Returns
explicit operator float(FileNode)
Returns the node content as float
public static explicit operator float(FileNode node)
Parameters
nodeFileNode
Returns
explicit operator string(FileNode)
Returns the node content as text string
public static explicit operator string(FileNode node)
Parameters
nodeFileNode