opencv::hdf

Trait HDF5Trait

Source
pub trait HDF5Trait: HDF5TraitConst {
    // Required method
    fn as_raw_mut_HDF5(&mut self) -> *mut c_void;

    // Provided methods
    fn close(&mut self) -> Result<()> { ... }
    fn grcreate(&mut self, grlabel: &str) -> Result<()> { ... }
    fn atdelete(&mut self, atlabel: &str) -> Result<()> { ... }
    fn atwrite_i32(&mut self, value: i32, atlabel: &str) -> Result<()> { ... }
    fn atread_i32(&mut self, value: &mut i32, atlabel: &str) -> Result<()> { ... }
    fn atwrite_f64(&mut self, value: f64, atlabel: &str) -> Result<()> { ... }
    fn atread_f64(&mut self, value: &mut f64, atlabel: &str) -> Result<()> { ... }
    fn atwrite_str(&mut self, value: &str, atlabel: &str) -> Result<()> { ... }
    fn atread_str(&mut self, value: &mut String, atlabel: &str) -> Result<()> { ... }
    fn atwrite(
        &mut self,
        value: &impl ToInputArray,
        atlabel: &str,
    ) -> Result<()> { ... }
    fn atread(
        &mut self,
        value: &mut impl ToOutputArray,
        atlabel: &str,
    ) -> Result<()> { ... }
}
Expand description

Mutable methods for crate::hdf::HDF5

Required Methods§

Provided Methods§

Source

fn close(&mut self) -> Result<()>

Close and release hdf5 object.

Source

fn grcreate(&mut self, grlabel: &str) -> Result<()>

Create a group.

§Parameters
  • grlabel: specify the hdf5 group label.

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

Note: Groups are useful for better organising multiple datasets. It is possible to create subgroups within any group. Existence of a particular group can be checked using hlexists(). In case of subgroups, a label would be e.g: ‘Group1/SubGroup1’ where SubGroup1 is within the root group Group1. Before creating a subgroup, its parent group MUST be created.

  • In this example, Group1 will have one subgroup called SubGroup1:

create_group

The corresponding result visualized using the HDFView tool is

Visualization of groups using the HDFView tool

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.

Source

fn atdelete(&mut self, atlabel: &str) -> Result<()>

Delete an attribute from the root group.

§Parameters
  • atlabel: the attribute to be deleted.

Note: CV_Error() is called if the given attribute does not exist. Use atexists() to check whether it exists or not beforehand.

§See also

atexists, atwrite, atread

Source

fn atwrite_i32(&mut self, value: i32, atlabel: &str) -> Result<()>

Write an attribute inside the root group.

§Parameters
  • value: attribute value.
  • atlabel: attribute name.

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

snippets_write_str

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 also

atexists, atdelete, atread

Source

fn atread_i32(&mut self, value: &mut i32, atlabel: &str) -> Result<()>

Read an attribute from the root group.

§Parameters
  • value: address where the attribute is read into
  • atlabel: attribute name

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

snippets_read_str

Note: The attribute MUST exist, otherwise CV_Error() is called. Use atexists() to check if it exists beforehand.

§See also

atexists, atdelete, atwrite

Source

fn atwrite_f64(&mut self, value: f64, atlabel: &str) -> Result<()>

Write an attribute inside the root group.

§Parameters
  • value: attribute value.
  • atlabel: attribute name.

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

snippets_write_str

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 also

atexists, atdelete, atread

§Overloaded parameters
Source

fn atread_f64(&mut self, value: &mut f64, atlabel: &str) -> Result<()>

Read an attribute from the root group.

§Parameters
  • value: address where the attribute is read into
  • atlabel: attribute name

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

snippets_read_str

Note: The attribute MUST exist, otherwise CV_Error() is called. Use atexists() to check if it exists beforehand.

§See also

atexists, atdelete, atwrite

§Overloaded parameters
Source

fn atwrite_str(&mut self, value: &str, atlabel: &str) -> Result<()>

Write an attribute inside the root group.

§Parameters
  • value: attribute value.
  • atlabel: attribute name.

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

snippets_write_str

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 also

atexists, atdelete, atread

§Overloaded parameters
Source

fn atread_str(&mut self, value: &mut String, atlabel: &str) -> Result<()>

Read an attribute from the root group.

§Parameters
  • value: address where the attribute is read into
  • atlabel: attribute name

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

snippets_read_str

Note: The attribute MUST exist, otherwise CV_Error() is called. Use atexists() to check if it exists beforehand.

§See also

atexists, atdelete, atwrite

§Overloaded parameters
Source

fn atwrite(&mut self, value: &impl ToInputArray, atlabel: &str) -> Result<()>

Write an attribute into the root group.

§Parameters
  • value: attribute value. Currently, only n-d continuous multi-channel arrays are supported.
  • atlabel: attribute name.

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 also

atexists, atdelete, atread.

Source

fn atread( &mut self, value: &mut impl ToOutputArray, atlabel: &str, ) -> Result<()>

Read an attribute from the root group.

§Parameters
  • value: attribute value. Currently, only n-d continuous multi-channel arrays are supported.
  • atlabel: attribute name.

Note: The attribute MUST exist, otherwise CV_Error() is called. Use atexists() to check if it exists beforehand.

§See also

atexists, atdelete, atwrite

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.

Implementors§