Skip to content

hdf_HDF5

hdfclassOpenCV 5.0.0
import { hdf_HDF5 } from '@banou/opencv-wasm'

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

ARGUMENTSConstructor or factory
CLASShdf_HDF5
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.

Hierarchical Data Format version 5 interface.

Notice that this module is compiled only when hdf5 is correctly installed.

Constructors and members

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.

close

Close and release hdf5 object.

close(): void;

grcreate

Create a group.

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

 ![Visualization of groups using the HDFView tool](pics/create_groups.png)

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.

grcreate(grlabel: EmbindString): void;
grlabel

specify the hdf5 group label.

Create a hdf5 group with default properties. The group is closed automatically after creation.

hlexists

Check if label exists or not.

Note: Checks if dataset, group or other object type (hdf5 link) exists under the label name. It is thread safe.

hlexists(label: EmbindString): boolean;
label

specify the hdf5 dataset label.

Returns true if dataset exists, and false otherwise.

Returns

The boolean result.

atexists

Check whether a given attribute exits or not in the root group.

See: atdelete, atwrite, atread

atexists(atlabel: EmbindString): boolean;
atlabel

the attribute name to be checked.

Returns

true if the attribute exists, false otherwise.

atdelete

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.

See: atexists, atwrite, atread

atdelete(atlabel: EmbindString): void;
atlabel

the attribute to be deleted.

atwrite

Write an attribute inside 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.

See: atexists, atdelete, atread

atwrite(value: number, atlabel: EmbindString): void;
value

attribute value.

atlabel

attribute name.

The following example demonstrates how to write an attribute of type cv::String:

atwrite1

Write an attribute inside 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.

See: atexists, atdelete, atread

atwrite1(value: number, atlabel: EmbindString): void;
value

attribute value.

atlabel

attribute name.

The following example demonstrates how to write an attribute of type cv::String:

atwrite2

Write an attribute inside 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.

See: atexists, atdelete, atread

atwrite2(value: EmbindString, atlabel: EmbindString): void;
value

attribute value.

atlabel

attribute name.

The following example demonstrates how to write an attribute of type cv::String:

atwrite3

Write an attribute inside 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.

See: atexists, atdelete, atread

atwrite3(value: Mat, atlabel: EmbindString): void;
value

attribute value.

atlabel

attribute name.

The following example demonstrates how to write an attribute of type cv::String:

atread

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.

See: atexists, atdelete, atwrite

atread(atlabel: EmbindString): hdf_HDF5_atreadResult;
atlabel

attribute name

The following example demonstrates how to read an attribute of type cv::String:

Returns

The hdf_HDF5_atreadResult result. Scalar output parameters are returned as named fields in this object. Release returned native handles with using or delete(), including handles nested in results.

atread1

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.

See: atexists, atdelete, atwrite

atread1(atlabel: EmbindString): hdf_HDF5_atread1Result;
atlabel

attribute name

The following example demonstrates how to read an attribute of type cv::String:

Returns

The hdf_HDF5_atread1Result result. Scalar output parameters are returned as named fields in this object. Release returned native handles with using or delete(), including handles nested in results.

atread2

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.

See: atexists, atdelete, atwrite

atread2(atlabel: EmbindString): hdf_HDF5_atread2Result;
atlabel

attribute name

The following example demonstrates how to read an attribute of type cv::String:

Returns

The hdf_HDF5_atread2Result result. Scalar output parameters are returned as named fields in this object. Release returned native handles with using or delete(), including handles nested in results.

atread3

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.

See: atexists, atdelete, atwrite

atread3(value: Mat, atlabel: EmbindString): void;
value

address where the attribute is read into

atlabel

attribute name

The following example demonstrates how to read an attribute of type cv::String:

dscreate

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:
      // 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.

dscreate(rows: number, cols: number, type_: number, dslabel: EmbindString): void;
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.

dscreate1

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:
      // 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.

dscreate1(rows: number, cols: number, type_: number, dslabel: EmbindString, compresslevel: number): void;
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.

dscreate2

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:
      // 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.

dscreate2(rows: number, cols: number, type_: number, dslabel: EmbindString, compresslevel: number, dims_chunks: IntVector): void;
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.

dscreate3

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:
      // 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.

dscreate3(rows: number, cols: number, type_: number, dslabel: EmbindString, compresslevel: number, dims_chunks: IntVector): void;
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.

dscreate4

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:
      // 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();
    
dscreate4(n_dims: number, sizes: IntVector, type_: number, dslabel: EmbindString): void;
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.

dscreate5

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:
      // 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();
    
dscreate5(n_dims: number, sizes: IntVector, type_: number, dslabel: EmbindString, compresslevel: number): void;
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.

dscreate6

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:
      // 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();
    
dscreate6(sizes: IntVector, type_: number, dslabel: EmbindString, compresslevel: number, dims_chunks: IntVector): void;
3 available overloads
dscreate6(sizes: IntVector, type_: number, dslabel: EmbindString): void;
dscreate6(sizes: IntVector, type_: number, dslabel: EmbindString, compresslevel: number): void;
dscreate6(sizes: IntVector, type_: number, dslabel: EmbindString, compresslevel: number, dims_chunks: IntVector): void;
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.

dscreate7

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:
      // 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();
    
dscreate7(n_dims: number, sizes: IntVector, type_: number, dslabel: EmbindString, compresslevel: number, dims_chunks: IntVector): void;
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.

dsgetsize

Fetch dataset sizes

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.

dsgetsize(dslabel: EmbindString, dims_flag: number): IntVector;
2 available overloads
dsgetsize(dslabel: EmbindString): IntVector;
dsgetsize(dslabel: EmbindString, dims_flag: number): IntVector;
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.

Returns

The IntVector result. Release returned native handles with using or delete(), including handles nested in results.

dsgettype

Fetch dataset type

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.

dsgettype(dslabel: EmbindString): number;
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.

Returns

The number result.

dswrite

Write or overwrite a Mat object into specified dataset of hdf5 file.

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:
      // dual channel hilbert matrix
      cv::Mat H(100, 100, CV_64FC2);
      for(int i = 0; i < H.rows; i++)
        for(int j = 0; j < H.cols; j++)
        {
            H.at<cv::Vec2d>(i,j)[0] =  1./(i+j+1);
            H.at<cv::Vec2d>(i,j)[1] = -1./(i+j+1);
            count++;
        }
      // open / autocreate hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // write / overwrite dataset
      h5io->dswrite( H, "hilbert" );
      // release
      h5io->close();
    
- 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.
      // dual channel hilbert matrix
      cv::Mat H(50, 100, CV_64FC2);
      for(int i = 0; i < H.rows; i++)
        for(int j = 0; j < H.cols; j++)
        {
            H.at<cv::Vec2d>(i,j)[0] =  1./(i+j+1);
            H.at<cv::Vec2d>(i,j)[1] = -1./(i+j+1);
            count++;
        }
      // open / autocreate hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // optimise dataset by two chunks
      int chunks[2] = { 50, 100 };
      // create 100x100 CV_64FC2 compressed space
      h5io->dscreate( 100, 100, CV_64FC2, "hilbert", 9, chunks );
      // write into first half
      int offset1[2] = { 0, 0 };
      h5io->dswrite( H, "hilbert", offset1 );
      // write into second half
      int offset2[2] = { 50, 0 };
      h5io->dswrite( H, "hilbert", offset2 );
      // release
      h5io->close();
    
dswrite(Array: Mat, dslabel: EmbindString): void;
Array

specify Mat data array to be written.

dslabel

specify the target hdf5 dataset label.

dswrite1

Write or overwrite a Mat object into specified dataset of hdf5 file.

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:
      // dual channel hilbert matrix
      cv::Mat H(100, 100, CV_64FC2);
      for(int i = 0; i < H.rows; i++)
        for(int j = 0; j < H.cols; j++)
        {
            H.at<cv::Vec2d>(i,j)[0] =  1./(i+j+1);
            H.at<cv::Vec2d>(i,j)[1] = -1./(i+j+1);
            count++;
        }
      // open / autocreate hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // write / overwrite dataset
      h5io->dswrite( H, "hilbert" );
      // release
      h5io->close();
    
- 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.
      // dual channel hilbert matrix
      cv::Mat H(50, 100, CV_64FC2);
      for(int i = 0; i < H.rows; i++)
        for(int j = 0; j < H.cols; j++)
        {
            H.at<cv::Vec2d>(i,j)[0] =  1./(i+j+1);
            H.at<cv::Vec2d>(i,j)[1] = -1./(i+j+1);
            count++;
        }
      // open / autocreate hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // optimise dataset by two chunks
      int chunks[2] = { 50, 100 };
      // create 100x100 CV_64FC2 compressed space
      h5io->dscreate( 100, 100, CV_64FC2, "hilbert", 9, chunks );
      // write into first half
      int offset1[2] = { 0, 0 };
      h5io->dswrite( H, "hilbert", offset1 );
      // write into second half
      int offset2[2] = { 50, 0 };
      h5io->dswrite( H, "hilbert", offset2 );
      // release
      h5io->close();
    
