PICCANTE  0.4
The hottest HDR imaging library!
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
pic::ImageGL Class Reference

The ImageGL class. More...

#include <image.hpp>

Inheritance diagram for pic::ImageGL:
pic::pic::Image

Public Member Functions

 ImageGL ()
 ImageGL. More...
 
 ~ImageGL ()
 
 ImageGL (GLuint texture, GLenum target)
 ImageGL. More...
 
 ImageGL (Image *img, bool transferOwnership)
 ImageGL. More...
 
 ImageGL (Image *img, GLenum target, bool mipmap, bool transferOwnership)
 ImageGL. More...
 
 ImageGL (std::string nameFile)
 ImageGL. More...
 
 ImageGL (int frames, int width, int height, int channels, float *data)
 Image. More...
 
 ImageGL (int frames, int width, int height, int channels, IMAGESTORE mode, GLenum target)
 ImageGL. More...
 
ImageGLallocateSimilarOneGL ()
 allocateSimilarOneGL More...
 
ImageGLcloneGL ()
 cloneGL More...
 
GLuint generateTextureGL (GLenum target, GLenum format_type, bool mipmap)
 generateTextureGL More...
 
void loadSliceIntoTexture (int i)
 loadSliceIntoTexture More...
 
void loadAllSlicesIntoTexture ()
 loadAllSlicesIntoTexture More...
 
void loadFromMemory ()
 loadFromMemory More...
 
void loadToMemory ()
 loadToMemory More...
 
void readFromBindedFBO ()
 readFromBindedFBO More...
 
void readFromFBO (Fbo *fbo)
 readFromFBO More...
 
void readFromFBO (Fbo *fbo, GLenum format)
 readFromFBO More...
 
void bindTexture ()
 bindTexture More...
 
void unBindTexture ()
 unBindTexture More...
 
void updateModeGPU ()
 updateModeGPU More...
 
void updateModeCPU ()
 updateModeCPU More...
 
GLuint getTexture () const
 getTexture More...
 
void setTexture (GLuint texture)
 setTexture More...
 
GLenum getTarget ()
 getTarget More...
 
float * getVal (float *ret, ReduxGL *flt)
 getVal More...
 
float * getMinVal (float *ret=NULL)
 getMinVal More...
 
float * getMaxVal (float *ret=NULL)
 getMaxVal More...
 
float * getSumVal (float *ret=NULL)
 getSumVal More...
 
float * getMeanVal (float *ret=NULL)
 getMeanVal More...
 
float * getLogMeanVal (float *ret=NULL)
 getLogMeanVal More...
 
void clamp (float a, float b)
 clamp More...
 
void operator= (const ImageGL &a)
 operator = More...
 
void operator= (const float &a)
 operator = More...
 
void operator+= (const ImageGL &a)
 operator += More...
 
void operator+= (const float &a)
 operator += More...
 
ImageGL operator+ (const ImageGL &a)
 operator + More...
 
ImageGL operator+ (const float &a)
 operator + More...
 
void operator-= (const ImageGL &a)
 operator -= More...
 
void operator-= (const float &a)
 operator -= More...
 
ImageGL operator- (const ImageGL &a)
 operator - More...
 
ImageGL operator- (const float &a)
 operator - More...
 
void operator*= (const ImageGL &a)
 operator *= More...
 
void operator*= (const float &a)
 operator *= More...
 
ImageGL operator* (const ImageGL &a)
 operator * More...
 
ImageGL operator* (const float &a)
 operator * More...
 
void operator/= (const ImageGL &a)
 operator /= More...
 
void operator/= (const float &a)
 operator /= More...
 
void operator/= (const Arrayf &a)
 operator /= More...
 
ImageGL operator/ (const ImageGL &a)
 operator / More...
 
ImageGL operator/ (const float &a)
 operator / More...
 
- Public Member Functions inherited from pic::pic::Image
 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 > &param)
 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...
 
ImageallocateSimilarOne ()
 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...
 
Imageclone () 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...
 

Protected Member Functions

void releaseGL ()
 releaseGL More...
 
void assignGL (float r=0.0f, float g=0.0f, float b=0.0f, float a=1.0f)
 assignGL assigns an (r, g, b, a) value to an image using glClearColor. More...
 
void thisOperatorConst (const float &a, BOGL op)
 thisOperatorConst More...
 
void thisOperatorConstColor (const Arrayf &a, BOGL op)
 thisOperatorConstColor More...
 
void thisOperatorImage (const ImageGL &a, BOGL op)
 thisOperatorImage More...
 
ImageGL newOperatorConstColor (const Arrayf &a, BOGL op)
 newOperatorConstColor More...
 
ImageGL newOperatorConst (const float &a, BOGL op)
 newOperatorConst More...
 
ImageGL newOperatorImage (const ImageGL &a, BOGL op)
 newOperatorImage More...
 
- Protected Member Functions inherited from pic::pic::Image
void setNULL ()
 setNULL sets buffers values to NULL. More...
 

