Public Member Functions | Public Attributes | Private Member Functions | List of all members
CFloatImage Class Reference

Data structure for the representation of any image type (arbitrary number of channels) using the data type float. More...

#include <FloatImage.h>

Public Member Functions

 CFloatImage ()
 The default constructor. More...
 
 CFloatImage (int nImageWidth, int nImageHeight, int nNumberOfChannels, bool bHeaderOnly=false)
 Constructor for creating an image of a specific size and type. More...
 
 CFloatImage (const CFloatImage *pImage, bool bHeaderOnly=false)
 Constructor for creating an image given a pointer to a CByteImage. More...
 
 CFloatImage (const CFloatImage &image, bool bHeaderOnly=false)
 Copy constructor. More...
 
bool IsCompatible (const CFloatImage *pImage) const
 Checks whether two images are compatible or not. More...
 
bool LoadFromFile (const char *pFileName)
 Loads an image from a file. More...
 
bool SaveToFile (const char *pFileName) const
 Saves an image to a file. More...
 
 ~CFloatImage ()
 The destructor. More...
 

Public Attributes

int bytesPerPixel
 The number of bytes used for encoding one pixel. More...
 
int height
 The height of the image in pixels. More...
 
bool m_bOwnMemory
 Flag signaling if memory is to be freed or not. More...
 
int numberOfChannels
 Number of channels per pixel. More...
 
float * pixels
 The pointer to the the pixels. More...
 
int width
 The width of the image in pixels. More...
 

Private Member Functions

void FreeMemory ()
 

Detailed Description

Data structure for the representation of any image type (arbitrary number of channels) using the data type float.

Images of type CFloatImage are capable to represent high dynamic range images, however, it cannot be directly loaded from or stored to files nor visualized directly in GUIs. Since CByteImages is the central image type, loading, storage and visualization will require a conversion from CByteFloat into CByteImage. The image data is represented as a linear array of pixels, always starting from the top left corner and stored row wise.

In the case of gray scale/single channel images , the gray scale value of each pixel is encoded in one float (0.0: black, 255.0: white, nuances in between). In the case of 3-channel color images the color information of each pixel is encoded in three floats (first: red, second: green, third: blue).

Definition at line 62 of file FloatImage.h.

Constructor & Destructor Documentation

CFloatImage::CFloatImage ( )

The default constructor.

The default constructor sets all member variables to zero, i.e. after construction no valid image is represented.

This constructor is useful in case an image is to be loaded from a file at a later point, e.g. with the method LoadFromFile(const char *).

Definition at line 70 of file FloatImage.cpp.

CFloatImage::CFloatImage ( int  nImageWidth,
int  nImageHeight,
int  nNumberOfChannels,
bool  bHeaderOnly = false 
)

Constructor for creating an image of a specific size and type.

With this constructor, an instance of CFloatImage is created, given the desired image resolution and image type. The contents of the image are not initialized, i.e. are undefined after creation.

Parameters
[in]nImageWidthThe desired width of the image in pixels. Must be > 0.
[in]nImageHeightThe desired height of the image in pixels. Must be > 0.
[in]nNumberOfChannelsThe desired number of channels of each pixel.
[in]bHeaderOnlyIf set to false (default value), memory is allocated for the pixels. If set to true, no memory is allocated for the pixels. The latter can be useful for assigning image data from other sources (see e.g. implementation of ImageAccessCV::LoadFromFile). Note that if bHeaderOnly is set to true, the member variable CFloatImage::m_bOwnMemory is set to false so that memory assigned to the member variable CFloatImage::pixels is not freed throughout re-initialization/destruction, i.e. freeing memory must be handled by the caller in this case.

Definition at line 80 of file FloatImage.cpp.

CFloatImage::CFloatImage ( const CFloatImage pImage,
bool  bHeaderOnly = false 
)

Constructor for creating an image given a pointer to a CByteImage.

This constructor creates a new instance with the same properties as the image provided by the parameter 'pImage'. Note that the contents of the image are not copied. Use ImageProcessor::CopyImage(const CFloatImage*, CFloatImage*, const MyRegion*, bool) for copying image contents.

Parameters
[in]pImageThe template image.
[in]bHeaderOnlyIf set to false (default value), memory is allocated for the pixels. If set to true, no memory is allocated for the pixels. The latter can be useful for assigning image data from other sources (see e.g. implementation of ImageAccessCV::LoadFromFile). Note that if bHeaderOnly is set to true, the member variable CFloatImage::m_bOwnMemory is set to false so that memory assigned to the member variable CFloatImage::pixels is not freed throughout re-initialization/destruction, i.e. freeing memory must be handled by the caller in this case.