dswrite1(Array: Mat, dslabel: EmbindString, dims_offset: IntVector): void;
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.

dswrite2

Write or overwrite a Mat object into specified dataset of hdf5 file.

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:
      // dual channel hilbert matrix
      cv::Mat H(100, 100, CV_64FC2);
      for(int i = 0; i < H.rows; i++)
        for(int j = 0; j < H.cols; j++)
        {
            H.at<cv::Vec2d>(i,j)[0] =  1./(i+j+1);
            H.at<cv::Vec2d>(i,j)[1] = -1./(i+j+1);
            count++;
        }
      // open / autocreate hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // write / overwrite dataset
      h5io->dswrite( H, "hilbert" );
      // release
      h5io->close();
    
- 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.
      // dual channel hilbert matrix
      cv::Mat H(50, 100, CV_64FC2);
      for(int i = 0; i < H.rows; i++)
        for(int j = 0; j < H.cols; j++)
        {
            H.at<cv::Vec2d>(i,j)[0] =  1./(i+j+1);
            H.at<cv::Vec2d>(i,j)[1] = -1./(i+j+1);
            count++;
        }
      // open / autocreate hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // optimise dataset by two chunks
      int chunks[2] = { 50, 100 };
      // create 100x100 CV_64FC2 compressed space
      h5io->dscreate( 100, 100, CV_64FC2, "hilbert", 9, chunks );
      // write into first half
      int offset1[2] = { 0, 0 };
      h5io->dswrite( H, "hilbert", offset1 );
      // write into second half
      int offset2[2] = { 50, 0 };
      h5io->dswrite( H, "hilbert", offset2 );
      // release
      h5io->close();
    
dswrite2(Array: Mat, dslabel: EmbindString, dims_offset: IntVector, dims_counts: IntVector): void;
2 available overloads
dswrite2(Array: Mat, dslabel: EmbindString, dims_offset: IntVector): void;
dswrite2(Array: Mat, dslabel: EmbindString, dims_offset: IntVector, dims_counts: IntVector): void;
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.

Writes Mat object into targeted dataset.

dswrite3

Write or overwrite a Mat object into specified dataset of hdf5 file.

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:
      // dual channel hilbert matrix
      cv::Mat H(100, 100, CV_64FC2);
      for(int i = 0; i < H.rows; i++)
        for(int j = 0; j < H.cols; j++)
        {
            H.at<cv::Vec2d>(i,j)[0] =  1./(i+j+1);
            H.at<cv::Vec2d>(i,j)[1] = -1./(i+j+1);
            count++;
        }
      // open / autocreate hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // write / overwrite dataset
      h5io->dswrite( H, "hilbert" );
      // release
      h5io->close();
    
- 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.
      // dual channel hilbert matrix
      cv::Mat H(50, 100, CV_64FC2);
      for(int i = 0; i < H.rows; i++)
        for(int j = 0; j < H.cols; j++)
        {
            H.at<cv::Vec2d>(i,j)[0] =  1./(i+j+1);
            H.at<cv::Vec2d>(i,j)[1] = -1./(i+j+1);
            count++;
        }
      // open / autocreate hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // optimise dataset by two chunks
      int chunks[2] = { 50, 100 };
      // create 100x100 CV_64FC2 compressed space
      h5io->dscreate( 100, 100, CV_64FC2, "hilbert", 9, chunks );
      // write into first half
      int offset1[2] = { 0, 0 };
      h5io->dswrite( H, "hilbert", offset1 );
      // write into second half
      int offset2[2] = { 50, 0 };
      h5io->dswrite( H, "hilbert", offset2 );
      // release
      h5io->close();
    
dswrite3(Array: Mat, dslabel: EmbindString, dims_offset: IntVector, dims_counts: IntVector): void;
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.

Writes Mat object into targeted dataset.

dsinsert

