Class cv::hdf::HDF5#
Hierarchical Data Format version 5 interface. View details
#include <opencv2/hdf/hdf5.hpp>Collaboration diagram for cv::hdf::HDF5:
Public Types#
enum cv::hdf::HDF5 {
cv::hdf::H5_UNLIMITED = -1,
cv::hdf::H5_NONE = -1,
cv::hdf::H5_GETDIMS = 100,
cv::hdf::H5_GETMAXDIMS = 101,
cv::hdf::H5_GETCHUNKDIMS = 102
}Detailed Description#
Hierarchical Data Format version 5 interface.
Notice that this module is compiled only when hdf5 is correctly installed.
Member Enumeration Documentation#
enum HDF5
|
The dimension size is unlimited,. See also |
|
No compression,. See also |
|
Get the dimension information of a dataset. See also |
|
Get the maximum dimension information of a dataset. See also |
|
Get the chunk sizes of a dataset. See also |
Constructor & Destructor Documentation#
~HDF5()#
Member Function Documentation#
atdelete()#
void cv::hdf::HDF5::atdelete(const String & atlabel)
Python:
cv.hdf.HDF5.atdelete(atlabel)
Delete an attribute from the root group.
Note
CV_Error() is called if the given attribute does not exist. Use atexists() to check whether it exists or not beforehand.
Parameters
atlabel— the attribute to be deleted.
atexists()#
bool cv::hdf::HDF5::atexists(const String & atlabel)
Python:
cv.hdf.HDF5.atexists(atlabel) -> retval
Check whether a given attribute exits or not in the root group.
Parameters
atlabel— the attribute name to be checked.
Returns
true if the attribute exists, false otherwise.
atread()#
void cv::hdf::HDF5::atread(
double * value,
const String & atlabel )
Python:
cv.hdf.HDF5.atread(value, atlabel)
cv.hdf.HDF5.atread(atlabel[, value]) -> value
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
atread()#
void cv::hdf::HDF5::atread(
int * value,
const String & atlabel )
Python:
cv.hdf.HDF5.atread(value, atlabel)
cv.hdf.HDF5.atread(atlabel[, value]) -> value
Read an attribute from the root group.
The following example demonstrates how to read an attribute of type cv::String:
String expected_attr_str;
h5io->atread(&expected_attr_str, attr_str_name);
Note
The attribute MUST exist, otherwise CV_Error() is called. Use atexists() to check if it exists beforehand.
Parameters
value— address where the attribute is read intoatlabel— attribute name
atread()#
void cv::hdf::HDF5::atread(
OutputArray value,
const String & atlabel )
Python:
cv.hdf.HDF5.atread(value, atlabel)
cv.hdf.HDF5.atread(atlabel[, value]) -> value
Read an attribute from the root group.
Note
The attribute MUST exist, otherwise CV_Error() is called. Use atexists() to check if it exists beforehand.
Parameters
value— attribute value. Currently, only n-d continuous multi-channel arrays are supported.atlabel— attribute name.
atread()#
void cv::hdf::HDF5::atread(
String * value,
const String & atlabel )
Python:
cv.hdf.HDF5.atread(value, atlabel)
cv.hdf.HDF5.atread(atlabel[, value]) -> value
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
atwrite()#
void cv::hdf::HDF5::atwrite(
const double value,
const String & atlabel )
Python:
cv.hdf.HDF5.atwrite(value, atlabel)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
atwrite()#
void cv::hdf::HDF5::atwrite(
const int value,
const String & atlabel )
Python:
cv.hdf.HDF5.atwrite(value, atlabel)
Write an attribute inside the root group.
The following example demonstrates how to write an attribute of type cv::String:
Note
CV_Error() is called if the given attribute already exists. Use atexists() to check whether it exists or not beforehand. And use atdelete() to delete it if it already exists.
Parameters
value— attribute value.atlabel— attribute name.
atwrite()#
void cv::hdf::HDF5::atwrite(
const String & value,
const String & atlabel )
Python:
cv.hdf.HDF5.atwrite(value, atlabel)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
atwrite()#
void cv::hdf::HDF5::atwrite(
InputArray value,
const String & atlabel )
Python:
cv.hdf.HDF5.atwrite(value, atlabel)
Write an attribute into the root group.
Note
CV_Error() is called if the given attribute already exists. Use atexists() to check whether it exists or not beforehand. And use atdelete() to delete it if it already exists.
Parameters
value— attribute value. Currently, only n-d continuous multi-channel arrays are supported.atlabel— attribute name.
close()#
void cv::hdf::HDF5::close()
Python:
cv.hdf.HDF5.close()
Close and release hdf5 object.
dscreate()#
void cv::hdf::HDF5::dscreate(
const int n_dims,
const int * sizes,
const int type,
const String & dslabel )
Python:
dscreate()#
void cv::hdf::HDF5::dscreate(
const int n_dims,
const int * sizes,
const int type,
const String & dslabel,
const int compresslevel )
Python:
dscreate()#
void cv::hdf::HDF5::dscreate(
const int n_dims,
const int * sizes,
const int type,
const String & dslabel,
const int compresslevel,
const int * dims_chunks )
Python:
Create and allocate storage for n-dimensional dataset, single or multichannel type.
Note
If the dataset already exists, an exception will be thrown. Existence of the dataset can be checked using hlexists().
See example below that creates a 6 dimensional storage space:
Note
Activating compression requires internal chunking. Chunking can significantly improve access speed both at read and write time, especially for windowed access logic that shifts offset inside dataset. If no custom chunking is specified, the default one will be invoked by the size of whole dataset as single big chunk of data.
See example of level 0 compression (shallow) using chunking against the first dimension, thus storage will consists of 100 chunks of data:
Note
A value of H5_UNLIMITED inside the sizes array means unlimited data on that dimension, thus it is possible to expand anytime such dataset on those unlimited directions. Presence of H5_UNLIMITED on any dimension requires** to define custom chunking. No default chunking will be defined in unlimited scenario since the default size on that dimension will be zero, and will grow once dataset is written. Writing into dataset that has H5_UNLIMITED on some of its dimension requires dsinsert() instead of dswrite() that allows growth on unlimited dimension instead of dswrite() that allows to write only in predefined data space.
Example below shows a 3 dimensional dataset using no compression with all unlimited sizes and one unit chunking:
Parameters
n_dims— declare number of dimensionssizes— array containing sizes for each dimensionstype— type to be used, e.g., CV_8UC3, CV_32FC1, etc.dslabel— specify the hdf5 dataset label. Existing dataset label will cause an error.compresslevel— specify the compression level 0-9 to be used, H5_NONE is the default value and means no compression. The value 0 also means no compression. A value 9 indicating the best compression ration. Note that a higher compression level indicates a higher computational cost. It relies on GNU gzip for compression.dims_chunks— each array member specifies chunking sizes to be used for block I/O, by default NULL means none at all.
dscreate()#
void cv::hdf::HDF5::dscreate(
const int rows,
const int cols,
const int type,
const String & dslabel )
Python:
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
dscreate()#
void cv::hdf::HDF5::dscreate(
const int rows,
const int cols,
const int type,
const String & dslabel,
const int compresslevel )
Python:
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
dscreate()#
void cv::hdf::HDF5::dscreate(
const int rows,
const int cols,
const int type,
const String & dslabel,
const int compresslevel,
const int * dims_chunks )
Python:
Create and allocate storage for two dimensional single or multi channel dataset.
Note
If the dataset already exists, an exception will be thrown (CV_Error() is called).
Existence of the dataset can be checked using hlexists(), see in this example:
Note
Activating compression requires internal chunking. Chunking can significantly improve access speed both at read and write time, especially for windowed access logic that shifts offset inside dataset. If no custom chunking is specified, the default one will be invoked by the size of the whole dataset as a single big chunk of data.
See example of level 9 compression using internal default chunking:
Note
A value of H5_UNLIMITED for rows or cols or both means unlimited data on the specified dimension, thus, it is possible to expand anytime such a dataset on row, col or on both directions. Presence of H5_UNLIMITED on any dimension requires to define custom chunking. No default chunking will be defined in the unlimited scenario since default size on that dimension will be zero, and will grow once dataset is written. Writing into a dataset that has H5_UNLIMITED on some of its dimensions requires dsinsert() that allows growth on unlimited dimensions, instead of dswrite() that allows to write only in predefined data space.
Example below shows no compression but unlimited dimension on cols using 100x100 internal chunking:
Note
It is not thread safe, it must be called only once at dataset creation, otherwise an exception will occur. Multiple datasets inside a single hdf5 file are allowed.
Parameters
rows— declare amount of rowscols— declare amount of columnstype— type to be used, e.g, CV_8UC3, CV_32FC1 and etc.dslabel— specify the hdf5 dataset label. Existing dataset label will cause an error.compresslevel— specify the compression level 0-9 to be used, H5_NONE is the default value and means no compression. The value 0 also means no compression. A value 9 indicating the best compression ration. Note that a higher compression level indicates a higher computational cost. It relies on GNU gzip for compression.dims_chunks— each array member specifies the chunking size to be used for block I/O, by default NULL means none at all.
dscreate()#
void cv::hdf::HDF5::dscreate(
const int rows,
const int cols,
const int type,
const String & dslabel,
const int compresslevel,
const vector< int > & dims_chunks )
Python:
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
dscreate()#
void cv::hdf::HDF5::dscreate(
const vector< int > & sizes,
const int type,
const String & dslabel,
const int compresslevel = HDF5::H5_NONE,
const vector< int > & dims_chunks = vector< int >() )
Python:
dsgetsize()#
vector< int > cv::hdf::HDF5::dsgetsize(
const String & dslabel,
int dims_flag = HDF5::H5_GETDIMS )
Python:
cv.hdf.HDF5.dsgetsize(dslabel[, dims_flag]) -> retval
Fetch dataset sizes.
Returns vector object containing sizes of dataset on each dimensions.
Note
Resulting vector size will match the amount of dataset dimensions. By default H5_GETDIMS will return actual dataset dimensions. Using H5_GETMAXDIM flag will get maximum allowed dimension which normally match actual dataset dimension but can hold H5_UNLIMITED value if dataset was prepared in unlimited mode on some of its dimension. It can be useful to check existing dataset dimensions before overwrite it as whole or subset. Trying to write with oversized source data into dataset target will thrown exception. The H5_GETCHUNKDIMS will return the dimension of chunk if dataset was created with chunking options otherwise returned vector size will be zero.
Parameters
dslabel— specify the hdf5 dataset label to be measured.dims_flag— will fetch dataset dimensions on H5_GETDIMS, dataset maximum dimensions on H5_GETMAXDIMS, and chunk sizes on H5_GETCHUNKDIMS.
dsgettype()#
int cv::hdf::HDF5::dsgettype(const String & dslabel)
Python:
cv.hdf.HDF5.dsgettype(dslabel) -> retval
Fetch dataset type.
Returns the stored matrix type. This is an identifier compatible with the CvMat type system, like e.g. CV_16SC5 (16-bit signed 5-channel array), and so on.
Note
Result can be parsed with CV_MAT_CN() to obtain amount of channels and CV_MAT_DEPTH() to obtain native cvdata type. It is thread safe.
Parameters
dslabel— specify the hdf5 dataset label to be checked.
dsinsert()#
void cv::hdf::HDF5::dsinsert(
InputArray Array,
const String & dslabel )
Python:
cv.hdf.HDF5.dsinsert(Array, dslabel)
cv.hdf.HDF5.dsinsert(Array, dslabel, dims_offset)
cv.hdf.HDF5.dsinsert(Array, dslabel, dims_offset[, dims_counts])
cv.hdf.HDF5.dsinsert(Array, dslabel, dims_offset, dims_counts)
dsinsert()#
void cv::hdf::HDF5::dsinsert(
InputArray Array,
const String & dslabel,
const int * dims_offset )
Python:
cv.hdf.HDF5.dsinsert(Array, dslabel)
cv.hdf.HDF5.dsinsert(Array, dslabel, dims_offset)
cv.hdf.HDF5.dsinsert(Array, dslabel, dims_offset[, dims_counts])
cv.hdf.HDF5.dsinsert(Array, dslabel, dims_offset, dims_counts)
dsinsert()#
void cv::hdf::HDF5::dsinsert(
InputArray Array,
const String & dslabel,
const int * dims_offset,
const int * dims_counts )
Python:
cv.hdf.HDF5.dsinsert(Array, dslabel)
cv.hdf.HDF5.dsinsert(Array, dslabel, dims_offset)
cv.hdf.HDF5.dsinsert(Array, dslabel, dims_offset[, dims_counts])
cv.hdf.HDF5.dsinsert(Array, dslabel, dims_offset, dims_counts)
Insert or overwrite a Mat object into specified dataset and auto expand dataset size if unlimited property allows.
Writes Mat object into targeted dataset and autoexpand dataset dimension if allowed.
Note
Unlike dswrite(), datasets are not created automatically. Only Mat is supported and it must be continuous. If dsinsert() happens over outer regions of dataset dimensions and on that dimension of dataset is in unlimited mode then dataset is expanded, otherwise exception is thrown. To create datasets with unlimited property on specific or more dimensions see dscreate() and the optional H5_UNLIMITED flag at creation time. It is not thread safe over same dataset but multiple datasets can be merged inside a single hdf5 file.
Example below creates unlimited rows x 100 cols and expands rows 5 times with dsinsert() using single 100x100 CV_64FC2 over the dataset. Final size will have 5x100 rows and 100 cols, reflecting H matrix five times over row’s span. Chunks size is 100x100 just optimized against the H matrix size having compression disabled. If routine is called multiple times dataset will be just overwritten:
Parameters
Array— specify Mat data array to be written.dslabel— specify the target hdf5 dataset label.dims_offset— each array member specify the offset location over dataset’s each dimensions from where InputArray will be (over)written into dataset.dims_counts— each array member specify the amount of data over dataset’s each dimensions from InputArray that will be written into dataset.
dsinsert()#
void cv::hdf::HDF5::dsinsert(
InputArray Array,
const String & dslabel,
const vector< int > & dims_offset,
const vector< int > & dims_counts = vector< int >() )
Python:
cv.hdf.HDF5.dsinsert(Array, dslabel)
cv.hdf.HDF5.dsinsert(Array, dslabel, dims_offset)
cv.hdf.HDF5.dsinsert(Array, dslabel, dims_offset[, dims_counts])
cv.hdf.HDF5.dsinsert(Array, dslabel, dims_offset, dims_counts)
dsread()#
void cv::hdf::HDF5::dsread(
OutputArray Array,
const String & dslabel )
Python:
cv.hdf.HDF5.dsread(dslabel[, Array]) -> Array
cv.hdf.HDF5.dsread(dslabel, dims_offset[, Array]) -> Array
cv.hdf.HDF5.dsread(dslabel, dims_offset[, Array[, dims_counts]]) -> Array
cv.hdf.HDF5.dsread(dslabel, dims_offset, dims_counts[, Array]) -> Array
dsread()#
void cv::hdf::HDF5::dsread(
OutputArray Array,
const String & dslabel,
const int * dims_offset )
Python:
cv.hdf.HDF5.dsread(dslabel[, Array]) -> Array
cv.hdf.HDF5.dsread(dslabel, dims_offset[, Array]) -> Array
cv.hdf.HDF5.dsread(dslabel, dims_offset[, Array[, dims_counts]]) -> Array
cv.hdf.HDF5.dsread(dslabel, dims_offset, dims_counts[, Array]) -> Array
dsread()#
void cv::hdf::HDF5::dsread(
OutputArray Array,
const String & dslabel,
const int * dims_offset,
const int * dims_counts )
Python:
cv.hdf.HDF5.dsread(dslabel[, Array]) -> Array
cv.hdf.HDF5.dsread(dslabel, dims_offset[, Array]) -> Array
cv.hdf.HDF5.dsread(dslabel, dims_offset[, Array[, dims_counts]]) -> Array
cv.hdf.HDF5.dsread(dslabel, dims_offset, dims_counts[, Array]) -> Array
Read specific dataset from hdf5 file into Mat object.
Reads out Mat object reflecting the stored dataset.
Note
If hdf5 file does not exist an exception will be thrown. Use hlexists() to check dataset presence. It is thread safe.
Example below reads a dataset:
Example below perform read of 3x5 submatrix from second row and third element.
Parameters
Array— Mat container where data reads will be returned.dslabel— specify the source hdf5 dataset label.dims_offset— each array member specify the offset location over each dimensions from where dataset starts to read into OutputArray.dims_counts— each array member specify the amount over dataset’s each dimensions of dataset to read into OutputArray.
dsread()#
void cv::hdf::HDF5::dsread(
OutputArray Array,
const String & dslabel,
const vector< int > & dims_offset,
const vector< int > & dims_counts = vector< int >() )
Python:
cv.hdf.HDF5.dsread(dslabel[, Array]) -> Array
cv.hdf.HDF5.dsread(dslabel, dims_offset[, Array]) -> Array
cv.hdf.HDF5.dsread(dslabel, dims_offset[, Array[, dims_counts]]) -> Array
cv.hdf.HDF5.dsread(dslabel, dims_offset, dims_counts[, Array]) -> Array
dswrite()#
void cv::hdf::HDF5::dswrite(
InputArray Array,
const String & dslabel )
Python:
cv.hdf.HDF5.dswrite(Array, dslabel)
cv.hdf.HDF5.dswrite(Array, dslabel, dims_offset)
cv.hdf.HDF5.dswrite(Array, dslabel, dims_offset[, dims_counts])
cv.hdf.HDF5.dswrite(Array, dslabel, dims_offset, dims_counts)
dswrite()#
void cv::hdf::HDF5::dswrite(
InputArray Array,
const String & dslabel,
const int * dims_offset )
Python:
cv.hdf.HDF5.dswrite(Array, dslabel)
cv.hdf.HDF5.dswrite(Array, dslabel, dims_offset)
cv.hdf.HDF5.dswrite(Array, dslabel, dims_offset[, dims_counts])
cv.hdf.HDF5.dswrite(Array, dslabel, dims_offset, dims_counts)
dswrite()#
void cv::hdf::HDF5::dswrite(
InputArray Array,
const String & dslabel,
const int * dims_offset,
const int * dims_counts )
Python:
cv.hdf.HDF5.dswrite(Array, dslabel)
cv.hdf.HDF5.dswrite(Array, dslabel, dims_offset)
cv.hdf.HDF5.dswrite(Array, dslabel, dims_offset[, dims_counts])
cv.hdf.HDF5.dswrite(Array, dslabel, dims_offset, dims_counts)
Write or overwrite a Mat object into specified dataset of hdf5 file.
Writes Mat object into targeted dataset.
Note
If dataset is not created and does not exist it will be created automatically. Only Mat is supported and it must be continuous. It is thread safe but it is recommended that writes to happen over separate non-overlapping regions. Multiple datasets can be written inside a single hdf5 file.
Example below writes a 100x100 CV_64FC2 matrix into a dataset. No dataset pre-creation required. If routine is called multiple times dataset will be just overwritten:
Example below writes a smaller 50x100 matrix into 100x100 compressed space optimised by two 50x100 chunks. Matrix is written twice into first half (0->50) and second half (50->100) of data space using offset.
Parameters
Array— specify Mat data array to be written.dslabel— specify the target hdf5 dataset label.dims_offset— each array member specify the offset location over dataset’s each dimensions from where InputArray will be (over)written into dataset.dims_counts— each array member specifies the amount of data over dataset’s each dimensions from InputArray that will be written into dataset.
dswrite()#
void cv::hdf::HDF5::dswrite(
InputArray Array,
const String & dslabel,
const vector< int > & dims_offset,
const vector< int > & dims_counts = vector< int >() )
Python:
cv.hdf.HDF5.dswrite(Array, dslabel)
cv.hdf.HDF5.dswrite(Array, dslabel, dims_offset)
cv.hdf.HDF5.dswrite(Array, dslabel, dims_offset[, dims_counts])
cv.hdf.HDF5.dswrite(Array, dslabel, dims_offset, dims_counts)
grcreate()#
void cv::hdf::HDF5::grcreate(const String & grlabel)
Python:
cv.hdf.HDF5.grcreate(grlabel)
Create a group.
Create a hdf5 group with default properties. The group is closed automatically after creation.
Note
Groups are useful for better organising multiple datasets. It is possible to create subgroups within any group. Existence of a particular group can be checked using hlexists(). In case of subgroups, a label would be e.g: ‘Group1/SubGroup1’ where SubGroup1 is within the root group Group1. Before creating a subgroup, its parent group MUST be created.
In this example, Group1 will have one subgroup called SubGroup1: The corresponding result visualized using the HDFView tool is

