OpenCV453
|
#include <persistence.hpp>
公開型 | |
enum | { NONE = 0 , INT = 1 , REAL = 2 , FLOAT = REAL , STR = 3 , STRING = STR , SEQ = 4 , MAP = 5 , TYPE_MASK = 7 , FLOW = 8 , UNIFORM = 8 , EMPTY = 16 , NAMED = 32 } |
type of the file storage node [詳解] | |
公開メンバ関数 | |
CV_WRAP | FileNode () |
The constructors. [詳解] | |
FileNode (const FileStorage *fs, size_t blockIdx, size_t ofs) | |
FileNode (const FileNode &node) | |
FileNode & | operator= (const FileNode &node) |
FileNode | operator[] (const String &nodename) const |
Returns element of a mapping node or a sequence node. [詳解] | |
CV_WRAP_AS (getNode) FileNode operator[](const char *nodename) const | |
CV_WRAP_AS (at) FileNode operator[](int i) const | |
CV_WRAP std::vector< String > | keys () const |
Returns keys of a mapping node. [詳解] | |
CV_WRAP int | type () const |
Returns type of the node. [詳解] | |
CV_WRAP bool | empty () const |
returns true if the node is empty | |
CV_WRAP bool | isNone () const |
returns true if the node is a "none" object | |
CV_WRAP bool | isSeq () const |
returns true if the node is a sequence | |
CV_WRAP bool | isMap () const |
returns true if the node is a mapping | |
CV_WRAP bool | isInt () const |
returns true if the node is an integer | |
CV_WRAP bool | isReal () const |
returns true if the node is a floating-point number | |
CV_WRAP bool | isString () const |
returns true if the node is a text string | |
CV_WRAP bool | isNamed () const |
returns true if the node has a name | |
CV_WRAP std::string | name () const |
returns the node name or an empty string if the node is nameless | |
CV_WRAP size_t | size () const |
returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise. | |
CV_WRAP size_t | rawSize () const |
returns raw size of the FileNode in bytes | |
operator int () const | |
returns the node content as an integer. If the node stores floating-point number, it is rounded. | |
operator float () const | |
returns the node content as float | |
operator double () const | |
returns the node content as double | |
operator std::string () const | |
returns the node content as text string | |
uchar * | ptr () |
const uchar * | ptr () const |
FileNodeIterator | begin () const |
returns iterator pointing to the first node element | |
FileNodeIterator | end () const |
returns iterator pointing to the element following the last node element | |
void | readRaw (const String &fmt, void *vec, size_t len) const |
Reads node elements to the buffer with the specified format. [詳解] | |
void | setValue (int type, const void *value, int len=-1) |
CV_WRAP double | real () const |
Simplified reading API to use with bindings. | |
CV_WRAP std::string | string () const |
Simplified reading API to use with bindings. | |
CV_WRAP Mat | mat () const |
Simplified reading API to use with bindings. | |
FileNode (FileStorage::Impl *fs, size_t blockIdx, size_t ofs) | |
静的公開メンバ関数 | |
static bool | isMap (int flags) |
static bool | isSeq (int flags) |
static bool | isCollection (int flags) |
static bool | isEmptyCollection (int flags) |
static bool | isFlow (int flags) |
公開変数類 | |
FileStorage::Impl * | fs |
size_t | blockIdx |
size_t | ofs |
関連関数 | |
(これらはメソッドではありません) | |
CV_EXPORTS void | read (const FileNode &node, int &value, int default_value) |
CV_EXPORTS void | read (const FileNode &node, float &value, float default_value) |
CV_EXPORTS void | read (const FileNode &node, double &value, double default_value) |
CV_EXPORTS void | read (const FileNode &node, std::string &value, const std::string &default_value) |
CV_EXPORTS void | read (const FileNode &node, Mat &mat, const Mat &default_mat=Mat()) |
CV_EXPORTS void | read (const FileNode &node, SparseMat &mat, const SparseMat &default_mat=SparseMat()) |
CV_EXPORTS void | read (const FileNode &node, std::vector< KeyPoint > &keypoints) |
CV_EXPORTS void | read (const FileNode &node, std::vector< DMatch > &matches) |
CV_EXPORTS void | read (const FileNode &node, KeyPoint &value, const KeyPoint &default_value) |
CV_EXPORTS void | read (const FileNode &node, DMatch &value, const DMatch &default_value) |
template<typename _Tp > | |
static void | read (const FileNode &node, Point_< _Tp > &value, const Point_< _Tp > &default_value) |
template<typename _Tp > | |
static void | read (const FileNode &node, Point3_< _Tp > &value, const Point3_< _Tp > &default_value) |
template<typename _Tp > | |
static void | read (const FileNode &node, Size_< _Tp > &value, const Size_< _Tp > &default_value) |
template<typename _Tp > | |
static void | read (const FileNode &node, Complex< _Tp > &value, const Complex< _Tp > &default_value) |
template<typename _Tp > | |
static void | read (const FileNode &node, Rect_< _Tp > &value, const Rect_< _Tp > &default_value) |
template<typename _Tp , int cn> | |
static void | read (const FileNode &node, Vec< _Tp, cn > &value, const Vec< _Tp, cn > &default_value) |
template<typename _Tp , int m, int n> | |
static void | read (const FileNode &node, Matx< _Tp, m, n > &value, const Matx< _Tp, m, n > &default_matx=Matx< _Tp, m, n >()) |
template<typename _Tp > | |
static void | read (const FileNode &node, Scalar_< _Tp > &value, const Scalar_< _Tp > &default_value) |
static void | read (const FileNode &node, Range &value, const Range &default_value) |
static void | read (const FileNode &node, bool &value, bool default_value) |
static void | read (const FileNode &node, uchar &value, uchar default_value) |
static void | read (const FileNode &node, schar &value, schar default_value) |
static void | read (const FileNode &node, ushort &value, ushort default_value) |
static void | read (const FileNode &node, short &value, short default_value) |
template<typename _Tp > | |
static void | read (FileNodeIterator &it, std::vector< _Tp > &vec, size_t maxCount=(size_t) INT_MAX) |
template<typename _Tp , typename std::enable_if< std::is_enum< _Tp >::value >::type * = nullptr> | |
static void | read (const FileNode &node, _Tp &value, const _Tp &default_value=static_cast< _Tp >(0)) |
template<typename _Tp > | |
static void | read (const FileNode &node, std::vector< _Tp > &vec, const std::vector< _Tp > &default_value=std::vector< _Tp >()) |
static void | read (const FileNode &node, std::vector< KeyPoint > &vec, const std::vector< KeyPoint > &default_value) |
static void | read (const FileNode &node, std::vector< DMatch > &vec, const std::vector< DMatch > &default_value) |
template<typename _Tp > | |
static void | operator>> (const FileNode &n, _Tp &value) |
Reads data from a file storage. | |
template<typename _Tp > | |
static void | operator>> (const FileNode &n, std::vector< _Tp > &vec) |
Reads data from a file storage. | |
static void | operator>> (const FileNode &n, KeyPoint &kpt) |
Reads KeyPoint from a file storage. | |
static void | operator>> (const FileNode &n, std::vector< KeyPoint > &vec) |
static void | operator>> (const FileNode &n, std::vector< DMatch > &vec) |
static void | operator>> (const FileNode &n, DMatch &m) |
Reads DMatch from a file storage. | |
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.
anonymous enum |
type of the file storage node
列挙値 | |
---|---|
NONE | empty node |
INT | an integer |
REAL | floating-point number |
FLOAT | synonym or REAL |
STR | text string in UTF-8 encoding |
STRING | synonym for STR |
SEQ | sequence |
MAP | mapping |
FLOW | compact representation of a sequence or mapping. Used only by YAML writer |
UNIFORM | UNIFORM is used only when reading FileStorage; FLOW is used only when writing. So they share the same bit if set, means that all the collection elements are numbers of the same type (real's or int's). |
EMPTY | empty structure (sequence or mapping) |
NAMED | the node has a name (i.e. it is element of a mapping). |
CV_WRAP cv::FileNode::FileNode | ( | ) |
The constructors.
These constructors are used to create a default file node, construct it from obsolete structures or from the another file node.
cv::FileNode::FileNode | ( | const FileStorage * | fs, |
size_t | blockIdx, | ||
size_t | ofs | ||
) |
これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。
fs | Pointer to the file storage structure. |
blockIdx | Index of the memory block where the file node is stored |
ofs | Offset in bytes from the beginning of the serialized storage |
cv::FileNode::FileNode | ( | const FileNode & | node | ) |
これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。
node | File node to be used as initialization for the created file node. |
cv::FileNode::CV_WRAP_AS | ( | at | ) | const |
これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。
i | Index of an element in the sequence node. |
cv::FileNode::CV_WRAP_AS | ( | getNode | ) | const |
これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。
nodename | Name of an element in the mapping node. |
CV_WRAP std::vector< String > cv::FileNode::keys | ( | ) | const |
Returns keys of a mapping node.
FileNode cv::FileNode::operator[] | ( | const String & | nodename | ) | const |
Returns element of a mapping node or a sequence node.
nodename | Name of an element in the mapping node. |
void cv::FileNode::readRaw | ( | const String & | fmt, |
void * | vec, | ||
size_t | len | ||
) | const |
Reads node elements to the buffer with the specified format.
Usually it is more convenient to use operator >>
instead of this method.
fmt | Specification of each array element. See format specification |
vec | Pointer to the destination array. |
len | Number of bytes to read (buffer size limit). If it is greater than number of remaining elements then all of them will be read. |
void cv::FileNode::setValue | ( | int | type, |
const void * | value, | ||
int | len = -1 |
||
) |
Internal method used when reading FileStorage. Sets the type (int, real or string) and value of the previously created node.
CV_WRAP int cv::FileNode::type | ( | ) | const |
Returns type of the node.