PICCANTE
0.4
The hottest HDR imaging library!
|
The Image class stores an image as buffer of float. More...
#include <image.hpp>
Public Member Functions | |
Image () | |
the basic construct of an Image More... | |
Image (Image *imgIn, bool deepCopy) | |
Image embeds an existing image in the new image. More... | |
Image (std::string nameFile, LDR_type typeLoad) | |
Image loads an Image from a file on the disk. More... | |
Image (int width, int height, int channels) | |
Image creates an Image with a given size. More... | |
Image (float *color, int channels) | |
Image embeds an array of float inside an Image. More... | |
Image (int frames, int width, int height, int channels, float *data) | |
Image is a constructor which initializes an image defined by the input properties. More... | |
~Image () | |
Image destructor. This deallocates: data, dataUC, and dataRGBE. More... | |
void | allocate (int width, int height, int channels, int frames) |
allocate allocates memory for the pixel buffer. More... | |
void | allocateAux () |
allocateAux computes extra information after allocation; e.g. strides. More... | |
void | release () |
release frees allocated buffers. More... | |
void | copySubImage (Image *imgIn, int startX, int startY) |
copySubImage copies imgIn in the current image. The current image is written from (startX, startY). More... | |
void | scaleCosine () |
scaleCosine multiplies the current image by the vertical cosine assuming a longitude-latitude image. More... | |
void | flipH () |
FlipH flips horizontally the current image. More... | |
void | flipV () |
FlipV flips vertically the current image. More... | |
void | flipHV () |
flipHV flips horizontally and vertically the current image. More... | |
void | flipVH () |
flipVH flips vertically and horizontally the current image. More... | |
void | rotate90CCW () |
rotate90CCW rotates 90 degrees counter-clockwise the current image. More... | |
void | rotate90CW () |
rotate90CW rotates 90 degrees clockwise the current image. More... | |
float | getDiagonalSize () |
getDiagonalSize More... | |
void | setZero () |
setZero sets data to 0.0f. More... | |
void | setRand (unsigned int seed) |
setRand More... | |
bool | isValid () |
isValid checks if the current image is valid, which means if they have an allocated buffer or not. More... | |
bool | isSimilarType (const Image *img) |
isSimilarType checks if the current image is similar to img; i.e. if they have the same width, height, frames, and channels. More... | |
void | assign (const Image *imgIn) |
assign More... | |
void | blend (Image *img, Image *weight) |
blend More... | |
void | minimum (Image *img) |
minimum is the minimum operator for Image. More... | |
void | maximum (Image *img) |
maximum is the maximum operator for Image. More... | |
void | applyFunction (float(*func)(float)) |
applyFunction is an operator that applies an input function to all values in data. More... | |
void | applyFunctionParam (float(*func)(float, std::vector< float > &), std::vector< float > ¶m) |
applyFunctionParam More... | |
BBox | getFullBox () |
getFullBox computes a full BBox for this image. More... | |
float * | getMaxVal (BBox *box, float *ret) |
getMaxVal computes the maximum value for the current Image. More... | |
float * | getMinVal (BBox *box, float *ret) |
getMinVal computes the minimum value for the current Image. More... | |
float * | getLogMeanVal (BBox *box, float *ret) |
getLogMeanVal computes the log mean for the current Image. More... | |
float * | getSumVal (BBox *box, float *ret) |
getSumVal sums values for the current Image. More... | |
float * | getMeanVal (BBox *box, float *ret) |
getMeanVal computes the mean for the current Image. More... | |
float * | getMomentsVal (int x0, int y0, int radius, float *ret) |
getMomentsVal computes the moments at pixel (x0, y0). More... | |
float * | getVarianceVal (float *meanVal, BBox *box, float *ret) |
getVarianceVal computes the variance for the current Image. More... | |
float * | getCovMtxVal (float *meanVal, BBox *box, float *ret) |
getCovMtxVal computes the convariance matrix for the current Image. More... | |
float * | getPercentileVal (float percentile, BBox *box, float *ret) |
getPercentileVal computes the n-th value given a percentile. More... | |
float * | getMedVal (BBox *box, float *ret) |
getPercentileVal computes the median value value given a percentile. More... | |
float | getDynamicRange (bool bRobust, float percentile) |
getDynamicRange computes the dynamic range of the image. More... | |
unsigned char * | getdataUC () |
getdataUC More... | |
float * | getColorSamples (float *samples, int &nSamples, float percentage) |
getColorSamples More... | |
int | size () const |
size computes the number of values. More... | |
int | sizeFrame () const |
size computes the number of values. More... | |
int | nPixels () const |
nPixels computes the number of pixels. More... | |
bool | checkCoordinates (int x, int y, int z=0) |
checkCoordinates checks (x, y, z) coordinates) if they are valid or not. More... | |
void | convertFromMask (bool *mask, int width, int height) |
convertFromMask converts a boolean mask into an Image. true is mapped to 1.0f, and false is mapped to 0.0f. More... | |
bool * | convertToMask (float *color, float threshold, bool cmp, bool *mask) |
convertToMask converts an Image into a boolean mask. More... | |
bool | getFlippedEXR () |
getFlippedEXR returns the flippedEXR flag. More... | |
void | removeSpecials () |
removeSpecials removes NaN and +/-Inf values and sets them to 0.0f. More... | |
void | clamp (float a, float b) |
clamp set data values in the range [a,b] More... | |
void | calculateStrides () |
calculateStrides computes the strides values for pixels, lines and frames. More... | |
float * | operator() (int x, int y, int t) |
operator () returns a pointer to a pixel at (x, y, t) More... | |
float * | operator() (int x, int y) |
operator () returns a pointer to a pixel at (x, y) More... | |
float * | operator() (float x, float y) |
operator () returns a pointer to a pixel at (x, y) with normalized coordinates (values in [0, 1]). More... | |
float * | getLL (float x, float y, float z) |
getLL returns a pointer to a pixel given a normalized direction and assuming longituted-latitude mapping of the image. More... | |
void | getNormalizedCoords (int x, int y, float &nx, float &ny) |
getNormalizedCoords computes normalized coordinates (nx, ny) of (x, y). More... | |
int | getAddress (int x, int y) |
getAddress calculates a memory address from (x, y) More... | |
int | getAddress (int x, int y, int t) |
getAddress calculates a memory address from (x, y, t) More... | |
void | reverseAddress (int ind, int &x, int &y) |
reverseAddress computes (x, y) given a memory address More... | |
Image * | allocateSimilarOne () |
allocateSimilarOne creates an Image with similar size of the calling instance. More... | |
void | allocateSimilarTo (Image *img) |
allocateSimilarTo allocate an Image with similar size of the passed by. More... | |
Image * | clone () const |
Clone creates a deep copy of the calling instance. More... | |
bool | Read (std::string nameFile, LDR_type typeLoad) |
Read opens an Image from a file on the disk. More... | |
bool | Write (std::string nameFile, LDR_type typeWrite, int writerCounter) |
Write saves an Image into a file on the disk. More... | |
void | changeOwnership (bool notOwned) |
changeOwnership More... | |
void | operator= (const Image &a) |
operator = More... | |
void | operator= (const float &a) |
operator = More... | |
void | operator+= (const float &a) |
operator += More... | |
Image | operator+ (const float &a) const |
operator + More... | |
void | operator+= (const Image &a) |
operator += More... | |
Image | operator+ (const Image &a) const |
operator + More... | |
void | operator*= (const float &a) |
operator *= More... | |
Image | operator* (const float &a) const |
operator * More... | |
void | operator*= (const Image &a) |
operator *= More... | |
Image | operator* (const Image &a) const |
operator * More... | |
void | operator-= (const float &a) |
operator -= More... | |
Image | operator- (const float &a) const |
operator - More... | |
void | operator-= (const Image &a) |
operator -= More... | |
Image | operator- (const Image &a) const |
operator - More... | |
void | operator/= (const float &a) |
operator /= More... | |
Image | operator/ (const float &a) const |
operator / More... | |
void | operator/= (const Image &a) |
operator /= More... | |
Image | operator/ (const Image &a) const |
operator / More... | |
float * | sort () |
sort More... | |
Public Attributes | |
float | exposure |
int | width |
int | height |
int | channels |
int | frames |
int | depth |
int | alpha |
int | tstride |
int | ystride |
int | xstride |
float | widthf |
float | width1f |
float | heightf |
float | height1f |
float | channelsf |
float | framesf |
float | frames1f |
std::string | nameFile |
float * | data |
data is the main buffer where pixel values are stored. More... | |
unsigned char * | dataUC |
dataUC is a buffer for rendering 8-bit images. More... | |
unsigned char * | dataRGBE |
dataRGBE is a buffer for rendering RGBE encoded images. More... | |
Protected Member Functions | |
void | setNULL () |
setNULL sets buffers values to NULL. More... | |
Protected Attributes | |
bool | flippedEXR |
int | readerCounter |
bool | notOwned |
BBox | fullBox |
LDR_type | typeLoad |
The Image class stores an image as buffer of float.
pic::Image::Image | ( | ) |
the basic construct of an Image
pic::Image::Image | ( | Image * | imgIn, |
bool | deepCopy | ||
) |
Image embeds an existing image in the new image.
imgIn | is the input image to embed. |
deepCopy | enables a deep copy of img into this. |
pic::Image::Image | ( | std::string | nameFile, |
LDR_type | typeLoad | ||
) |
Image loads an Image from a file on the disk.
nameFile | is the file name. |
typeLoad | is an option for LDR images only: LT_NOR means that the input image values will be normalized in [0,1]. LT_NOR_GAMMA means that the input image values will be normalized in [0,1], and gamma correction 2.2 will be removed. LT_NONE means that image values are not modified during the loading. |
The default value is LT_NOR_GAMMA assuming that we are storing normalized and linearized values in Image.
pic::Image::Image | ( | int | width, |
int | height, | ||
int | channels | ||
) |
pic::Image::Image | ( | float * | color, |
int | channels | ||
) |
pic::Image::Image | ( | int | frames, |
int | width, | ||
int | height, | ||
int | channels, | ||
float * | data | ||
) |
Image is a constructor which initializes an image defined by the input properties.
frames | is the number of temporal pixels. |
width | is the number of horizontal pixels. |
height | is the number of vertical pixels. |
channels | is the number of color channels. |
data | is a buffer of size frames * width * height * channels. If it is empty (set to NULL) a new buffer will be created. |
pic::Image::~Image | ( | ) |
Image destructor. This deallocates: data, dataUC, and dataRGBE.
void pic::Image::allocate | ( | int | width, |
int | height, | ||
int | channels, | ||
int | frames | ||
) |
allocate allocates memory for the pixel buffer.
width | is the number of horizontal pixels. |
height | is the number of vertical pixels. |
channels | is the number of color channels. |
frames | is the number of temporal pixels. |
void pic::Image::allocateAux | ( | ) |
allocateAux computes extra information after allocation; e.g. strides.
Image* pic::Image::allocateSimilarOne | ( | ) |
void pic::Image::allocateSimilarTo | ( | Image * | img | ) |
allocateSimilarTo allocate an Image with similar size of the passed by.
void pic::Image::applyFunction | ( | float(*)(float) | func | ) |
applyFunction is an operator that applies an input function to all values in data.
void pic::Image::applyFunctionParam | ( | float(*)(float, std::vector< float > &) | func, |
std::vector< float > & | param | ||
) |
applyFunctionParam
param |
void pic::Image::assign | ( | const Image * | imgIn | ) |
assign
imgIn |
|
inline |
calculateStrides computes the strides values for pixels, lines and frames.
|
inline |
changeOwnership
notOwned |
|
inline |
checkCoordinates checks (x, y, z) coordinates) if they are valid or not.
x | is the horizontal coordinate. |
y | is the vertical coordinate. |
z | is the temporal coordinate. |
void pic::Image::clamp | ( | float | a, |
float | b | ||
) |
clamp set data values in the range [a,b]
a | the minimum value. |
b | the maximum value. |
Image* pic::Image::clone | ( | ) | const |
Clone creates a deep copy of the calling instance.
void pic::Image::convertFromMask | ( | bool * | mask, |
int | width, | ||
int | height | ||
) |
convertFromMask converts a boolean mask into an Image. true is mapped to 1.0f, and false is mapped to 0.0f.
mask | is a buffer of boolean values with (width * height) elements. |
width | is the horizontal number of pixels. |
height | is the vertical number of pixels. |
bool* pic::Image::convertToMask | ( | float * | color, |
float | threshold, | ||
bool | cmp, | ||
bool * | mask | ||
) |
void pic::Image::copySubImage | ( | Image * | imgIn, |
int | startX, | ||
int | startY | ||
) |
copySubImage copies imgIn in the current image. The current image is written from (startX, startY).
imgIn | the image to be copied. |
startX | is the horizontal coordinate in pixels. |
startY | is the vertical coordinate in pixels. |
|
inline |
FlipH flips horizontally the current image.
|
inline |
flipHV flips horizontally and vertically the current image.
|
inline |
FlipV flips vertically the current image.
|
inline |
flipVH flips vertically and horizontally the current image.
|
inline |
getAddress calculates a memory address from (x, y)
x | is the horizontal coordinate in pixels |
y | is the vertical coordinate in pixels |
|
inline |
getAddress calculates a memory address from (x, y, t)
x | is the horizontal coordinate in pixels |
y | is the vertical coordinate in pixels |
t | is the temporal coordinate in pixels |
float* pic::Image::getColorSamples | ( | float * | samples, |
int & | nSamples, | ||
float | percentage | ||
) |
getColorSamples
samples | |
percentage |
float* pic::Image::getCovMtxVal | ( | float * | meanVal, |
BBox * | box, | ||
float * | ret | ||
) |
getCovMtxVal computes the convariance matrix for the current Image.
box | is the bounding box where to compute the function. If it is set to NULL the function will be computed on the entire image. |
ret | is an array where the function computations are stored. If it is set to NULL an array will be allocated. |
|
inline |
getdataUC
|
inline |
getDiagonalSize
float pic::Image::getDynamicRange | ( | bool | bRobust, |
float | percentile | ||
) |
getDynamicRange computes the dynamic range of the image.
bRobust | is a value that enables robust computation of the dynamic range using percentile. |
percentile | is the percentile value used when computing the dynamic range in a robust way. |
|
inline |
getFlippedEXR returns the flippedEXR flag.
BBox pic::Image::getFullBox | ( | ) |
|
inline |
getLL returns a pointer to a pixel given a normalized direction and assuming longituted-latitude mapping of the image.
x | the x-coordinate of the unit-vector |
y | the y-coordinate of the unit-vector |
z | the z-coordinate of the unit-vector |
float* pic::Image::getLogMeanVal | ( | BBox * | box, |
float * | ret | ||
) |
getLogMeanVal computes the log mean for the current Image.
box | is the bounding box where to compute the function. If it is set to NULL the function will be computed on the entire image. |
ret | is an array where the function computations are stored. If it is set to NULL an array will be allocated. |
float* pic::Image::getMaxVal | ( | BBox * | box, |
float * | ret | ||
) |
getMaxVal computes the maximum value for the current Image.
box | is the bounding box where to compute the function. If it is set to NULL the function will be computed on the entire image. |
ret | is an array where the function computations are stored. If it is set to NULL an array will be allocated. |
float* pic::Image::getMeanVal | ( | BBox * | box, |
float * | ret | ||
) |
getMeanVal computes the mean for the current Image.
box | is the bounding box where to compute the function. If it is set to NULL the function will be computed on the entire image. |
ret | is an array where the function computations are stored. If it is set to NULL an array will be allocated. |
float* pic::Image::getMedVal | ( | BBox * | box, |
float * | ret | ||
) |
getPercentileVal computes the median value value given a percentile.
box | is the bounding box where to compute the function. If it is set to NULL the function will be computed on the entire image. |
percentile | is the percentile. |
ret | is an array where the function computations are stored. If it is set to NULL an array will be allocated. |
float* pic::Image::getMinVal | ( | BBox * | box, |
float * | ret | ||
) |
getMinVal computes the minimum value for the current Image.
box | is the bounding box where to compute the function. If it is set to NULL the function will be computed on the entire image. |
ret | is an array where the function computations are stored. If it is set to NULL an array will be allocated. |
float* pic::Image::getMomentsVal | ( | int | x0, |
int | y0, | ||
int | radius, | ||
float * | ret | ||
) |
getMomentsVal computes the moments at pixel (x0, y0).
x0 | is the horizontal coordinate. |
y0 | is the vertical coordinate. |
radius | is the radius of the patch. |
ret | is an array where the function computations are stored. If it is set to NULL an array will be allocated. |
|
inline |
getNormalizedCoords computes normalized coordinates (nx, ny) of (x, y).
x | is the horizontal coordinate in pixels |
y | is the vertical coordinate in pixels |
nx | is the horizontal coordinate in [0, 1] |
ny | is the vertical coordinate in [0, 1] |
float* pic::Image::getPercentileVal | ( | float | percentile, |
BBox * | box, | ||
float * | ret | ||
) |
getPercentileVal computes the n-th value given a percentile.
percentile | is the percentile. |
box | is the bounding box where to compute the function. If it is set to NULL the function will be computed on the entire image. |
percentile | is the percentile. |
ret | is an array where the function computations are stored. If it is set to NULL an array will be allocated. |
float* pic::Image::getSumVal | ( | BBox * | box, |
float * | ret | ||
) |
getSumVal sums values for the current Image.
box | is the bounding box where to compute the function. If it is set to NULL the function will be computed on the entire image. |
ret | is an array where the function computations are stored. If it is set to NULL an array will be allocated. |
float* pic::Image::getVarianceVal | ( | float * | meanVal, |
BBox * | box, | ||
float * | ret | ||
) |
getVarianceVal computes the variance for the current Image.
box | is the bounding box where to compute the function. If it is set to NULL the function will be computed on the entire image. |
ret | is an array where the function computations are stored. If it is set to NULL an array will be allocated. |
bool pic::Image::isSimilarType | ( | const Image * | img | ) |
isSimilarType checks if the current image is similar to img; i.e. if they have the same width, height, frames, and channels.
img | is an input image |
bool pic::Image::isValid | ( | ) |
isValid checks if the current image is valid, which means if they have an allocated buffer or not.
void pic::Image::maximum | ( | Image * | img | ) |
void pic::Image::minimum | ( | Image * | img | ) |
|
inline |
nPixels computes the number of pixels.
|
inline |
operator () returns a pointer to a pixel at (x, y, t)
x | is the horizontal coordinate in pixels |
y | is the vertical coordinate in pixels |
t | is the temporal coordinate in pixels |
|
inline |
operator () returns a pointer to a pixel at (x, y)
x | is the horizontal coordinate in pixels |
y | is the vertical coordinate in pixels |
|
inline |
operator () returns a pointer to a pixel at (x, y) with normalized coordinates (values in [0, 1]).
x | is the horizontal coordinate in pixels |
y | is the vertical coordinate in pixels |
Image pic::Image::operator* | ( | const float & | a | ) | const |
operator *
a |
operator *
a |
void pic::Image::operator*= | ( | const float & | a | ) |
operator *=
a |
void pic::Image::operator*= | ( | const Image & | a | ) |
operator *=
a |
Image pic::Image::operator+ | ( | const float & | a | ) | const |
operator +
a |
operator +
a |
void pic::Image::operator+= | ( | const float & | a | ) |
operator +=
a |
void pic::Image::operator+= | ( | const Image & | a | ) |
operator +=
a |
Image pic::Image::operator- | ( | const float & | a | ) | const |
operator -
a |
operator -
a |
void pic::Image::operator-= | ( | const float & | a | ) |
operator -=
a |
void pic::Image::operator-= | ( | const Image & | a | ) |
operator -=
a |
Image pic::Image::operator/ | ( | const float & | a | ) | const |
operator /
a |
operator /
a |
void pic::Image::operator/= | ( | const float & | a | ) |
operator /=
a |
void pic::Image::operator/= | ( | const Image & | a | ) |
operator /=
a |
void pic::Image::operator= | ( | const Image & | a | ) |
operator =
a |
void pic::Image::operator= | ( | const float & | a | ) |
operator =
a |
bool pic::Image::Read | ( | std::string | nameFile, |
LDR_type | typeLoad | ||
) |
Read opens an Image from a file on the disk.
nameFile | is the file name. |
typeLoad | is an option for LDR images only: LT_NOR means that the input image values will be normalized in [0,1]. LT_NOR_GAMMA means that the input image values will be normalized in [0,1], and gamma correction 2.2 will be removed. LT_NONE means that image values are not modified. |
The default is LT_NOR_GAMMA assuming that we are storing normalized and linearized values in Image.
void pic::Image::release | ( | ) |
release frees allocated buffers.
void pic::Image::removeSpecials | ( | ) |
removeSpecials removes NaN and +/-Inf values and sets them to 0.0f.
|
inline |
reverseAddress computes (x, y) given a memory address
ind | is the memory input address |
x | is the output horizontal coordinate for ind |
y | is the output vertical coordinate for ind |
|
inline |
rotate90CCW rotates 90 degrees counter-clockwise the current image.
|
inline |
rotate90CW rotates 90 degrees clockwise the current image.
void pic::Image::scaleCosine | ( | ) |
scaleCosine multiplies the current image by the vertical cosine assuming a longitude-latitude image.
|
protected |
setNULL sets buffers values to NULL.
void pic::Image::setRand | ( | unsigned int | seed | ) |
setRand
seed |
void pic::Image::setZero | ( | ) |
setZero sets data to 0.0f.
|
inline |
size computes the number of values.
|
inline |
size computes the number of values.
|
inline |
sort
bool pic::Image::Write | ( | std::string | nameFile, |
LDR_type | typeWrite, | ||
int | writerCounter | ||
) |
Write saves an Image into a file on the disk.
nameFile | is the file name. |
typeWrite | is an option for LDR images only: LT_NOR means that Image ha normalized values and the output image values will be multiplied by 255 to have values in [0,255]. LT_NOR_GAMMA means that Image ha normalized and linearized values. The output image values will be gamma corrected (2.2) and multiplied by 255 to have values in [0,255]. LT_NONE means that Image values are the same of the output. |
The default is LT_NOR_GAMMA assuming that we are storing normalized and linearized values in Image.
writerCounter | is the frame that we want to write on the disk in the case Image is a video. The default writerCounter value is 0. |
int pic::Image::alpha |
int pic::Image::channels |
float pic::Image::channelsf |
float* pic::Image::data |
data is the main buffer where pixel values are stored.
unsigned char* pic::Image::dataRGBE |
dataRGBE is a buffer for rendering RGBE encoded images.
unsigned char* pic::Image::dataUC |
dataUC is a buffer for rendering 8-bit images.
int pic::Image::depth |
float pic::Image::exposure |
|
protected |
int pic::Image::frames |
float pic::Image::frames1f |
float pic::Image::framesf |
|
protected |
int pic::Image::height |
float pic::Image::height1f |
float pic::Image::heightf |
std::string pic::Image::nameFile |
|
protected |
|
protected |
int pic::Image::tstride |
|
protected |
int pic::Image::width |
float pic::Image::width1f |
float pic::Image::widthf |
int pic::Image::xstride |
int pic::Image::ystride |