FileNode
import { FileNode } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods.
File Storage Node class.
The node is used to store each and every element of the file storage opened for reading. When XML/YAML file is read, it is first parsed and stored in the memory as a hierarchical collection of nodes. Each node can be a "leaf" that is contain a single number or a string, or be a collection of other nodes. There can be named collections (mappings) where each element has a name and it is accessed by a name, and ordered collections (sequences) where elements do not have names but rather accessed by index. Type of the file node can be determined using FileNode::type method.
Note that file nodes are only used for navigating file storages opened for reading. When a file storage is opened for writing, no data is stored in memory after it is written.
Constructors and members
static new
The constructors.
These constructors are used to create a default file node, construct it from obsolete structures or
from the another file node.
new(): FileNode;The FileNode result.
clone
Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.
clone(): this;The this result.
getNode
Returns element of a mapping node or a sequence node.
getNode(nodename: EmbindString): FileNode;nodenameName of an element in the mapping node.
Returns the element with the given identifier.
at
Read a sequence element by zero-based index and return its file-node view.
at(i: number): FileNode;iIndex of an element in the sequence node.
Returns the element with the given identifier.
keys
Returns keys of a mapping node.
keys(): StringVector;Keys of a mapping node. Release returned native handles with using or delete(), including handles nested in results.
type
Returns type of the node.
type(): number;Type of the node. See FileNode::Type
empty
returns true if the node is empty
empty(): boolean;The boolean result.
isNone
returns true if the node is a "none" object
isNone(): boolean;The boolean result.
isSeq
returns true if the node is a sequence
isSeq(): boolean;The boolean result.
isMap
returns true if the node is a mapping
isMap(): boolean;The boolean result.
isInt
returns true if the node is an integer
isInt(): boolean;The boolean result.
isReal
returns true if the node is a floating-point number
isReal(): boolean;The boolean result.
isString
returns true if the node is a text string
isString(): boolean;The boolean result.
isNamed
returns true if the node has a name
isNamed(): boolean;The boolean result.
name
returns the node name or an empty string if the node is nameless
name(): string;The string result.
size
returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise.
size(): number;The number result.
rawSize
returns raw size of the FileNode in bytes
rawSize(): number;The number result.
real
Simplified reading API to use with bindings.
real(): number;The number result.
string
Simplified reading API to use with bindings.
string(): string;The string result.
mat
Simplified reading API to use with bindings.
mat(): Mat;The Mat result. Release returned native handles with using or delete(), including handles nested in results.
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.