Container for images This class represent any generic image for any size, and basic type and any nb channel.
|
Public Member Functions |
| | Image () |
| | Constructor to build a 0 size image.
|
| | Image (const size_t width, const size_t height, const size_t nbChannel, T *buffer=0) |
| | Constructor to build an allocated empty image or an image from a raw data buffer.
|
| | Image (const Image< T > &i) |
| | Copy Constructor.
|
| virtual | ~Image () |
| | dealoccates image data
|
| virtual T * | begin () const |
| | getting the raw data of the image
|
| virtual T * | end () const |
| | getting the end of raw data of the image
|
| virtual size_t | width () const |
| | getting the width of the image
|
| virtual size_t | height () const |
| | getting the height of the image
|
| virtual size_t | nbChannel () const |
| | getting the number of channel of the image
|
| virtual size_t | size () const |
| | getting the total size of the image
|
| virtual T * | operator() (const unsigned int x, const unsigned int y) const |
| | get pointer on the asked pixel
|
| virtual T * | at (const unsigned int x, const unsigned int y) const |
| | get pointer on the asked pixel (with bounds checking).
|
| virtual T & | operator() (const unsigned int x, const unsigned int y, const unsigned int d) |
| | get component value of the asked pixel
|
| virtual T & | at (const unsigned int x, const unsigned int y, const unsigned int d) |
| | get component value of the asked pixel (with bounds checking).
|
| virtual const T & | operator() (const unsigned int x, const unsigned int y, const unsigned int d) const |
| | get component value of the asked pixel
|
| virtual const T & | at (const unsigned int x, const unsigned int y, const unsigned int d) const |
| | get component value of the asked pixel (with bounds checking) This function behaves the same than the operator() but checks if indices are valid respect to the size of
|
| virtual Image< T > & | operator= (const Image &i) |
| | copy on this image the content of another if they have the same resolution and number of channel; if the calling image have width = height = 0, this function create the adequat memory, else throws an exception.
|
| void | fill (const T &value) |
| | fill all the pixels component to the parameter value
|
| void | flip () |
| | flip the image vertically
|
| void | flop () |
| | flop the image horizontally
|
| void | rotate () |
| | rotate the image by PI/2
|
| void | rotateInverse () |
| | rotate the image by -PI/2
|
| void | getSubImage (unsigned int x, unsigned int y, Image< T > &sub) const |
| | Get a sub part of the image.
|
| void | setSubImage (unsigned int x, unsigned int y, const Image< T > &sub) |
| | Set a sub part of the image.
|
Protected Member Functions |
| void | initRows () |
| | allocate and initialize the rows array
|
Protected Attributes |
| T * | data |
| | raw data of the image
|
| T ** | rows |
| | pointers on each row of the image on the raw date
|
| T * | begin_ |
| | pointer on the begining of raw data
|
| T * | end_ |
| | pointer on the end of raw data
|
| size_t | imageWidth |
| | width of the image
|
| size_t | imageHeight |
| | height of the image
|
| size_t | imageNbChannel |
| | nb channel of the image
|
| size_t | imageSize |
| | Total size of the image (w*h*d).
|
Friends |
| int | kn::loadPPM (Image< unsigned char > &res, const std::string &filename) |
| | Friend function for PPM file format loader.
|
| int | kn::loadTGA (Image< unsigned char > &res, const std::string &filename) |
| | Friend function for TGA file format loader.
|
| int | kn::loadJPG (Image< unsigned char > &res, const std::string &filename) |
| | Friend function for JPG file format loader.
|
| int | kn::loadHDR (Image< float > &res, const std::string &filename) |
| | Friend function for HDR file format loader.
|
Container for images This class represent any generic image for any size, and basic type and any nb channel.
The data of the image is represented as a unidimensionnal array of the basic typename. Moreover, we store the position of any row allowing a fast acces to any pixel of the image. The first row is the top row and each row is stored from left to right.