Insert or overwrite a Mat object into specified dataset and auto expand dataset size if unlimited property allows.

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:
      // dual channel hilbert matrix
      cv::Mat H(50, 100, CV_64FC2);
      for(int i = 0; i < H.rows; i++)
        for(int j = 0; j < H.cols; j++)
        {
            H.at<cv::Vec2d>(i,j)[0] =  1./(i+j+1);
            H.at<cv::Vec2d>(i,j)[1] = -1./(i+j+1);
            count++;
        }
      // open / autocreate hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // optimise dataset by chunks
      int chunks[2] = { 100, 100 };
      // create Unlimited x 100 CV_64FC2 space
      h5io->dscreate( cv::hdf::HDF5::H5_UNLIMITED, 100, CV_64FC2, "hilbert", cv::hdf::HDF5::H5_NONE, chunks );
      // write into first half
      int offset[2] = { 0, 0 };
      for ( int t = 0; t < 5; t++ )
      {
        offset[0] += 100 * t;
        h5io->dsinsert( H, "hilbert", offset );
      }
      // release
      h5io->close();
    
dsinsert(Array: Mat, dslabel: EmbindString): void;
Array

specify Mat data array to be written.

dslabel

specify the target hdf5 dataset label.

dsinsert1

Insert or overwrite a Mat object into specified dataset and auto expand dataset size if unlimited property allows.

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:
      // dual channel hilbert matrix
      cv::Mat H(50, 100, CV_64FC2);
      for(int i = 0; i < H.rows; i++)
        for(int j = 0; j < H.cols; j++)
        {
            H.at<cv::Vec2d>(i,j)[0] =  1./(i+j+1);
            H.at<cv::Vec2d>(i,j)[1] = -1./(i+j+1);
            count++;
        }
      // open / autocreate hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // optimise dataset by chunks
      int chunks[2] = { 100, 100 };
      // create Unlimited x 100 CV_64FC2 space
      h5io->dscreate( cv::hdf::HDF5::H5_UNLIMITED, 100, CV_64FC2, "hilbert", cv::hdf::HDF5::H5_NONE, chunks );
      // write into first half
      int offset[2] = { 0, 0 };
      for ( int t = 0; t < 5; t++ )
      {
        offset[0] += 100 * t;
        h5io->dsinsert( H, "hilbert", offset );
      }
      // release
      h5io->close();
    
dsinsert1(Array: Mat, dslabel: EmbindString, dims_offset: IntVector): void;
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.

dsinsert2

Insert or overwrite a Mat object into specified dataset and auto expand dataset size if unlimited property allows.

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:
      // dual channel hilbert matrix
      cv::Mat H(50, 100, CV_64FC2);
      for(int i = 0; i < H.rows; i++)
        for(int j = 0; j < H.cols; j++)
        {
            H.at<cv::Vec2d>(i,j)[0] =  1./(i+j+1);
            H.at<cv::Vec2d>(i,j)[1] = -1./(i+j+1);
            count++;
        }
      // open / autocreate hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // optimise dataset by chunks
      int chunks[2] = { 100, 100 };
      // create Unlimited x 100 CV_64FC2 space
      h5io->dscreate( cv::hdf::HDF5::H5_UNLIMITED, 100, CV_64FC2, "hilbert", cv::hdf::HDF5::H5_NONE, chunks );
      // write into first half
      int offset[2] = { 0, 0 };
      for ( int t = 0; t < 5; t++ )
      {
        offset[0] += 100 * t;
        h5io->dsinsert( H, "hilbert", offset );
      }
      // release
      h5io->close();
    
dsinsert2(Array: Mat, dslabel: EmbindString, dims_offset: IntVector, dims_counts: IntVector): void;
2 available overloads
dsinsert2(Array: Mat, dslabel: EmbindString, dims_offset: IntVector): void;
dsinsert2(Array: Mat, dslabel: EmbindString, dims_offset: IntVector, dims_counts: IntVector): void;
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.

Writes Mat object into targeted dataset and autoexpand dataset dimension if allowed.

dsinsert3

Insert or overwrite a Mat object into specified dataset and auto expand dataset size if unlimited property allows.

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:
      // dual channel hilbert matrix
      cv::Mat H(50, 100, CV_64FC2);
      for(int i = 0; i < H.rows; i++)
        for(int j = 0; j < H.cols; j++)
        {
            H.at<cv::Vec2d>(i,j)[0] =  1./(i+j+1);
            H.at<cv::Vec2d>(i,j)[1] = -1./(i+j+1);
            count++;
        }
      // open / autocreate hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // optimise dataset by chunks
      int chunks[2] = { 100, 100 };
      // create Unlimited x 100 CV_64FC2 space
      h5io->dscreate( cv::hdf::HDF5::H5_UNLIMITED, 100, CV_64FC2, "hilbert", cv::hdf::HDF5::H5_NONE, chunks );
      // write into first half
      int offset[2] = { 0, 0 };
      for ( int t = 0; t < 5; t++ )
      {
        offset[0] += 100 * t;
        h5io->dsinsert( H, "hilbert", offset );
      }
      // release
      h5io->close();
    
