MRPT logo

mrpt::utils::CMRPTImageFloat Class Reference

In this class a grayscale image can be stored with float-type pixels. More...

#include <mrpt/utils/CMRPTImageFloat.h>

Inheritance diagram for mrpt::utils::CMRPTImageFloat:

mrpt::utils::CSerializable mrpt::utils::CMRPTCanvas

List of all members.

Public Member Functions

void setPixel (int x, int y, size_t color)
 Changes the value of the pixel (x,y).
void resize (size_t width, size_t height)
 Resize the buffer "img" to accomodate a new image size.
void setSize (size_t width, size_t height)
 Resize the buffer "img" to accomodate a new image size.
 CMRPTImageFloat (size_t width=1, size_t height=1)
 Default constructor:.
 CMRPTImageFloat (const CMRPTImageFloat &o)
 Copy constructor:.
 CMRPTImageFloat (const math::CMatrixFloat &o)
 Copy constructor from a matrix with values in the range [0,1]:.
 CMRPTImageFloat (const math::CMatrixDouble &o)
 Copy constructor from a matrix with values in the range [0,1]:.
 CMRPTImageFloat (const CMRPTImage &o)
 Copy constructor from a CMRPTImage.
void operator= (const CMRPTImageFloat &o)
 Copy operator.
void operator= (const CMRPTImage &o)
 Copy operator.
void operator= (const math::CMatrixFloat &o)
 Copy operator from a float matrix.
void operator= (const math::CMatrixDouble &o)
 Copy operator from a double matrix.
virtual ~CMRPTImageFloat ()
 Destructor:.
size_t getWidth () const
 Returns the width of the image in pixels.
size_t getHeight () const
 Returns the height of the image in pixels.
void getAsMatrix (math::CMatrixFloat &outMatrix) const
 Returns a matrix CMatrix representation of the image.
bool loadFromFile (const std::string &fileName)
 Loads the image from a gray-scale image file.
bool saveToFile (const std::string &fileName, bool verticalFlip=false) const
 Save the image to a file in a format given by the file extension.
void saveToTextFile (const std::string &fileName) const
 Save to a text file, loadable from matlab.
void adjustImageRange (float min=0.0f, float max=1.0f)
 Adjusts the range of the values in the image, such as the minimum and maximum values are the given ones.
float * operator() (size_t col, size_t row) const
 Returns a pointer to a given pixel.
CMRPTImageFloat operator* (const CMRPTImageFloat &im2)
 Point-wise product of CMRPTImageFloat images by FAMD, JAN-2007.
CMRPTImageFloat operator+ (const CMRPTImageFloat &im2)
 Point-wise addition of CMRPTImageFloat images by FAMD, JAN-2007.
CMRPTImageFloat operator- (const CMRPTImageFloat &im2)
 Point-wise substraction of CMRPTImageFloat images by FAMD, JAN-2007.
CMRPTImageFloat operator^ (int exp)
 Point-wise scalar power of CMRPTImageFloat images by FAMD, JAN-2007.
void scaleHalf ()
 Substitutes this image with a new one scaled down to half its original size.

Protected Attributes

float * m_img
 Data members.
size_t m_width
 The image size:.
size_t m_height

Friends

class CMRPTImage


Detailed Description

In this class a grayscale image can be stored with float-type pixels.

I/O is supported as conversion to a byte-type pixels "CMRPTImage", and as binary dump using the CSerializable interface(<< and >> operators), just as most objects in the MRPT library. This format is not compatible with any standarized image format.
Additional notes:

There is a "=" operator for converting between the classes "CMRPTImage" and "CMRPTImageFloat".

See also:
CMRPTImage, CSerializable

Definition at line 57 of file CMRPTImageFloat.h.


Constructor & Destructor Documentation

mrpt::utils::CMRPTImageFloat::CMRPTImageFloat ( size_t  width = 1,
size_t  height = 1 
)

Default constructor:.

mrpt::utils::CMRPTImageFloat::CMRPTImageFloat ( const CMRPTImageFloat o  ) 

Copy constructor:.

mrpt::utils::CMRPTImageFloat::CMRPTImageFloat ( const math::CMatrixFloat o  ) 

Copy constructor from a matrix with values in the range [0,1]:.

mrpt::utils::CMRPTImageFloat::CMRPTImageFloat ( const math::CMatrixDouble o  ) 

Copy constructor from a matrix with values in the range [0,1]:.

mrpt::utils::CMRPTImageFloat::CMRPTImageFloat ( const CMRPTImage o  ) 

Copy constructor from a CMRPTImage.

virtual mrpt::utils::CMRPTImageFloat::~CMRPTImageFloat (  )  [virtual]

Destructor:.