Note
When a dataset is created with dscreate() or kpcreate(), it can be created within a group by specifying the full path within the label. In our example, it would be: ‘Group1/SubGroup1/MyDataSet’. It is not thread safe.
Parameters
grlabel— specify the hdf5 group label.
hlexists()#
bool cv::hdf::HDF5::hlexists(const String & label)
Python:
cv.hdf.HDF5.hlexists(label) -> retval
Check if label exists or not.
Returns true if dataset exists, and false otherwise.
Note
Checks if dataset, group or other object type (hdf5 link) exists under the label name. It is thread safe.
Parameters
label— specify the hdf5 dataset label.
kpcreate()#
void cv::hdf::HDF5::kpcreate(
const int size,
const String & kplabel,
const int compresslevel = H5_NONE,
const int chunks = H5_NONE )
Create and allocate special storage for cv::KeyPoint dataset.
Note
If the dataset already exists an exception will be thrown. Existence of the dataset can be checked using hlexists().
See example below that creates space for 100 keypoints in the dataset:
Note
A value of H5_UNLIMITED for size means unlimited keypoints, thus is possible to expand anytime such dataset by adding or inserting. Presence of H5_UNLIMITED require to define custom chunking. No default chunking will be defined in unlimited scenario since default size on that dimension will be zero, and will grow once dataset is written. Writing into dataset that have H5_UNLIMITED on some of its dimension requires kpinsert() that allow growth on unlimited dimension instead of kpwrite() that allows to write only in predefined data space.
See example below that creates unlimited space for keypoints chunking size of 100 but no compression:
Parameters
size— declare fixed number of KeyPointskplabel— specify the hdf5 dataset label, any existing dataset with the same label will be overwritten.compresslevel— specify the compression level 0-9 to be used, H5_NONE is default and means no compression.chunks— each array member specifies chunking sizes to be used for block I/O, H5_NONE is default and means no compression.
kpgetsize()#
int cv::hdf::HDF5::kpgetsize(
const String & kplabel,
int dims_flag = HDF5::H5_GETDIMS )
Python:
cv.hdf.HDF5.kpgetsize(kplabel[, dims_flag]) -> retval
Fetch keypoint dataset size.
Returns size of keypoints dataset.
Note
Resulting size will match the amount of keypoints. By default H5_GETDIMS will return actual dataset dimension. Using H5_GETMAXDIM flag will get maximum allowed dimension which normally match actual dataset dimension but can hold H5_UNLIMITED value if dataset was prepared in unlimited mode. It can be useful to check existing dataset dimension before overwrite it as whole or subset. Trying to write with oversized source data into dataset target will thrown exception. The H5_GETCHUNKDIMS will return the dimension of chunk if dataset was created with chunking options otherwise returned vector size will be zero.
Parameters
kplabel— specify the hdf5 dataset label to be measured.dims_flag— will fetch dataset dimensions on H5_GETDIMS, and dataset maximum dimensions on H5_GETMAXDIMS.
kpinsert()#
void cv::hdf::HDF5::kpinsert(
const vector< KeyPoint > keypoints,
const String & kplabel,
const int offset = H5_NONE,
const int counts = H5_NONE )
Insert or overwrite list of KeyPoint into specified dataset and autoexpand dataset size if unlimited property allows.
Writes vector
Note
Unlike kpwrite(), datasets are not created automatically. If dsinsert() happen over outer region of dataset and dataset has been created in unlimited mode then dataset is expanded, otherwise exception is thrown. To create datasets with unlimited property see kpcreate() and the optional H5_UNLIMITED flag at creation time. It is not thread safe over same dataset but multiple datasets can be merged inside single hdf5 file.
Example below creates unlimited space for keypoints storage, and inserts a list of 10 keypoints ten times into that space. Final dataset will have 100 keypoints. Chunks size is 10 just optimized against list of keypoints. If routine is called multiple times dataset will be just overwritten:
Parameters
keypoints— specify keypoints data list to be written.kplabel— specify the target hdf5 dataset label.offset— specify the offset location on dataset from where keypoints will be (over)written into dataset.counts— specify the amount of keypoints that will be written into dataset.
kpread()#
void cv::hdf::HDF5::kpread(
vector< KeyPoint > & keypoints,
const String & kplabel,
const int offset = H5_NONE,
const int counts = H5_NONE )
Read specific keypoint dataset from hdf5 file into vector
Reads out vector
Note
If hdf5 file does not exist an exception will be thrown. Use hlexists() to check dataset presence. It is thread safe.
Example below reads a dataset containing keypoints starting with second entry:
Example below perform read of 3 keypoints from second entry.
Parameters
keypoints— vectorcontainer where data reads will be returned. kplabel— specify the source hdf5 dataset label.offset— specify the offset location over dataset from where read starts.counts— specify the amount of keypoints from dataset to read.
kpwrite()#
void cv::hdf::HDF5::kpwrite(
const vector< KeyPoint > keypoints,
const String & kplabel,
const int offset = H5_NONE,
const int counts = H5_NONE )
Write or overwrite list of KeyPoint into specified dataset of hdf5 file.
Writes vector
Note
If dataset is not created and does not exist it will be created automatically. It is thread safe but it is recommended that writes to happen over separate non overlapping regions. Multiple datasets can be written inside single hdf5 file.
Example below writes a 100 keypoints into a dataset. No dataset precreation required. If routine is called multiple times dataset will be just overwritten:
Example below uses smaller set of 50 keypoints and writes into compressed space of 100 keypoints optimised by 10 chunks. Same keypoint set is written three times, first into first half (0->50) and at second half (50->75) then into remaining slots (75->99) of data space using offset and count parameters to settle the window for write access.If routine is called multiple times dataset will be just overwritten:
Parameters
keypoints— specify keypoints data list to be written.kplabel— specify the target hdf5 dataset label.offset— specify the offset location on dataset from where keypoints will be (over)written into dataset.counts— specify the amount of keypoints that will be written into dataset.
Source file#
The documentation for this class was generated from the following file:
opencv2/hdf/hdf5.hpp