dsinsert3(Array: Mat, dslabel: EmbindString, dims_offset: IntVector, dims_counts: IntVector): void;
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.

Writes Mat object into targeted dataset and autoexpand dataset dimension if allowed.

dsread

Read specific dataset from hdf5 file into Mat object.

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:
      // open hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // blank Mat container
      cv::Mat H;
      // read hibert dataset
      h5io->read( H, "hilbert" );
      // release
      h5io->close();
    
- Example below perform read of 3x5 submatrix from second row and third element.
      // open hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // blank Mat container
      cv::Mat H;
      int offset[2] = { 1, 2 };
      int counts[2] = { 3, 5 };
      // read hibert dataset
      h5io->read( H, "hilbert", offset, counts );
      // release
      h5io->close();
    
dsread(Array: Mat, dslabel: EmbindString): void;
Array

Output destination, filled by the native operation. Mat container where data reads will be returned.

dslabel

specify the source hdf5 dataset label.

dsread1

Read specific dataset from hdf5 file into Mat object.

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:
      // open hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // blank Mat container
      cv::Mat H;
      // read hibert dataset
      h5io->read( H, "hilbert" );
      // release
      h5io->close();
    
- Example below perform read of 3x5 submatrix from second row and third element.
      // open hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // blank Mat container
      cv::Mat H;
      int offset[2] = { 1, 2 };
      int counts[2] = { 3, 5 };
      // read hibert dataset
      h5io->read( H, "hilbert", offset, counts );
      // release
      h5io->close();
    
dsread1(Array: Mat, dslabel: EmbindString, dims_offset: IntVector): void;
Array

Output destination, filled by the native operation. 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.

dsread2

Read specific dataset from hdf5 file into Mat object.

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:
      // open hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // blank Mat container
      cv::Mat H;
      // read hibert dataset
      h5io->read( H, "hilbert" );
      // release
      h5io->close();
    
- Example below perform read of 3x5 submatrix from second row and third element.
      // open hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // blank Mat container
      cv::Mat H;
      int offset[2] = { 1, 2 };
      int counts[2] = { 3, 5 };
      // read hibert dataset
      h5io->read( H, "hilbert", offset, counts );
      // release
      h5io->close();
    
dsread2(Array: Mat, dslabel: EmbindString, dims_offset: IntVector, dims_counts: IntVector): void;
2 available overloads
dsread2(Array: Mat, dslabel: EmbindString, dims_offset: IntVector): void;
dsread2(Array: Mat, dslabel: EmbindString, dims_offset: IntVector, dims_counts: IntVector): void;
Array

Output destination, filled by the native operation. 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.

Reads out Mat object reflecting the stored dataset.

dsread3

Read specific dataset from hdf5 file into Mat object.

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:
      // open hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // blank Mat container
      cv::Mat H;
      // read hibert dataset
      h5io->read( H, "hilbert" );
      // release
      h5io->close();
    
- Example below perform read of 3x5 submatrix from second row and third element.
      // open hdf5 file
      cv::Ptr<cv::hdf::HDF5> h5io = cv::hdf::open( "mytest.h5" );
      // blank Mat container
      cv::Mat H;
      int offset[2] = { 1, 2 };
      int counts[2] = { 3, 5 };
      // read hibert dataset
      h5io->read( H, "hilbert", offset, counts );
      // release
      h5io->close();
    
dsread3(Array: Mat, dslabel: EmbindString, dims_offset: IntVector, dims_counts: IntVector): void;
Array

Output destination, filled by the native operation. 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.

Reads out Mat object reflecting the stored dataset.

kpgetsize

Fetch keypoint dataset size

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.

kpgetsize(kplabel: EmbindString, dims_flag: number): number;
2 available overloads
kpgetsize(kplabel: EmbindString): number;
kpgetsize(kplabel: EmbindString, dims_flag: number): number;
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.

Returns

The number result.

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.