Member Function Documentation

void mrpt::utils::CMRPTImageFloat::adjustImageRange ( float  min = 0.0f,
float  max = 1.0f 
)

Adjusts the range of the values in the image, such as the minimum and maximum values are the given ones.

void mrpt::utils::CMRPTImageFloat::getAsMatrix ( math::CMatrixFloat outMatrix  )  const

Returns a matrix CMatrix representation of the image.

The output matrix will contain at its (r,c) element the pixel at the r'th row (y coordinate), and c'th column (x coordinate)

size_t mrpt::utils::CMRPTImageFloat::getHeight (  )  const [virtual]

Returns the height of the image in pixels.

Implements mrpt::utils::CMRPTCanvas.

size_t mrpt::utils::CMRPTImageFloat::getWidth (  )  const [virtual]

Returns the width of the image in pixels.

Implements mrpt::utils::CMRPTCanvas.

bool mrpt::utils::CMRPTImageFloat::loadFromFile ( const std::string &  fileName  ) 

Loads the image from a gray-scale image file.

See CMRPTImage::loadFromFile for supported formats

Returns:
False on any error

float* mrpt::utils::CMRPTImageFloat::operator() ( size_t  col,
size_t  row 
) const

Returns a pointer to a given pixel.

The coordinate origin is pixel(0,0)=top-left corner of the image.

Exceptions:
std::exception On pixel coordinates out of bounds

CMRPTImageFloat mrpt::utils::CMRPTImageFloat::operator* ( const CMRPTImageFloat im2  ) 

Point-wise product of CMRPTImageFloat images by FAMD, JAN-2007.

CMRPTImageFloat mrpt::utils::CMRPTImageFloat::operator+ ( const CMRPTImageFloat im2  ) 

Point-wise addition of CMRPTImageFloat images by FAMD, JAN-2007.

CMRPTImageFloat mrpt::utils::CMRPTImageFloat::operator- ( const CMRPTImageFloat im2  ) 

Point-wise substraction of CMRPTImageFloat images by FAMD, JAN-2007.

void mrpt::utils::CMRPTImageFloat::operator= ( const math::CMatrixDouble o  ) 

Copy operator from a double matrix.

void mrpt::utils::CMRPTImageFloat::operator= ( const math::CMatrixFloat o  ) 

Copy operator from a float matrix.

void mrpt::utils::CMRPTImageFloat::operator= ( const CMRPTImage o  ) 

Copy operator.

void mrpt::utils::CMRPTImageFloat::operator= ( const CMRPTImageFloat o  ) 

Copy operator.

CMRPTImageFloat mrpt::utils::CMRPTImageFloat::operator^ ( int  exp  ) 

Point-wise scalar power of CMRPTImageFloat images by FAMD, JAN-2007.

void mrpt::utils::CMRPTImageFloat::resize ( size_t  width,
size_t  height 
)

Resize the buffer "img" to accomodate a new image size.

bool mrpt::utils::CMRPTImageFloat::saveToFile ( const std::string &  fileName,
bool  verticalFlip = false 
) const

Save the image to a file in a format given by the file extension.

If "verticalFlip" is true, the image is inverted vertically See CMRPTImage::saveToFile for supported formats

Returns:
False on any error

void mrpt::utils::CMRPTImageFloat::saveToTextFile ( const std::string &  fileName  )  const

Save to a text file, loadable from matlab.

void mrpt::utils::CMRPTImageFloat::scaleHalf (  ) 

Substitutes this image with a new one scaled down to half its original size.

void mrpt::utils::CMRPTImageFloat::setPixel ( int  x,
int  y,
size_t  color 
) [virtual]

Changes the value of the pixel (x,y).

Pixel coordinates starts at the left-top corner of the image, and start in (0,0). The meaning of the parameter "color" depends on the implementation: it will usually be a 24bit RGB value (0x00RRGGBB), but it can also be just a 8bit gray level. This method must support (x,y) values OUT of the actual image size without neither raising exceptions, nor leading to memory access errors.

Implements mrpt::utils::CMRPTCanvas.

void mrpt::utils::CMRPTImageFloat::setSize ( size_t  width,
size_t  height 
)

Resize the buffer "img" to accomodate a new image size.

Initialize all images pixels to zero. by AJOGD @ JAN-2007


Friends And Related Function Documentation

friend class CMRPTImage [friend]

Definition at line 59 of file CMRPTImageFloat.h.


Member Data Documentation

Definition at line 70 of file CMRPTImageFloat.h.

Data members.

Definition at line 66 of file CMRPTImageFloat.h.

The image size:.

Definition at line 70 of file CMRPTImageFloat.h.




Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN: at Sun Aug 9 21:47:23 CEST 2009