Skip to content

FileNode

Core and matricesclassOpenCV 5.0.0
import { FileNode } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSConstructor or factory
CLASSFileNode
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

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;
Returns

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;
Returns

The this result.

getNode

Returns element of a mapping node or a sequence node.

getNode(nodename: EmbindString): FileNode;
nodename

Name of an element in the mapping node.

Returns

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;
i

Index of an element in the sequence node.

Returns

Returns the element with the given identifier.

keys

Returns keys of a mapping node.

keys(): StringVector;
Returns

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;
Returns

Type of the node. See FileNode::Type

empty

returns true if the node is empty

empty(): boolean;
Returns

The boolean result.

isNone

returns true if the node is a "none" object

isNone(): boolean;
Returns

The boolean result.

isSeq

returns true if the node is a sequence

isSeq(): boolean;
Returns

The boolean result.

isMap

returns true if the node is a mapping

isMap(): boolean;
Returns

The boolean result.

isInt

returns true if the node is an integer

isInt(): boolean;
Returns

The boolean result.

isReal

returns true if the node is a floating-point number

isReal(): boolean;
Returns

The boolean result.

isString

returns true if the node is a text string

isString(): boolean;
Returns

The boolean result.

isNamed

returns true if the node has a name

isNamed(): boolean;
Returns

The boolean result.

name

returns the node name or an empty string if the node is nameless

name(): string;
Returns

The string result.

size

returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise.

size(): number;
Returns

The number result.

rawSize

returns raw size of the FileNode in bytes

rawSize(): number;
Returns

The number result.

real

Simplified reading API to use with bindings.

real(): number;
Returns

The number result.

string

Simplified reading API to use with bindings.

string(): string;
Returns

The string result.

mat

Simplified reading API to use with bindings.

mat(): Mat;
Returns

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.