Protected Attributes

GLuint texture
 
GLenum target
 
IMAGESTORE mode
 
bool notOwnedGL
 
FbotmpFbo
 
std::vector< GLuint > stack
 
- Protected Attributes inherited from pic::pic::Image
bool flippedEXR
 
int readerCounter
 
bool notOwned
 
BBox fullBox
 
LDR_type typeLoad
 

Additional Inherited Members

- Public Attributes inherited from pic::pic::Image
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...
 

Detailed Description

The ImageGL class.

Constructor & Destructor Documentation

◆ ImageGL() [1/7]

pic::ImageGL::ImageGL ( )

◆ ~ImageGL()

pic::ImageGL::~ImageGL ( )

◆ ImageGL() [2/7]

pic::ImageGL::ImageGL ( GLuint  texture,
GLenum  target 
)

ImageGL.

Parameters
texture
target

◆ ImageGL() [3/7]

pic::ImageGL::ImageGL ( Image img,
bool  transferOwnership 
)

ImageGL.

Parameters
img
transferOwnership

◆ ImageGL() [4/7]

pic::ImageGL::ImageGL ( Image img,
GLenum  target,
bool  mipmap,
bool  transferOwnership 
)

ImageGL.

Parameters
img
target
mipmap
transferOwnership

◆ ImageGL() [5/7]

pic::ImageGL::ImageGL ( std::string  nameFile)
inline

ImageGL.

Parameters
nameFile

◆ ImageGL() [6/7]

pic::ImageGL::ImageGL ( int  frames,
int  width,
int  height,
int  channels,
float *  data 
)
inline

Image.

Parameters
frames
width
height
channels
data

◆ ImageGL() [7/7]

pic::ImageGL::ImageGL ( int  frames,
int  width,
int  height,
int  channels,
IMAGESTORE  mode,
GLenum  target 
)

ImageGL.

Parameters
frames
width
height
channels
mode

Member Function Documentation

◆ allocateSimilarOneGL()

ImageGL* pic::ImageGL::allocateSimilarOneGL ( )

allocateSimilarOneGL

Returns

◆ assignGL()

void pic::ImageGL::assignGL ( float  r = 0.0f,
float  g = 0.0f,
float  b = 0.0f,
float  a = 1.0f 
)
inlineprotected

assignGL assigns an (r, g, b, a) value to an image using glClearColor.

Parameters
ris the value for the red channel.
gis the value for the green channel.
bis the value for the blue channel.
ais the value for the alpha channel.

◆ bindTexture()

void pic::ImageGL::bindTexture ( )

bindTexture

◆ clamp()

void pic::ImageGL::clamp ( float  a,
float  b 
)

clamp

Parameters
a
b

◆ cloneGL()

ImageGL* pic::ImageGL::cloneGL ( )

cloneGL

Returns

◆ generateTextureGL()

GLuint pic::ImageGL::generateTextureGL ( GLenum  target,
GLenum  format_type,
bool  mipmap 
)

generateTextureGL

Parameters
target
format_type
mipmap
Returns

◆ getLogMeanVal()

float* pic::ImageGL::getLogMeanVal ( float *  ret = NULL)
inline

getLogMeanVal

Parameters
imgIn
Returns

◆ getMaxVal()

float* pic::ImageGL::getMaxVal ( float *  ret = NULL)
inline

getMaxVal

Parameters
imgIn
ret
Returns

◆ getMeanVal()

float* pic::ImageGL::getMeanVal ( float *  ret = NULL)
inline

getMeanVal

Parameters
imgIn
Returns

◆ getMinVal()

float* pic::ImageGL::getMinVal ( float *  ret = NULL)
inline

getMinVal

Parameters
imgIn
Returns

◆ getSumVal()

float* pic::ImageGL::getSumVal ( float *  ret = NULL)
inline

getSumVal

Parameters
imgIn
ret
Returns

◆ getTarget()

GLenum pic::ImageGL::getTarget ( )
inline

getTarget

Returns

◆ getTexture()

GLuint pic::ImageGL::getTexture ( ) const
inline

getTexture

Returns

◆ getVal()

float* pic::ImageGL::getVal ( float *  ret,
ReduxGL flt 
)
inline

getVal

Parameters
ret
flt
Returns

◆ loadAllSlicesIntoTexture()

void pic::ImageGL::loadAllSlicesIntoTexture ( )

loadAllSlicesIntoTexture

◆ loadFromMemory()

void pic::ImageGL::loadFromMemory ( )

loadFromMemory

◆ loadSliceIntoTexture()

void pic::ImageGL::loadSliceIntoTexture ( int  i)

loadSliceIntoTexture

Parameters
i

◆ loadToMemory()

void pic::ImageGL::loadToMemory ( )

loadToMemory

◆ newOperatorConst()

ImageGL pic::ImageGL::newOperatorConst ( const float &  a,
BOGL  op 
)
inlineprotected

newOperatorConst

Parameters
a
op
Returns

