pub trait HDF5TraitConst {
Show 33 methods
// Required method
fn as_raw_HDF5(&self) -> *const c_void;
// Provided methods
fn hlexists(&self, label: &str) -> Result<bool> { ... }
fn atexists(&self, atlabel: &str) -> Result<bool> { ... }
fn dscreate(
&self,
rows: i32,
cols: i32,
typ: i32,
dslabel: &str,
) -> Result<()> { ... }
fn dscreate_compress(
&self,
rows: i32,
cols: i32,
typ: i32,
dslabel: &str,
compresslevel: i32,
) -> Result<()> { ... }
fn dscreate_compress_dims(
&self,
rows: i32,
cols: i32,
typ: i32,
dslabel: &str,
compresslevel: i32,
dims_chunks: &Vector<i32>,
) -> Result<()> { ... }
fn dscreate_nd(&self, sizes: &[i32], typ: i32, dslabel: &str) -> Result<()> { ... }
fn dscreate_nd_compress(
&self,
sizes: &[i32],
typ: i32,
dslabel: &str,
compresslevel: i32,
) -> Result<()> { ... }
fn dscreate_nd_vec_compress_dims(
&self,
sizes: &Vector<i32>,
typ: i32,
dslabel: &str,
compresslevel: i32,
dims_chunks: &Vector<i32>,
) -> Result<()> { ... }
fn dscreate_nd_vec_compress_dims_def(
&self,
sizes: &Vector<i32>,
typ: i32,
dslabel: &str,
) -> Result<()> { ... }
fn dscreate_nd_compress_dims(
&self,
sizes: &[i32],
typ: i32,
dslabel: &str,
compresslevel: i32,
dims_chunks: &i32,
) -> Result<()> { ... }
fn dsgetsize(&self, dslabel: &str, dims_flag: i32) -> Result<Vector<i32>> { ... }
fn dsgetsize_def(&self, dslabel: &str) -> Result<Vector<i32>> { ... }
fn dsgettype(&self, dslabel: &str) -> Result<i32> { ... }
fn dswrite(&self, array: &impl ToInputArray, dslabel: &str) -> Result<()> { ... }
fn dswrite_offset(
&self,
array: &impl ToInputArray,
dslabel: &str,
dims_offset: &Vector<i32>,
dims_counts: &Vector<i32>,
) -> Result<()> { ... }
fn dswrite_offset_def(
&self,
array: &impl ToInputArray,
dslabel: &str,
dims_offset: &Vector<i32>,
) -> Result<()> { ... }
fn dsinsert(&self, array: &impl ToInputArray, dslabel: &str) -> Result<()> { ... }
fn dsinsert_offset(
&self,
array: &impl ToInputArray,
dslabel: &str,
dims_offset: &Vector<i32>,
dims_counts: &Vector<i32>,
) -> Result<()> { ... }
fn dsinsert_offset_def(
&self,
array: &impl ToInputArray,
dslabel: &str,
dims_offset: &Vector<i32>,
) -> Result<()> { ... }
fn dsread(
&self,
array: &mut impl ToOutputArray,
dslabel: &str,
) -> Result<()> { ... }
fn dsread_offset(
&self,
array: &mut impl ToOutputArray,
dslabel: &str,
dims_offset: &Vector<i32>,
dims_counts: &Vector<i32>,
) -> Result<()> { ... }
fn dsread_offset_def(
&self,
array: &mut impl ToOutputArray,
dslabel: &str,
dims_offset: &Vector<i32>,
) -> Result<()> { ... }
fn kpgetsize(&self, kplabel: &str, dims_flag: i32) -> Result<i32> { ... }
fn kpgetsize_def(&self, kplabel: &str) -> Result<i32> { ... }
fn kpcreate(
&self,
size: i32,
kplabel: &str,
compresslevel: i32,
chunks: i32,
) -> Result<()> { ... }
fn kpcreate_def(&self, size: i32, kplabel: &str) -> Result<()> { ... }
fn kpwrite(
&self,
keypoints: Vector<KeyPoint>,
kplabel: &str,
offset: i32,
counts: i32,
) -> Result<()> { ... }
fn kpwrite_def(
&self,
keypoints: Vector<KeyPoint>,
kplabel: &str,
) -> Result<()> { ... }
fn kpinsert(
&self,
keypoints: Vector<KeyPoint>,
kplabel: &str,
offset: i32,
counts: i32,
) -> Result<()> { ... }
fn kpinsert_def(
&self,
keypoints: Vector<KeyPoint>,
kplabel: &str,
) -> Result<()> { ... }
fn kpread(
&self,
keypoints: &mut Vector<KeyPoint>,
kplabel: &str,
offset: i32,
counts: i32,
) -> Result<()> { ... }
fn kpread_def(
&self,
keypoints: &mut Vector<KeyPoint>,
kplabel: &str,
) -> Result<()> { ... }
}
Expand description
Constant methods for crate::hdf::HDF5
Required Methods§
fn as_raw_HDF5(&self) -> *const c_void
Provided Methods§
Sourcefn hlexists(&self, label: &str) -> Result<bool>
fn hlexists(&self, label: &str) -> Result<bool>
Check if label exists or not.
§Parameters
- label: specify the hdf5 dataset label.
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.
Sourcefn dscreate(&self, rows: i32, cols: i32, typ: i32, dslabel: &str) -> Result<()>
fn dscreate(&self, rows: i32, cols: i32, typ: i32, dslabel: &str) -> Result<()>
Create and allocate storage for two dimensional single or multi channel dataset.
§Parameters
- rows: declare amount of rows
- cols: declare amount of columns
- type: 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.
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:
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create space for 100x50 CV_64FC2 matrix
if ( ! h5io->hlexists( "hilbert" ) )
h5io->dscreate( 100, 50, CV_64FC2, "hilbert" );
else
printf("DS already created, skipping\n" );
// release
h5io->close();
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:
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create level 9 compressed space for CV_64FC2 matrix
if ( ! h5io->hlexists( "hilbert", 9 ) )
h5io->dscreate( 100, 50, CV_64FC2, "hilbert", 9 );
else
printf("DS already created, skipping\n" );
// release
h5io->close();
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:
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create level 9 compressed space for CV_64FC2 matrix
int chunks[2] = { 100, 100 };
h5io->dscreate( 100, cv::hdf::HDF5::H5_UNLIMITED, CV_64FC2, "hilbert", cv::hdf::HDF5::H5_NONE, chunks );
// release
h5io->close();
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.
§Overloaded parameters
Sourcefn dscreate_compress(
&self,
rows: i32,
cols: i32,
typ: i32,
dslabel: &str,
compresslevel: i32,
) -> Result<()>
fn dscreate_compress( &self, rows: i32, cols: i32, typ: i32, dslabel: &str, compresslevel: i32, ) -> Result<()>
Create and allocate storage for two dimensional single or multi channel dataset.
§Parameters
- rows: declare amount of rows
- cols: declare amount of columns
- type: 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.
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:
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create space for 100x50 CV_64FC2 matrix
if ( ! h5io->hlexists( "hilbert" ) )
h5io->dscreate( 100, 50, CV_64FC2, "hilbert" );
else
printf("DS already created, skipping\n" );
// release
h5io->close();
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:
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create level 9 compressed space for CV_64FC2 matrix
if ( ! h5io->hlexists( "hilbert", 9 ) )
h5io->dscreate( 100, 50, CV_64FC2, "hilbert", 9 );
else
printf("DS already created, skipping\n" );
// release
h5io->close();
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:
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create level 9 compressed space for CV_64FC2 matrix
int chunks[2] = { 100, 100 };
h5io->dscreate( 100, cv::hdf::HDF5::H5_UNLIMITED, CV_64FC2, "hilbert", cv::hdf::HDF5::H5_NONE, chunks );
// release
h5io->close();
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.
§Overloaded parameters
Sourcefn dscreate_compress_dims(
&self,
rows: i32,
cols: i32,
typ: i32,
dslabel: &str,
compresslevel: i32,
dims_chunks: &Vector<i32>,
) -> Result<()>
fn dscreate_compress_dims( &self, rows: i32, cols: i32, typ: i32, dslabel: &str, compresslevel: i32, dims_chunks: &Vector<i32>, ) -> Result<()>
Create and allocate storage for two dimensional single or multi channel dataset.
§Parameters
- rows: declare amount of rows
- cols: declare amount of columns
- type: 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.
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:
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create space for 100x50 CV_64FC2 matrix
if ( ! h5io->hlexists( "hilbert" ) )
h5io->dscreate( 100, 50, CV_64FC2, "hilbert" );
else
printf("DS already created, skipping\n" );
// release
h5io->close();
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:
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create level 9 compressed space for CV_64FC2 matrix
if ( ! h5io->hlexists( "hilbert", 9 ) )
h5io->dscreate( 100, 50, CV_64FC2, "hilbert", 9 );
else
printf("DS already created, skipping\n" );
// release
h5io->close();
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:
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create level 9 compressed space for CV_64FC2 matrix
int chunks[2] = { 100, 100 };
h5io->dscreate( 100, cv::hdf::HDF5::H5_UNLIMITED, CV_64FC2, "hilbert", cv::hdf::HDF5::H5_NONE, chunks );
// release
h5io->close();
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.
§Overloaded parameters
fn dscreate_nd(&self, sizes: &[i32], typ: i32, dslabel: &str) -> Result<()>
fn dscreate_nd_compress( &self, sizes: &[i32], typ: i32, dslabel: &str, compresslevel: i32, ) -> Result<()>
Sourcefn dscreate_nd_vec_compress_dims(
&self,
sizes: &Vector<i32>,
typ: i32,
dslabel: &str,
compresslevel: i32,
dims_chunks: &Vector<i32>,
) -> Result<()>
fn dscreate_nd_vec_compress_dims( &self, sizes: &Vector<i32>, typ: i32, dslabel: &str, compresslevel: i32, dims_chunks: &Vector<i32>, ) -> Result<()>
§C++ default parameters
- compresslevel: HDF5::H5_NONE
- dims_chunks: vector
()
Sourcefn dscreate_nd_vec_compress_dims_def(
&self,
sizes: &Vector<i32>,
typ: i32,
dslabel: &str,
) -> Result<()>
fn dscreate_nd_vec_compress_dims_def( &self, sizes: &Vector<i32>, typ: i32, dslabel: &str, ) -> Result<()>
§Note
This alternative version of HDF5TraitConst::dscreate_nd_vec_compress_dims function uses the following default values for its arguments:
- compresslevel: HDF5::H5_NONE
- dims_chunks: vector
()
Sourcefn dscreate_nd_compress_dims(
&self,
sizes: &[i32],
typ: i32,
dslabel: &str,
compresslevel: i32,
dims_chunks: &i32,
) -> Result<()>
fn dscreate_nd_compress_dims( &self, sizes: &[i32], typ: i32, dslabel: &str, compresslevel: i32, dims_chunks: &i32, ) -> Result<()>
Create and allocate storage for n-dimensional dataset, single or multichannel type.
§Parameters
- n_dims: declare number of dimensions
- sizes: array containing sizes for each dimensions
- type: 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.
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:
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create space for 6 dimensional CV_64FC2 matrix
if ( ! h5io->hlexists( "nddata" ) )
int n_dims = 5;
int dsdims[n_dims] = { 100, 100, 20, 10, 5, 5 };
h5io->dscreate( n_dims, sizes, CV_64FC2, "nddata" );
else
printf("DS already created, skipping\n" );
// release
h5io->close();
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:
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create space for 6 dimensional CV_64FC2 matrix
if ( ! h5io->hlexists( "nddata" ) )
int n_dims = 5;
int dsdims[n_dims] = { 100, 100, 20, 10, 5, 5 };
int chunks[n_dims] = { 1, 100, 20, 10, 5, 5 };
h5io->dscreate( n_dims, dsdims, CV_64FC2, "nddata", 0, chunks );
else
printf("DS already created, skipping\n" );
// release
h5io->close();
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:
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
int n_dims = 3;
int chunks[n_dims] = { 1, 1, 1 };
int dsdims[n_dims] = { cv::hdf::HDF5::H5_UNLIMITED, cv::hdf::HDF5::H5_UNLIMITED, cv::hdf::HDF5::H5_UNLIMITED };
h5io->dscreate( n_dims, dsdims, CV_64FC2, "nddata", cv::hdf::HDF5::H5_NONE, chunks );
// release
h5io->close();
Sourcefn dsgetsize(&self, dslabel: &str, dims_flag: i32) -> Result<Vector<i32>>
fn dsgetsize(&self, dslabel: &str, dims_flag: i32) -> Result<Vector<i32>>
Fetch dataset sizes
§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.
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.
§C++ default parameters
- dims_flag: HDF5::H5_GETDIMS
Sourcefn dsgetsize_def(&self, dslabel: &str) -> Result<Vector<i32>>
fn dsgetsize_def(&self, dslabel: &str) -> Result<Vector<i32>>
Fetch dataset sizes
§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.
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.
§Note
This alternative version of HDF5TraitConst::dsgetsize function uses the following default values for its arguments:
- dims_flag: HDF5::H5_GETDIMS
Sourcefn dsgettype(&self, dslabel: &str) -> Result<i32>
fn dsgettype(&self, dslabel: &str) -> Result<i32>
Fetch dataset type
§Parameters
- dslabel: specify the hdf5 dataset label to be checked.
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.
fn dswrite(&self, array: &impl ToInputArray, dslabel: &str) -> Result<()>
Sourcefn dswrite_offset(
&self,
array: &impl ToInputArray,
dslabel: &str,
dims_offset: &Vector<i32>,
dims_counts: &Vector<i32>,
) -> Result<()>
fn dswrite_offset( &self, array: &impl ToInputArray, dslabel: &str, dims_offset: &Vector<i32>, dims_counts: &Vector<i32>, ) -> Result<()>
§C++ default parameters
- dims_counts: vector
()
Sourcefn dswrite_offset_def(
&self,
array: &impl ToInputArray,
dslabel: &str,
dims_offset: &Vector<i32>,
) -> Result<()>
fn dswrite_offset_def( &self, array: &impl ToInputArray, dslabel: &str, dims_offset: &Vector<i32>, ) -> Result<()>
§Note
This alternative version of HDF5TraitConst::dswrite_offset function uses the following default values for its arguments:
- dims_counts: vector
()
fn dsinsert(&self, array: &impl ToInputArray, dslabel: &str) -> Result<()>
Sourcefn dsinsert_offset(
&self,
array: &impl ToInputArray,
dslabel: &str,
dims_offset: &Vector<i32>,
dims_counts: &Vector<i32>,
) -> Result<()>
fn dsinsert_offset( &self, array: &impl ToInputArray, dslabel: &str, dims_offset: &Vector<i32>, dims_counts: &Vector<i32>, ) -> Result<()>
§C++ default parameters
- dims_counts: vector
()
Sourcefn dsinsert_offset_def(
&self,
array: &impl ToInputArray,
dslabel: &str,
dims_offset: &Vector<i32>,
) -> Result<()>
fn dsinsert_offset_def( &self, array: &impl ToInputArray, dslabel: &str, dims_offset: &Vector<i32>, ) -> Result<()>
§Note
This alternative version of HDF5TraitConst::dsinsert_offset function uses the following default values for its arguments:
- dims_counts: vector
()
fn dsread(&self, array: &mut impl ToOutputArray, dslabel: &str) -> Result<()>
Sourcefn dsread_offset(
&self,
array: &mut impl ToOutputArray,
dslabel: &str,
dims_offset: &Vector<i32>,
dims_counts: &Vector<i32>,
) -> Result<()>
fn dsread_offset( &self, array: &mut impl ToOutputArray, dslabel: &str, dims_offset: &Vector<i32>, dims_counts: &Vector<i32>, ) -> Result<()>
§C++ default parameters
- dims_counts: vector
()
Sourcefn dsread_offset_def(
&self,
array: &mut impl ToOutputArray,
dslabel: &str,
dims_offset: &Vector<i32>,
) -> Result<()>
fn dsread_offset_def( &self, array: &mut impl ToOutputArray, dslabel: &str, dims_offset: &Vector<i32>, ) -> Result<()>
§Note
This alternative version of HDF5TraitConst::dsread_offset function uses the following default values for its arguments:
- dims_counts: vector
()
Sourcefn kpgetsize(&self, kplabel: &str, dims_flag: i32) -> Result<i32>
fn kpgetsize(&self, kplabel: &str, dims_flag: i32) -> Result<i32>
Fetch keypoint dataset size
§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.
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.
§C++ default parameters
- dims_flag: HDF5::H5_GETDIMS
Sourcefn kpgetsize_def(&self, kplabel: &str) -> Result<i32>
fn kpgetsize_def(&self, kplabel: &str) -> Result<i32>
Fetch keypoint dataset size
§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.
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.
§Note
This alternative version of HDF5TraitConst::kpgetsize function uses the following default values for its arguments:
- dims_flag: HDF5::H5_GETDIMS
Sourcefn kpcreate(
&self,
size: i32,
kplabel: &str,
compresslevel: i32,
chunks: i32,
) -> Result<()>
fn kpcreate( &self, size: i32, kplabel: &str, compresslevel: i32, chunks: i32, ) -> Result<()>
Create and allocate special storage for cv::KeyPoint dataset.
§Parameters
- size: declare fixed number of KeyPoints
- kplabel: 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.
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:
// open hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
if ( ! h5io->hlexists( "keypoints" ) )
h5io->kpcreate( 100, "keypoints" );
else
printf("DS already created, skipping\n" );
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:
// open hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
if ( ! h5io->hlexists( "keypoints" ) )
h5io->kpcreate( cv::hdf::HDF5::H5_UNLIMITED, "keypoints", cv::hdf::HDF5::H5_NONE, 100 );
else
printf("DS already created, skipping\n" );
§C++ default parameters
- compresslevel: H5_NONE
- chunks: H5_NONE
Sourcefn kpcreate_def(&self, size: i32, kplabel: &str) -> Result<()>
fn kpcreate_def(&self, size: i32, kplabel: &str) -> Result<()>
Create and allocate special storage for cv::KeyPoint dataset.
§Parameters
- size: declare fixed number of KeyPoints
- kplabel: 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.
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:
// open hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
if ( ! h5io->hlexists( "keypoints" ) )
h5io->kpcreate( 100, "keypoints" );
else
printf("DS already created, skipping\n" );
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:
// open hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
if ( ! h5io->hlexists( "keypoints" ) )
h5io->kpcreate( cv::hdf::HDF5::H5_UNLIMITED, "keypoints", cv::hdf::HDF5::H5_NONE, 100 );
else
printf("DS already created, skipping\n" );
§Note
This alternative version of HDF5TraitConst::kpcreate function uses the following default values for its arguments:
- compresslevel: H5_NONE
- chunks: H5_NONE
Sourcefn kpwrite(
&self,
keypoints: Vector<KeyPoint>,
kplabel: &str,
offset: i32,
counts: i32,
) -> Result<()>
fn kpwrite( &self, keypoints: Vector<KeyPoint>, kplabel: &str, offset: i32, counts: i32, ) -> Result<()>
Write or overwrite list of KeyPoint into specified dataset of hdf5 file.
§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.
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:
// generate 100 dummy keypoints
std::vector<cv::KeyPoint> keypoints;
for(int i = 0; i < 100; i++)
keypoints.push_back( cv::KeyPoint(i, -i, 1, -1, 0, 0, -1) );
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// write / overwrite dataset
h5io->kpwrite( keypoints, "keypoints" );
// release
h5io->close();
- 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:
// generate 50 dummy keypoints
std::vector<cv::KeyPoint> keypoints;
for(int i = 0; i < 50; i++)
keypoints.push_back( cv::KeyPoint(i, -i, 1, -1, 0, 0, -1) );
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create maximum compressed space of size 100 with chunk size 10
h5io->kpcreate( 100, "keypoints", 9, 10 );
// write into first half
h5io->kpwrite( keypoints, "keypoints", 0 );
// write first 25 keypoints into second half
h5io->kpwrite( keypoints, "keypoints", 50, 25 );
// write first 25 keypoints into remained space of second half
h5io->kpwrite( keypoints, "keypoints", 75, 25 );
// release
h5io->close();
§C++ default parameters
- offset: H5_NONE
- counts: H5_NONE
Sourcefn kpwrite_def(&self, keypoints: Vector<KeyPoint>, kplabel: &str) -> Result<()>
fn kpwrite_def(&self, keypoints: Vector<KeyPoint>, kplabel: &str) -> Result<()>
Write or overwrite list of KeyPoint into specified dataset of hdf5 file.
§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.
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:
// generate 100 dummy keypoints
std::vector<cv::KeyPoint> keypoints;
for(int i = 0; i < 100; i++)
keypoints.push_back( cv::KeyPoint(i, -i, 1, -1, 0, 0, -1) );
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// write / overwrite dataset
h5io->kpwrite( keypoints, "keypoints" );
// release
h5io->close();
- 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:
// generate 50 dummy keypoints
std::vector<cv::KeyPoint> keypoints;
for(int i = 0; i < 50; i++)
keypoints.push_back( cv::KeyPoint(i, -i, 1, -1, 0, 0, -1) );
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create maximum compressed space of size 100 with chunk size 10
h5io->kpcreate( 100, "keypoints", 9, 10 );
// write into first half
h5io->kpwrite( keypoints, "keypoints", 0 );
// write first 25 keypoints into second half
h5io->kpwrite( keypoints, "keypoints", 50, 25 );
// write first 25 keypoints into remained space of second half
h5io->kpwrite( keypoints, "keypoints", 75, 25 );
// release
h5io->close();
§Note
This alternative version of HDF5TraitConst::kpwrite function uses the following default values for its arguments:
- offset: H5_NONE
- counts: H5_NONE
Sourcefn kpinsert(
&self,
keypoints: Vector<KeyPoint>,
kplabel: &str,
offset: i32,
counts: i32,
) -> Result<()>
fn kpinsert( &self, keypoints: Vector<KeyPoint>, kplabel: &str, offset: i32, counts: i32, ) -> Result<()>
Insert or overwrite list of KeyPoint into specified dataset and autoexpand dataset size if unlimited property allows.
§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.
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:
// generate 10 dummy keypoints
std::vector<cv::KeyPoint> keypoints;
for(int i = 0; i < 10; i++)
keypoints.push_back( cv::KeyPoint(i, -i, 1, -1, 0, 0, -1) );
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create unlimited size space with chunk size of 10
h5io->kpcreate( cv::hdf::HDF5::H5_UNLIMITED, "keypoints", -1, 10 );
// insert 10 times same 10 keypoints
for(int i = 0; i < 10; i++)
h5io->kpinsert( keypoints, "keypoints", i * 10 );
// release
h5io->close();
§C++ default parameters
- offset: H5_NONE
- counts: H5_NONE
Sourcefn kpinsert_def(&self, keypoints: Vector<KeyPoint>, kplabel: &str) -> Result<()>
fn kpinsert_def(&self, keypoints: Vector<KeyPoint>, kplabel: &str) -> Result<()>
Insert or overwrite list of KeyPoint into specified dataset and autoexpand dataset size if unlimited property allows.
§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.
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:
// generate 10 dummy keypoints
std::vector<cv::KeyPoint> keypoints;
for(int i = 0; i < 10; i++)
keypoints.push_back( cv::KeyPoint(i, -i, 1, -1, 0, 0, -1) );
// open / autocreate hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// create unlimited size space with chunk size of 10
h5io->kpcreate( cv::hdf::HDF5::H5_UNLIMITED, "keypoints", -1, 10 );
// insert 10 times same 10 keypoints
for(int i = 0; i < 10; i++)
h5io->kpinsert( keypoints, "keypoints", i * 10 );
// release
h5io->close();
§Note
This alternative version of HDF5TraitConst::kpinsert function uses the following default values for its arguments:
- offset: H5_NONE
- counts: H5_NONE
Sourcefn kpread(
&self,
keypoints: &mut Vector<KeyPoint>,
kplabel: &str,
offset: i32,
counts: i32,
) -> Result<()>
fn kpread( &self, keypoints: &mut Vector<KeyPoint>, kplabel: &str, offset: i32, counts: i32, ) -> Result<()>
Read specific keypoint dataset from hdf5 file into vector
§Parameters
- keypoints: vector
container 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.
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:
// open hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// blank KeyPoint container
std::vector<cv::KeyPoint> keypoints;
// read keypoints starting second one
h5io->kpread( keypoints, "keypoints", 1 );
// release
h5io->close();
- Example below perform read of 3 keypoints from second entry.
// open hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// blank KeyPoint container
std::vector<cv::KeyPoint> keypoints;
// read three keypoints starting second one
h5io->kpread( keypoints, "keypoints", 1, 3 );
// release
h5io->close();
§C++ default parameters
- offset: H5_NONE
- counts: H5_NONE
Sourcefn kpread_def(
&self,
keypoints: &mut Vector<KeyPoint>,
kplabel: &str,
) -> Result<()>
fn kpread_def( &self, keypoints: &mut Vector<KeyPoint>, kplabel: &str, ) -> Result<()>
Read specific keypoint dataset from hdf5 file into vector
§Parameters
- keypoints: vector
container 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.
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:
// open hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// blank KeyPoint container
std::vector<cv::KeyPoint> keypoints;
// read keypoints starting second one
h5io->kpread( keypoints, "keypoints", 1 );
// release
h5io->close();
- Example below perform read of 3 keypoints from second entry.
// open hdf5 file
cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
// blank KeyPoint container
std::vector<cv::KeyPoint> keypoints;
// read three keypoints starting second one
h5io->kpread( keypoints, "keypoints", 1, 3 );
// release
h5io->close();
§Note
This alternative version of HDF5TraitConst::kpread function uses the following default values for its arguments:
- offset: H5_NONE
- counts: H5_NONE
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.