Definition at line 119 of file FloatImage.cpp.

CFloatImage::CFloatImage ( const CFloatImage image,
bool  bHeaderOnly = false 
)

Copy constructor.

This copy constructor creates a new instance with the same properties as the image provided by the parameter 'image'. Note that the contents of the image are not copied. Use ImageProcessor::CopyImage(const CFloatImage*, CFloatImage*, const MyRegion*, bool) for copying image contents.

Parameters
[in]imageThe template image.
[in]bHeaderOnlyIf set to false (default value), memory is allocated for the pixels. If set to true, no memory is allocated for the pixels. The latter can be useful for assigning image data from other sources (see e.g. implementation of ImageAccessCV::LoadFromFile). Note that if bHeaderOnly is set to true, the member variable CFloatImage::m_bOwnMemory is set to false so that memory assigned to the member variable CFloatImage::pixels is not freed throughout re-initialization/destruction, i.e. freeing memory must be handled by the caller in this case.

Definition at line 100 of file FloatImage.cpp.

CFloatImage::~CFloatImage ( )

The destructor.

Definition at line 138 of file FloatImage.cpp.

Member Function Documentation

void CFloatImage::FreeMemory ( )
private

Definition at line 148 of file FloatImage.cpp.

bool CFloatImage::IsCompatible ( const CFloatImage pImage) const

Checks whether two images are compatible or not.

Parameters
[in]pImagePointer to the image to be checked compatibility with.
Returns
true if the attributes width, height and type are equal, otherwise returns false.

Definition at line 160 of file FloatImage.cpp.

bool CFloatImage::LoadFromFile ( const char *  pFileName)

Loads an image from a file.

Loads an image from a BMP, PGM, or PPM file. The image type is recognized by the file name ending (.bmp, .pgm, .ppm or .BMP, .PGM, .PPM).

If an image is already loaded, reinitialization is performed automatically.

Parameters
[in]pFileNameThe path to the image file to be loaded.
Returns
true on success and false on failure.

Definition at line 166 of file FloatImage.cpp.

bool CFloatImage::SaveToFile ( const char *  pFileName) const

Saves an image to a file.

Saves the current image to a BMP, PGM, or PPM file. The desired image type is recognized by the file name ending (.bmp, .pgm, .ppm or .BMP, .PGM, .PPM).

Be careful to provide the correct file ending for PGM/PPM files: .PGM for grayscale images or .PPM for RGB images.

Parameters
[in]pFileNameThe path to the destination file.
Returns
true on success and false on failure.

Definition at line 200 of file FloatImage.cpp.

Member Data Documentation

int CFloatImage::bytesPerPixel

The number of bytes used for encoding one pixel.

This information is redundant with the number of channels.

This variable should only be read. It should only be modified by external image loaders (e.g. ImageAccessCV::LoadFromFile).

Definition at line 193 of file FloatImage.h.

int CFloatImage::height

The height of the image in pixels.

This variable should only be read. It should only be modified by external image loaders (e.g. ImageAccessCV::LoadFromFile).

Definition at line 184 of file FloatImage.h.

bool CFloatImage::m_bOwnMemory

Flag signaling if memory is to be freed or not.

This flag signals whether the image memory must be freed throughut re-initiallization/destruction or not.

This flag is usually for internal use only. It should only be modified by external image loaders (e.g. ImageAccessCV::LoadFromFile).

Definition at line 221 of file FloatImage.h.

int CFloatImage::numberOfChannels

Number of channels per pixel.

The number of channels per pixel of the image specifies its encoding.

This variable should only be read. It should only be modified by external image loaders (e.g. ImageAccessCV::LoadFromFile).

Definition at line 212 of file FloatImage.h.

float* CFloatImage::pixels

The pointer to the the pixels.

This is the pointer pointing to the memory area containing the pixels of the image, starting from the top left corner and stored row wise (see above for type dependent information).

This variable should only be read. It should only be modified by external image loaders (e.g. ImageAccessCV::LoadFromFile).

Definition at line 203 of file FloatImage.h.

int CFloatImage::width

The width of the image in pixels.

Padding is not implemented (on purpose).

This variable should only be read. It should only be modified by external image loaders (e.g. ImageAccessCV::LoadFromFile).

Definition at line 177 of file FloatImage.h.


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


asr_ivt
Author(s): Allgeyer Tobias, Hutmacher Robin, Kleinert Daniel, Meißner Pascal, Scholz Jonas, Stöckle Patrick
autogenerated on Mon Dec 2 2019 03:47:28