◆ newOperatorConstColor()

ImageGL pic::ImageGL::newOperatorConstColor ( const Arrayf a,
BOGL  op 
)
inlineprotected

newOperatorConstColor

Parameters
a
op
Returns

◆ newOperatorImage()

ImageGL pic::ImageGL::newOperatorImage ( const ImageGL a,
BOGL  op 
)
inlineprotected

newOperatorImage

Parameters
a
op

◆ operator*() [1/2]

ImageGL pic::ImageGL::operator* ( const ImageGL a)

operator *

Parameters
a
Returns

◆ operator*() [2/2]

ImageGL pic::ImageGL::operator* ( const float &  a)

operator *

Parameters
a
Returns

◆ operator*=() [1/2]

void pic::ImageGL::operator*= ( const ImageGL a)

operator *=

Parameters
a

◆ operator*=() [2/2]

void pic::ImageGL::operator*= ( const float &  a)

operator *=

Parameters
a

◆ operator+() [1/2]

ImageGL pic::ImageGL::operator+ ( const ImageGL a)

operator +

Parameters
a
Returns

◆ operator+() [2/2]

ImageGL pic::ImageGL::operator+ ( const float &  a)

operator +

Parameters
a
Returns

◆ operator+=() [1/2]

void pic::ImageGL::operator+= ( const ImageGL a)

operator +=

Parameters
a

◆ operator+=() [2/2]

void pic::ImageGL::operator+= ( const float &  a)

operator +=

Parameters
a

◆ operator-() [1/2]

ImageGL pic::ImageGL::operator- ( const ImageGL a)

operator -

Parameters
a
Returns

◆ operator-() [2/2]

ImageGL pic::ImageGL::operator- ( const float &  a)

operator -

Parameters
a
Returns

◆ operator-=() [1/2]

void pic::ImageGL::operator-= ( const ImageGL a)

operator -=

Parameters
a

◆ operator-=() [2/2]

void pic::ImageGL::operator-= ( const float &  a)

operator -=

Parameters
a

◆ operator/() [1/2]

ImageGL pic::ImageGL::operator/ ( const ImageGL a)

operator /

Parameters
a
Returns

◆ operator/() [2/2]

ImageGL pic::ImageGL::operator/ ( const float &  a)

operator /

Parameters
a
Returns

◆ operator/=() [1/3]

void pic::ImageGL::operator/= ( const ImageGL a)

operator /=

Parameters
a

◆ operator/=() [2/3]

void pic::ImageGL::operator/= ( const float &  a)

operator /=

Parameters
a

◆ operator/=() [3/3]

void pic::ImageGL::operator/= ( const Arrayf a)

operator /=

Parameters
a

◆ operator=() [1/2]

void pic::ImageGL::operator= ( const ImageGL a)

operator =

Parameters
a

◆ operator=() [2/2]

void pic::ImageGL::operator= ( const float &  a)

operator =

Parameters
a

◆ readFromBindedFBO()

void pic::ImageGL::readFromBindedFBO ( )

readFromBindedFBO

◆ readFromFBO() [1/2]

void pic::ImageGL::readFromFBO ( Fbo fbo)

readFromFBO

Parameters
fbo

◆ readFromFBO() [2/2]

void pic::ImageGL::readFromFBO ( Fbo fbo,
GLenum  format 
)

readFromFBO

Parameters
fbo
format

◆ releaseGL()

void pic::ImageGL::releaseGL ( )
protected

releaseGL

◆ setTexture()

void pic::ImageGL::setTexture ( GLuint  texture)
inline

setTexture

Parameters
texture

◆ thisOperatorConst()

void pic::ImageGL::thisOperatorConst ( const float &  a,
BOGL  op 
)
inlineprotected

thisOperatorConst

Parameters
a
op

◆ thisOperatorConstColor()

void pic::ImageGL::thisOperatorConstColor ( const Arrayf a,
BOGL  op 
)
inlineprotected

thisOperatorConstColor

Parameters
a
op

◆ thisOperatorImage()

void pic::ImageGL::thisOperatorImage ( const ImageGL a,
BOGL  op 
)
inlineprotected

thisOperatorImage

Parameters
a
op

◆ unBindTexture()

void pic::ImageGL::unBindTexture ( )

unBindTexture

◆ updateModeCPU()

void pic::ImageGL::updateModeCPU ( )
inline

updateModeCPU

◆ updateModeGPU()

void pic::ImageGL::updateModeGPU ( )
inline

updateModeGPU

Member Data Documentation

◆ mode

IMAGESTORE pic::ImageGL::mode
protected

◆ notOwnedGL

bool pic::ImageGL::notOwnedGL
protected

◆ stack

std::vector<GLuint> pic::ImageGL::stack
protected

◆ target

GLenum pic::ImageGL::target
protected

◆ texture

GLuint pic::ImageGL::texture
protected

◆ tmpFbo

Fbo* pic::ImageGL::tmpFbo
protected

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