the generic image class More...
#include <img_image.h>
Public Member Functions | |
int | channels () const |
get the number of channels of the image | |
ScalarType * | dataValues () const |
get a const pointer to the image databuffer | |
int | dataValuesSize () const |
get the size of the image databuffer | |
void | deleteData () |
delete the image data | |
void | getPixel (int x, int y, ScalarType(&ret_pixel)[Channels]) const |
get all the values of a pixel | |
void | getPixelAsClamped (int x, int y, ScalarType(&ret_pixel)[Channels]) const |
get all the values of a pixel, clamping if the coordinates are out of bounds | |
ScalarType | getValue (int x, int y, int channel) const |
get a single value of a pixel | |
float | getValueAsClamped (int x, int y, int channel) const |
get a single value of a pixel, clamping if the coordinates are out of bounds | |
int | height () const |
get the height of the image | |
Image (int arg_width, int arg_height) | |
blank image constructor | |
template<typename OtherScalarType , bool OtherSafe> | |
Image (const Image< Channels, OtherScalarType, OtherSafe > &image) | |
(deep) copy constructor when some template parameters differs | |
Image (const Image< Channels, ScalarType, Safe > &image) | |
(deep) copy constructor when all template parameters matches | |
Image () | |
default image constructor | |
bool | isInside (float x, float y) const |
checks if the given float coordinates are inside the image bounds | |
bool | isInside (int x, int y) const |
checks if the given coordinates are inside the image bounds | |
bool | isValid () const |
checks if the image has been initialized | |
void | nearestPixel (float x, float y, ScalarType(&ret_pixel)[Channels]) const |
get all the values of a pixel, rounding the floating coordinates to the nearest pixel | |
template<typename OtherScalarType , bool OtherSafe> | |
Image< Channels, ScalarType, Safe > & | operator= (const Image< Channels, OtherScalarType, OtherSafe > &image) |
assignment operator (deep copy) | |
void | setHeight (int height) |
set the height of the image | |
void | setPixel (int x, int y, const ScalarType(&pixel)[Channels]) |
set all the values of a pixel | |
void | setRawValue (int i, ScalarType value) |
set a value in the image databuffer | |
void | setValue (int x, int y, int channel, ScalarType value) |
set a single value of a pixel | |
void | setValues (ScalarType *data) |
set the image databuffer | |
void | setWidth (int width) |
set the width of the image | |
void | setZero (int arg_width, int arg_height) |
blanks and change the image dimensions | |
int | width () const |
get the width of the image | |
~Image () | |
the destructor | |
Public Attributes | |
ImgAttributes< ScalarType > | attributes |
the auxiliary structured attribute that contains all the metadata information. | |
Private Attributes | |
ScalarType * | _data |
data buffer | |
int | _height |
height of the image | |
int | _width |
width of the image |
the generic image class
The image class is templated over three parameters:
The image data is packed by the pixel, to optimize multichannel processing efficiency. The image class interface is restricted to pixel and metadata access, processing and I/O are entirely delegated to external functions. The data is accessible in multiple ways: value and pixel wise, using float coordinates with nearest and bilinear interpolation, viewing the image with clamping, direct access to the data and so on.
An auxiliary structured attribute contains all the metadata information, currently this data consists in the specification of the numeric range of the values, the image color space, the white point and the gamma compression of the image. The various functions checks these data before processing, failing if the image is not compatible with the operation in course.
Definition at line 26 of file img_image.h.
img::Image< Channels, ScalarType, Safe >::Image | ( | ) | [inline] |
default image constructor
Creates a 0 x 0 pixel image with no data and default attributes
Definition at line 49 of file img_image.h.
img::Image< Channels, ScalarType, Safe >::Image | ( | const Image< Channels, ScalarType, Safe > & | image | ) | [inline] |
(deep) copy constructor when all template parameters matches
An explicit copy constructor is needed because when all template parameters matches the templated copy constructor is not consideredand and a wrong copy constructor is synthetized by compiler.
image | the image to be copied |
Definition at line 62 of file img_image.h.
img::Image< Channels, ScalarType, Safe >::Image | ( | const Image< Channels, OtherScalarType, OtherSafe > & | image | ) | [inline] |
(deep) copy constructor when some template parameters differs
image | the image to be copied |
Definition at line 88 of file img_image.h.
img::Image< Channels, ScalarType, Safe >::Image | ( | int | arg_width, | |
int | arg_height | |||
) | [inline] |
blank image constructor
Creates an arg_width x arg_height pixel image with 0-valued data and default attributes
arg_width | the width of the blank image | |
arg_height | the height of the blank image |
Definition at line 120 of file img_image.h.
img::Image< Channels, ScalarType, Safe >::~Image | ( | ) | [inline] |
the destructor
Definition at line 138 of file img_image.h.
int img::Image< Channels, ScalarType, Safe >::channels | ( | ) | const [inline] |
get the number of channels of the image
Definition at line 492 of file img_image.h.
ScalarType* img::Image< Channels, ScalarType, Safe >::dataValues | ( | ) | const [inline] |
get a const pointer to the image databuffer
Definition at line 428 of file img_image.h.
int img::Image< Channels, ScalarType, Safe >::dataValuesSize | ( | ) | const [inline] |
get the size of the image databuffer
Definition at line 437 of file img_image.h.
void img::Image< Channels, ScalarType, Safe >::deleteData | ( | ) | [inline] |
delete the image data
Delete the current image data and create an 0 x 0 pixel image with no data.
Definition at line 209 of file img_image.h.
void img::Image< Channels, ScalarType, Safe >::getPixel | ( | int | x, | |
int | y, | |||
ScalarType(&) | ret_pixel[Channels] | |||
) | const [inline] |
get all the values of a pixel
x | the horizontal coordinate of the pixel | |
y | the vertical coordinate of the pixel | |
ret_pixel | return parameter that is filled with the pixel values |
Definition at line 226 of file img_image.h.
void img::Image< Channels, ScalarType, Safe >::getPixelAsClamped | ( | int | x, | |
int | y, | |||
ScalarType(&) | ret_pixel[Channels] | |||
) | const [inline] |
get all the values of a pixel, clamping if the coordinates are out of bounds
x | the horizontal coordinate of the pixel | |
y | the vertical coordinate of the pixel | |
ret_pixel | return parameter that is filled with the pixel values |
Definition at line 310 of file img_image.h.
ScalarType img::Image< Channels, ScalarType, Safe >::getValue | ( | int | x, | |
int | y, | |||
int | channel | |||
) | const [inline] |
get a single value of a pixel
x | the horizontal coordinate of the pixel | |
y | the vertical coordinate of the pixel | |
channel | the channel index |
Definition at line 267 of file img_image.h.
float img::Image< Channels, ScalarType, Safe >::getValueAsClamped | ( | int | x, | |
int | y, | |||
int | channel | |||
) | const [inline] |
get a single value of a pixel, clamping if the coordinates are out of bounds
x | the horizontal coordinate of the pixel | |
y | the vertical coordinate of the pixel | |
channel | the channel index |
Definition at line 322 of file img_image.h.
int img::Image< Channels, ScalarType, Safe >::height | ( | ) | const [inline] |
get the height of the image
Definition at line 390 of file img_image.h.
bool img::Image< Channels, ScalarType, Safe >::isInside | ( | float | x, | |
float | y | |||
) | const [inline] |
checks if the given float coordinates are inside the image bounds
x | the horizontal coordinate | |
y | the vertical coordinate |
Definition at line 474 of file img_image.h.
bool img::Image< Channels, ScalarType, Safe >::isInside | ( | int | x, | |
int | y | |||
) | const [inline] |
checks if the given coordinates are inside the image bounds
x | the horizontal coordinate | |
y | the vertical coordinate |
Definition at line 463 of file img_image.h.
bool img::Image< Channels, ScalarType, Safe >::isValid | ( | ) | const [inline] |
checks if the image has been initialized
Definition at line 483 of file img_image.h.
void img::Image< Channels, ScalarType, Safe >::nearestPixel | ( | float | x, | |
float | y, | |||
ScalarType(&) | ret_pixel[Channels] | |||
) | const [inline] |
get all the values of a pixel, rounding the floating coordinates to the nearest pixel
x | the horizontal coordinate of the pixel | |
y | the vertical coordinate of the pixel | |
ret_pixel | return parameter that is filled with the pixel values |
Definition at line 333 of file img_image.h.
Image< Channels,ScalarType,Safe>& img::Image< Channels, ScalarType, Safe >::operator= | ( | const Image< Channels, OtherScalarType, OtherSafe > & | image | ) | [inline] |
assignment operator (deep copy)
image | the image to be assigned to this instance |
Definition at line 155 of file img_image.h.
void img::Image< Channels, ScalarType, Safe >::setHeight | ( | int | height | ) | [inline] |
set the height of the image
height | the new height of the image |
Definition at line 414 of file img_image.h.
void img::Image< Channels, ScalarType, Safe >::setPixel | ( | int | x, | |
int | y, | |||
const ScalarType(&) | pixel[Channels] | |||
) | [inline] |
set all the values of a pixel
x | the horizontal coordinate of the pixel | |
y | the vertical coordinate of the pixel | |
pixel | the pixel values that are assigned to the pixel |
Definition at line 246 of file img_image.h.
void img::Image< Channels, ScalarType, Safe >::setRawValue | ( | int | i, | |
ScalarType | value | |||
) | [inline] |
set a value in the image databuffer
i | the index of the databuffer | |
value | the value to set in the i position of the databuffer |
Definition at line 503 of file img_image.h.
void img::Image< Channels, ScalarType, Safe >::setValue | ( | int | x, | |
int | y, | |||
int | channel, | |||
ScalarType | value | |||
) | [inline] |
set a single value of a pixel
x | the horizontal coordinate of the pixel | |
y | the vertical coordinate of the pixel | |
channel | the channel index | |
value | the value that is assigned to the channel at the pixel |
Definition at line 289 of file img_image.h.
void img::Image< Channels, ScalarType, Safe >::setValues | ( | ScalarType * | data | ) | [inline] |
set the image databuffer
data | a pointer to the new image databuffer |
Definition at line 448 of file img_image.h.
void img::Image< Channels, ScalarType, Safe >::setWidth | ( | int | width | ) | [inline] |
set the width of the image
width | the new width of the image |
Definition at line 400 of file img_image.h.
void img::Image< Channels, ScalarType, Safe >::setZero | ( | int | arg_width, | |
int | arg_height | |||
) | [inline] |
blanks and change the image dimensions
Delete the current image data and create an arg_width x arg_height pixel image with 0-valued data and default attributes
arg_width | the width of the blank image | |
arg_height | the height of the blank image |
Definition at line 184 of file img_image.h.
int img::Image< Channels, ScalarType, Safe >::width | ( | ) | const [inline] |
get the width of the image
Definition at line 381 of file img_image.h.
ScalarType* img::Image< Channels, ScalarType, Safe >::_data [private] |
data buffer
Definition at line 37 of file img_image.h.
int img::Image< Channels, ScalarType, Safe >::_height [private] |
height of the image
Definition at line 35 of file img_image.h.
int img::Image< Channels, ScalarType, Safe >::_width [private] |
width of the image
Definition at line 33 of file img_image.h.
ImgAttributes<ScalarType> img::Image< Channels, ScalarType, Safe >::attributes |
the auxiliary structured attribute that contains all the metadata information.
Definition at line 42 of file img_image.h.