18 #ifndef PIC_GL_IMAGE_RAW_HPP 19 #define PIC_GL_IMAGE_RAW_HPP 21 #include "../base.hpp" 23 #include "../image.hpp" 26 #include "../util/gl/fbo.hpp" 27 #include "../util/gl/formats.hpp" 28 #include "../util/gl/timings.hpp" 29 #include "../util/gl/buffer_ops.hpp" 30 #include "../util/gl/buffer_allocation.hpp" 31 #include "../util/gl/mask.hpp" 32 #include "../util/gl/redux.hpp" 33 #include "../util/gl/redux_ops.hpp" 66 void assignGL(
float r = 0.0f,
float g = 0.0f,
float b = 0.0f,
74 glClearColor(r, g, b, a);
79 glClear(GL_COLOR_BUFFER_BIT);
94 ops->
list[op]->update(a);
110 ops->
list[op]->update(c0);
146 ops->
list[op]->update(c0);
163 ops->
list[op]->update(a);
416 int mode, modeInternalFormat;
419 glBindTexture(GL_TEXTURE_2D, output);
420 glGetTexImage(GL_TEXTURE_2D, 0,
mode, GL_FLOAT, ret);
421 glBindTexture(GL_TEXTURE_2D, 0);
484 ret[i] = expf(ret[i]);
495 void clamp(
float a,
float b);
648 if(transferOwnership) {
676 if(transferOwnership) {
766 if(format_type == GL_INT) {
792 this->
target = GL_TEXTURE_2D;
796 case GL_TEXTURE_2D_ARRAY: {
800 case GL_TEXTURE_CUBE_MAP: {
806 this->
target = GL_TEXTURE_2D_ARRAY;
809 this->
target = GL_TEXTURE_2D;
839 auto n =
stack.size();
840 for(
auto i = 0; i < n; i++) {
842 glDeleteTextures(1, &
stack[i]);
860 int mode, modeInternalFormat;
866 case GL_TEXTURE_2D: {
872 case GL_TEXTURE_3D: {
885 printf(
"This texture can not be trasferred from GPU memory\n");
899 int mode, modeInternalFormat;
911 int mode, modeInternalFormat;
916 glTexSubImage3D(
target, 0, 0, 0, i,
width,
height, 1,
mode, GL_FLOAT,
924 if(
target != GL_TEXTURE_3D &&
target != GL_TEXTURE_2D_ARRAY) {
928 for(
int i = 0; i <
frames; i++) {
939 if(
data == NULL || bCheck) {
965 int mode, modeInternalFormat;
970 printf(
"void ImageGL::readFromBindedFBO(): error unknown format!");
Definition: redux_ops.hpp:30
int nPixels() const
nPixels computes the number of pixels.
Definition: filter_radial_basis_function.hpp:499
int depth
Definition: filter_radial_basis_function.hpp:80
The Fbo class.
Definition: display.hpp:32
float * data
data is the main buffer where pixel values are stored.
Definition: filter_radial_basis_function.hpp:91
int channels
Definition: filter_radial_basis_function.hpp:80
int frames
Definition: filter_radial_basis_function.hpp:80
std::string nameFile
Definition: filter_radial_basis_function.hpp:86
Definition: buffer_ops.hpp:35
void operator=(const ImageGL &a)
operator =
float * getSumVal(float *ret=NULL)
getSumVal
Definition: image.hpp:455
void operator-=(const ImageGL &a)
operator -=
GLuint texture
Definition: image.hpp:45
Definition: redux_ops.hpp:30
static BufferOpsGL * getInstance()
getInstance
Definition: buffer_ops.hpp:51
void bindTexture()
bindTexture
void readFromBindedFBO()
readFromBindedFBO
The BufferOpsGL class.
Definition: display.hpp:42
void updateModeCPU()
updateModeCPU
Definition: image.hpp:354
GLuint generateTextureGL(GLenum target, GLenum format_type, bool mipmap)
generateTextureGL
GLenum target
Definition: image.hpp:46
void allocateAux()
allocateAux computes extra information after allocation; e.g. strides.
Definition: filter_radial_basis_function.hpp:1057
Definition: buffer_ops.hpp:32
void thisOperatorImage(const ImageGL &a, BOGL op)
thisOperatorImage
Definition: image.hpp:119
PIC_INLINE long lround(double x)
lround rounds double numbers properly.
Definition: math.hpp:229
ImageGL(int frames, int width, int height, int channels, float *data)
Image.
Definition: image.hpp:248
The Fbo class.
Definition: fbo.hpp:32
Fbo * tmpFbo
Definition: image.hpp:49
void operator*=(const ImageGL &a)
operator *=
void operator/=(const ImageGL &a)
operator /=
The Image class stores an image as buffer of float.
Definition: filter_radial_basis_function.hpp:60
ImageGL operator+(const ImageGL &a)
operator +
void clamp(float a, float b)
clamp
void changeOwnership(bool notOwned)
changeOwnership
Definition: filter_radial_basis_function.hpp:746
Image * clone() const
Clone creates a deep copy of the calling instance.
Definition: filter_radial_basis_function.hpp:2057
PIC_INLINE GLuint generateTexture2DU32GL(int width, int height, int channels, int *data=NULL)
generateTexture2DU32GL
Definition: buffer_allocation.hpp:197
GLenum getTarget()
getTarget
Definition: image.hpp:388
ImageGL * cloneGL()
cloneGL
void flipV()
FlipV flips vertically the current image.
Definition: filter_radial_basis_function.hpp:212
std::vector< GLuint > stack
Definition: image.hpp:52
The Array class.
Definition: saturation.hpp:31
ImageGL(std::string nameFile)
ImageGL.
Definition: image.hpp:231
void loadAllSlicesIntoTexture()
loadAllSlicesIntoTexture
IMAGESTORE mode
Definition: image.hpp:47
The ImageGL class.
Definition: image.hpp:42
void releaseGL()
releaseGL
float * getMinVal(float *ret=NULL)
getMinVal
Definition: image.hpp:431
void readFromFBO(Fbo *fbo)
readFromFBO
PIC_INLINE GLuint generateTexture2DGL(int width, int height, int channels, float *data=NULL, bool mipmap=false)
generateTexture2DGL
Definition: buffer_allocation.hpp:37
Definition: redux_ops.hpp:30
ImageGL * allocateSimilarOneGL()
allocateSimilarOneGL
Definition: buffer_ops.hpp:33
int tstride
Definition: filter_radial_basis_function.hpp:82
ImageGL operator*(const ImageGL &a)
operator *
bool notOwnedGL
Definition: image.hpp:48
GLuint Redux(GLuint texIn, int width, int height, int channels, std::vector< GLuint > &stack)
Redux.
Definition: redux.hpp:84
void updateModeGPU()
updateModeGPU
Definition: image.hpp:340
PIC_INLINE void getTextureInformationGL(GLuint texture, GLuint target, int &width, int &height, int &frames, int &channels)
getTextureInformationGL returns width, height and frames values from a texture with target...
Definition: formats.hpp:173
Definition: redux_ops.hpp:30
BufferOperatorsGL list
Definition: buffer_ops.hpp:45
Definition: buffer_ops.hpp:35
ImageGL newOperatorConst(const float &a, BOGL op)
newOperatorConst
Definition: image.hpp:158
void bind()
bind
Definition: display.hpp:427
float * getMaxVal(float *ret=NULL)
getMaxVal
Definition: image.hpp:443
ImageGL newOperatorConstColor(const Arrayf &a, BOGL op)
newOperatorConstColor
Definition: image.hpp:138
PIC_INLINE GLuint generateTextureCubeMapGL(int width, int height, int channels, int frames, float *data=NULL)
generateTextureCubeMapGL
Definition: buffer_allocation.hpp:84
The BufferOpsGL class.
Definition: redux_ops.hpp:37
BOGL
Definition: buffer_ops.hpp:32
ImageGL operator-(const ImageGL &a)
operator -
int nData
Definition: array.hpp:37
bool notOwned
Definition: filter_radial_basis_function.hpp:72
The ReduxGL class.
Definition: redux.hpp:32
void unBindTexture()
unBindTexture
int width
Definition: display.hpp:38
void getModesGL(int channels, int &mode, int &modeInternalFormat)
getModesGL
Definition: formats.hpp:33
void operator+=(const ImageGL &a)
operator +=
ImageGL operator/(const ImageGL &a)
operator /
PIC_INLINE GLuint generateTexture3DGL(int width, int height, int channels, int frames, float *data=NULL)
generateTexture3DGL
Definition: buffer_allocation.hpp:125
#define PIC_INLINE
Definition: base.hpp:33
void thisOperatorConstColor(const Arrayf &a, BOGL op)
thisOperatorConstColor
Definition: image.hpp:103
void release()
release frees allocated buffers.
Definition: filter_radial_basis_function.hpp:1015
The ImageGL class.
Definition: display.hpp:42
void loadSliceIntoTexture(int i)
loadSliceIntoTexture
bool create(int width, int height, bool bDepth)
create
int width
Definition: filter_radial_basis_function.hpp:80
Definition: redux_ops.hpp:30
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.
Definition: image.hpp:66
#define MIN(a, b)
Definition: math.hpp:69
The Image class stores an image as buffer of float.
Definition: image.hpp:60
T * data
Definition: array.hpp:36
Definition: buffer_ops.hpp:33
IMAGESTORE
Definition: image.hpp:37
IMAGESTORE
Definition: display.hpp:37
Definition: buffer_ops.hpp:35
Definition: buffer_ops.hpp:33
ReduxOperatorsGL list
Definition: redux_ops.hpp:40
Definition: buffer_ops.hpp:32
BufferOperatorsGL list
Definition: display.hpp:45
void loadToMemory()
loadToMemory
GLuint getTexture() const
getTexture
Definition: image.hpp:369
The Array class.
Definition: array.hpp:30
The BufferOpsGL class.
Definition: buffer_ops.hpp:42
Definition: bilateral_separation.hpp:25
Definition: buffer_ops.hpp:33
Definition: buffer_ops.hpp:32
static T * assign(T *data, int size, T *ret)
assign
Definition: array.hpp:464
PIC_INLINE GLuint generateTexture2DArrayGL(int width, int height, int channels, int frames, float *data=NULL)
generateTexture2DArrayGL
Definition: buffer_allocation.hpp:164
void thisOperatorConst(const float &a, BOGL op)
thisOperatorConst
Definition: image.hpp:90
void setTexture(GLuint texture)
setTexture
Definition: image.hpp:378
int height
Definition: display.hpp:38
void unbind()
unbind
Definition: display.hpp:442
ImageGL newOperatorImage(const ImageGL &a, BOGL op)
newOperatorImage
Definition: image.hpp:174
Definition: buffer_ops.hpp:32
float * getVal(float *ret, ReduxGL *flt)
getVal
Definition: image.hpp:399
float * getMeanVal(float *ret=NULL)
getMeanVal
Definition: image.hpp:466
static ReduxOpsGL * getInstance()
getInstance
Definition: redux_ops.hpp:46
static void allocateReduxData(int width, int height, int channels, std::vector< GLuint > &stack, int minSize=2)
allocateReduxData allocates a pyramid for computing the Redux operator.
Definition: redux.hpp:216
int height
Definition: filter_radial_basis_function.hpp:80
void loadFromMemory()
loadFromMemory
void allocate(int width, int height, int channels, int frames)
allocate allocates memory for the pixel buffer.
Definition: filter_radial_basis_function.hpp:1029
float * getLogMeanVal(float *ret=NULL)
getLogMeanVal
Definition: image.hpp:477