Image Utilities (IU)
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Groups Pages
Data Structures | Public Member Functions
iu::OpenEXRInputFile Class Reference

The OpenEXRInputFile class interfaces the OpenEXR library with the Imageutilities. More...

#include <openexrio.h>

Data Structures

struct  Channel
 The Channel struct contains the name (string) and datatype (string) of a channel. More...
 

Public Member Functions

 OpenEXRInputFile (const std::string &filename)
 OpenEXRInputFile constructor. Opens a file for reading. More...
 
iu::Size< 2 > get_size ()
 return size of the OpenEXR image More...
 
std::vector< Channelget_channels ()
 Get a list of all channels in the file. More...
 
std::vector< std::string > get_attributes ()
 Get a list of all attributes (attachements) in the file. More...
 
void read_channel (const std::string &name, ImageCpu_32u_C1 &img)
 Search for a channel name and read its contents into img. The size of img must match the size returned by get_size. More...
 
void read_channel (const std::string &name, ImageCpu_32f_C1 &img)
 Search for a channel name and read its contents into img. The size of img must match the size returned by get_size. More...
 
void read_channel_32f (const std::string &name, ImageCpu_32f_C1 &img)
 Convenience function to read into a float image regardless of channel data. If the channel contains uint32 data, it will be converted to float. More...
 
void read_channel (const std::string &name, ImageGpu_32u_C1 &img)
 read directly to a GPU-image More...
 
void read_channel (const std::string &name, ImageGpu_32f_C1 &img)
 read directly to a GPU-image More...
 
void read_channel_32f (const std::string &name, ImageGpu_32f_C1 &img)
 Convenience function to read into a GPU float image regardless of channel data. If the channel contains uint32 data, it will be converted to float. More...
 
void read_attribute (const std::string &name, Eigen::Ref< Eigen::Matrix3f > mat)
 Read a 3x3 matrix attribute into an Eigen::Matrix3f. More...
 
void read_attribute (const std::string &name, Eigen::Ref< Eigen::Matrix4f > mat)
 Read a 4x4 matrix attribute into an Eigen::Matrix4f. More...
 

Detailed Description

The OpenEXRInputFile class interfaces the OpenEXR library with the Imageutilities.

After construction various information (image size, channels, attributes) can be queried which allows to construct the corresponding ImageCpu* variables needed to call the read_channel method. convenience methods to read directly to GPU-images are provided as well.

Constructor & Destructor Documentation

iu::OpenEXRInputFile::OpenEXRInputFile ( const std::string &  filename)

OpenEXRInputFile constructor. Opens a file for reading.

Parameters
filenamename of the file.

Member Function Documentation

std::vector<std::string> iu::OpenEXRInputFile::get_attributes ( )

Get a list of all attributes (attachements) in the file.

Returns
vector of attributes
std::vector<Channel> iu::OpenEXRInputFile::get_channels ( )
inline

Get a list of all channels in the file.

Returns
vector of Channel
iu::Size<2> iu::OpenEXRInputFile::get_size ( )
inline

return size of the OpenEXR image

Returns
iu::Size<2>
void iu::OpenEXRInputFile::read_attribute ( const std::string &  name,
Eigen::Ref< Eigen::Matrix3f >  mat 
)

Read a 3x3 matrix attribute into an Eigen::Matrix3f.

Parameters
nameattribute name (must be a 3x3 matrix)
matRef to Eigen::Matrix3f
void iu::OpenEXRInputFile::read_attribute ( const std::string &  name,
Eigen::Ref< Eigen::Matrix4f >  mat 
)

Read a 4x4 matrix attribute into an Eigen::Matrix4f.

Parameters
nameattribute name (must be a 4x4 matrix)
matRef to Eigen::Matrix4f
void iu::OpenEXRInputFile::read_channel ( const std::string &  name,
ImageCpu_32u_C1 img 
)

Search for a channel name and read its contents into img. The size of img must match the size returned by get_size.

Parameters
namename of the channel. the channel must contain uint32 data.
imgAn image whose size matches that returned by get_size
void iu::OpenEXRInputFile::read_channel ( const std::string &  name,
ImageCpu_32f_C1 img 
)

Search for a channel name and read its contents into img. The size of img must match the size returned by get_size.

Parameters
namename of the channel. the channel must contain float data.
imgAn image whose size matches that returned by get_size
void iu::OpenEXRInputFile::read_channel ( const std::string &  name,
ImageGpu_32u_C1 img 
)

read directly to a GPU-image

Parameters
namename of the channel containing uint32 data
imgA GPU-image whose size matches that returned by get_size
void iu::OpenEXRInputFile::read_channel ( const std::string &  name,
ImageGpu_32f_C1 img 
)

read directly to a GPU-image

Parameters
namename of the channel containing float data
imgA GPU-image whose size matches that returned by get_size
void iu::OpenEXRInputFile::read_channel_32f ( const std::string &  name,
ImageCpu_32f_C1 img 
)

Convenience function to read into a float image regardless of channel data. If the channel contains uint32 data, it will be converted to float.

Parameters
namename of the channel
imgAn image whose size matches that returned by get_size
void iu::OpenEXRInputFile::read_channel_32f ( const std::string &  name,
ImageGpu_32f_C1 img 
)

Convenience function to read into a GPU float image regardless of channel data. If the channel contains uint32 data, it will be converted to float.

Parameters
namename of the channel
imgA GPU-image whose size matches that returned by get_size

The documentation for this class was generated from the following file: