PICCANTE  0.4
The hottest HDR imaging library!
image.hpp
Go to the documentation of this file.
1 /*
2 
3 PICCANTE
4 The hottest HDR imaging library!
5 http://vcg.isti.cnr.it/piccante
6 
7 Copyright (C) 2014
8 Visual Computing Laboratory - ISTI CNR
9 http://vcg.isti.cnr.it
10 First author: Francesco Banterle
11 
12 This Source Code Form is subject to the terms of the Mozilla Public
13 License, v. 2.0. If a copy of the MPL was not distributed with this
14 file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 
16 */
17 
18 #ifndef PIC_GL_IMAGE_RAW_HPP
19 #define PIC_GL_IMAGE_RAW_HPP
20 
21 #include "../base.hpp"
22 
23 #include "../image.hpp"
24 
25 #include "../gl.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"
34 
35 namespace pic {
36 
38 
42 class ImageGL: public Image
43 {
44 protected:
45  GLuint texture;
46  GLenum target;
47  IMAGESTORE mode; //TODO: check if the mode is always correctly updated
48  bool notOwnedGL; //do we own the OpenGL texture??
50 
51  //stack for statistics
52  std::vector<GLuint> stack;
53 
57  void releaseGL();
58 
66  void assignGL(float r = 0.0f, float g = 0.0f, float b = 0.0f,
67  float a = 1.0f)
68  {
69  if(tmpFbo == NULL) {
70  tmpFbo = new Fbo();
71  tmpFbo->create(width, height, 1, false, texture);
72  }
73 
74  glClearColor(r, g, b, a);
75 
76  //Rendering
77  tmpFbo->bind();
78  glViewport(0, 0, (GLsizei)width, (GLsizei)height);
79  glClear(GL_COLOR_BUFFER_BIT);
80 
81  //Fbo
82  tmpFbo->unbind();
83  }
84 
90  inline void thisOperatorConst(const float &a, BOGL op)
91  {
93 
94  ops->list[op]->update(a);
95  ops->list[op]->Process(getTexture(), 0, getTexture(), width, height);
96  }
97 
103  inline void thisOperatorConstColor(const Arrayf &a, BOGL op)
104  {
106 
107  float c0[4];
108  Arrayf::assign(a.data, MIN(a.nData, 4), c0);
109 
110  ops->list[op]->update(c0);
111  ops->list[op]->Process(getTexture(), 0, getTexture(), width, height);
112  }
113 
119  inline void thisOperatorImage(const ImageGL &a, BOGL op)
120  {
122 
123  if(channels == a.channels && width == a.width && height == a.height) {
124  ops->list[op]->Process(getTexture(), a.getTexture(), getTexture(), width, height);
125  } else {
126  if((nPixels() == a.nPixels()) && (a.channels == 1)) {
127  ops->list[op + 8]->Process(getTexture(), a.getTexture(), getTexture(), width, height);
128  }
129  }
130  }
131 
139  {
142 
143  float c0[4];
144  Arrayf::assign(a.data, MIN(a.nData, 4), c0);
145 
146  ops->list[op]->update(c0);
147  ops->list[op]->Process(getTexture(), 0, ret.getTexture(), width, height);
148 
149  return ret;
150  }
151 
158  inline ImageGL newOperatorConst(const float &a, BOGL op)
159  {
162 
163  ops->list[op]->update(a);
164  ops->list[op]->Process(getTexture(), 0, ret.getTexture(), width, height);
165 
166  return ret;
167  }
168 
174  inline ImageGL newOperatorImage(const ImageGL &a, BOGL op)
175  {
177 
179 
180  if(channels == a.channels && width == a.width && height == a.height) {
181  ops->list[op]->Process(getTexture(), a.getTexture(), ret.getTexture(), width, height);
182  } else {
183  if((nPixels() == a.nPixels()) && ((a.channels == 1) || (channels == 1))) {
184  if(a.channels == 1) {
185  ops->list[op + 8]->Process(getTexture(), a.getTexture(), ret.getTexture(), width, height);
186  } else {
187  ops->list[op + 8]->Process(a.getTexture(), getTexture(), ret.getTexture(), width, height);
188  }
189  }
190  }
191 
192  return ret;
193  }
194 
195 public:
196 
200  ImageGL();
201 
202  ~ImageGL();
203 
209  ImageGL(GLuint texture, GLenum target);
210 
216  ImageGL(Image *img, bool transferOwnership);
217 
225  ImageGL(Image *img, GLenum target, bool mipmap, bool transferOwnership);
226 
232  {
233  notOwnedGL = false;
234  mode = IMG_CPU;
235  texture = 0;
236  target = 0;
237  tmpFbo = NULL;
238  }
239 
248  ImageGL(int frames, int width, int height, int channels, float *data) : Image (frames, width, height, channels, data)
249  {
250  notOwnedGL = false;
251  mode = IMG_CPU;
252  texture = 0;
253  target = 0;
254  tmpFbo = NULL;
255  }
256 
265  ImageGL(int frames, int width, int height, int channels, IMAGESTORE mode, GLenum target);
266 
272 
277  ImageGL *cloneGL();
278 
286  GLuint generateTextureGL(GLenum target, GLenum format_type, bool mipmap);
287 
292  void loadSliceIntoTexture(int i);
293 
298 
302  void loadFromMemory();
303 
307  void loadToMemory();
308 
312  void readFromBindedFBO();
313 
318  void readFromFBO(Fbo *fbo);
319 
325  void readFromFBO(Fbo *fbo, GLenum format);
326 
330  void bindTexture();
331 
335  void unBindTexture();
336 
341  {
342  if(mode == IMG_NULL) {
343  mode = IMG_GPU;
344  }
345 
346  if(mode == IMG_CPU) {
347  mode = IMG_CPU_GPU;
348  }
349  }
350 
355  {
356  if(mode == IMG_NULL) {
357  mode = IMG_CPU;
358  }
359 
360  if(mode == IMG_GPU) {
361  mode = IMG_CPU_GPU;
362  }
363  }
364 
369  GLuint getTexture() const
370  {
371  return texture;
372  }
373 
378  void setTexture(GLuint texture)
379  {
380  //TODO: UNSAFE!
381  this->texture = texture;
382  }
383 
388  GLenum getTarget()
389  {
390  return target;
391  }
392 
399  float *getVal(float *ret, ReduxGL *flt)
400  {
401  if(texture == 0) {
402  return ret;
403  }
404 
405  if(ret == NULL) {
406  ret = new float [channels];
407  }
408 
409  if(stack.empty()) {
411  }
412 
413  GLuint output = flt->Redux(texture, width, height, channels, stack);
414 
415  //copy data from GPU to main memory
416  int mode, modeInternalFormat;
417  getModesGL(channels, mode, modeInternalFormat);
418 
419  glBindTexture(GL_TEXTURE_2D, output);
420  glGetTexImage(GL_TEXTURE_2D, 0, mode, GL_FLOAT, ret);
421  glBindTexture(GL_TEXTURE_2D, 0);
422 
423  return ret;
424  }
425 
431  float *getMinVal(float *ret = NULL)
432  {
434  return getVal(ret, ops->list[REDGL_MIN]);
435  }
436 
443  float *getMaxVal(float *ret = NULL)
444  {
446  return getVal(ret, ops->list[REDGL_MAX]);
447  }
448 
455  float *getSumVal(float *ret = NULL)
456  {
458  return getVal(ret, ops->list[REDGL_SUM]);
459  }
460 
466  float *getMeanVal(float *ret = NULL)
467  {
469  return getVal(ret, ops->list[REDGL_MEAN]);
470  }
471 
477  float *getLogMeanVal(float *ret = NULL)
478  {
480 
481  ret = getVal(ret, ops->list[REDGL_LOG_MEAN]);
482 
483  for(int i = 0; i < channels; i++) {
484  ret[i] = expf(ret[i]);
485  }
486 
487  return ret;
488  }
489 
495  void clamp(float a, float b);
496 
501  void operator =(const ImageGL &a);
502 
507  void operator =(const float &a);
508 
513  void operator +=(const ImageGL &a);
514 
519  void operator +=(const float &a);
520 
526  ImageGL operator +(const ImageGL &a);
527 
533  ImageGL operator +(const float &a);
534 
539  void operator -=(const ImageGL &a);
540 
545  void operator -=(const float &a);
546 
552  ImageGL operator -(const ImageGL &a);
553 
559  ImageGL operator -(const float &a);
560 
565  void operator *=(const ImageGL &a);
566 
571  void operator *=(const float &a);
572 
578  ImageGL operator *(const ImageGL &a);
579 
585  ImageGL operator *(const float &a);
586 
591  void operator /=(const ImageGL &a);
592 
597  void operator /=(const float &a);
598 
603  void operator /=(const Arrayf &a);
604 
610  ImageGL operator /(const ImageGL &a);
611 
617  ImageGL operator /(const float &a);
618 };
619 
621 {
622  notOwnedGL = false;
623  texture = 0;
624  target = 0;
625  mode = IMG_NULL;
626  tmpFbo = NULL;
627 }
628 
629 PIC_INLINE ImageGL::ImageGL(GLuint texture, GLuint target) : Image()
630 {
631  notOwnedGL = true;
632 
633  tmpFbo = NULL;
634 
635  mode = IMG_GPU;
636 
637  this->texture = texture;
638 
639  this->target = target;
640 
642 
643  allocateAux();
644 }
645 
646 PIC_INLINE ImageGL::ImageGL(Image *img, GLenum target, bool mipmap, bool transferOwnership = false): Image()
647 {
648  if(transferOwnership) {
649  notOwned = false;
650  img->changeOwnership(true);
651  } else {
652  notOwned = true;
653  }
654 
655  notOwnedGL = false;
656 
657  tmpFbo = NULL;
658 
659  width = img->width;
660  height = img->height;
661  frames = img->frames;
662  channels = img->channels;
663  data = img->data;
664 
665  allocateAux();
666 
667  texture = 0;
668 
669  generateTextureGL(target, GL_FLOAT, mipmap);
670 
671  mode = IMG_CPU_GPU;
672 }
673 
674 PIC_INLINE ImageGL::ImageGL(Image *img, bool transferOwnership = false) : Image()
675 {
676  if(transferOwnership) {
677  notOwned = false;
678  img->changeOwnership(true);
679  } else {
680  notOwned = true;
681  }
682 
683  notOwnedGL = false;
684 
685  tmpFbo = NULL;
686 
687  width = img->width;
688  height = img->height;
689  frames = img->frames;
690  channels = img->channels;
691  data = img->data;
692 
693  allocateAux();
694 
695  texture = 0;
696 
697  mode = IMG_CPU;
698 }
699 
700 PIC_INLINE ImageGL::ImageGL(int frames, int width, int height, int channels,
701  IMAGESTORE mode, GLenum target) : Image()
702 {
703  notOwnedGL = false;
704  tmpFbo = NULL;
705 
706  this->mode = mode;
707 
708  if(this->mode == IMG_GPU_CPU) {
709  this->mode = IMG_CPU_GPU;
710  }
711 
712  switch(this->mode) {
713 
714  case IMG_CPU_GPU: {
716 
717  generateTextureGL(target, GL_FLOAT, false);
718  }
719  break;
720 
721  case IMG_CPU: {
723  }
724  break;
725 
726  case IMG_GPU: {
727  this->width = width;
728  this->height = height;
729  this->frames = frames;
730  this->depth = frames;
731  this->channels = channels;
732 
733  allocateAux();
734 
735  generateTextureGL(target, GL_FLOAT, false);
736  }
737  break;
738 
739  default: {
740 
741  }break;
742 
743  }
744 }
745 
747 {
748  releaseGL();
749  release();
750 }
751 
759 PIC_INLINE GLuint ImageGL::generateTextureGL(GLenum target = GL_TEXTURE_2D, GLenum format_type = GL_FLOAT, bool mipmap = false)
760 {
761  this->texture = 0;
762  this->target = target;
763 
764  updateModeGPU();
765 
766  if(format_type == GL_INT) {
767  int *buffer = new int[width * height * channels];
768 
769  for(int i = 0; i < (width * height * channels); i++) {
770  buffer[i] = int(lround(data[i]));
771  }
772 
774 
775  delete[] buffer;
776 
777  return texture;
778  }
779 
780  switch(target) {
781  case GL_TEXTURE_2D:
782  {
784  } break;
785 
786  case GL_TEXTURE_3D:
787  {
788  if(frames > 1) {
790  } else {
792  this->target = GL_TEXTURE_2D;
793  }
794  } break;
795 
796  case GL_TEXTURE_2D_ARRAY: {
798  } break;
799 
800  case GL_TEXTURE_CUBE_MAP: {
801  if(frames > 5) {
803  } else {
804  if(frames > 1) {
806  this->target = GL_TEXTURE_2D_ARRAY;
807  } else {
809  this->target = GL_TEXTURE_2D;
810  }
811  }
812  } break;
813  }
814 
815  return texture;
816 }
817 
819 {
820  //call Image clone function
821  Image *tmp = this->clone();
822 
823  //wrap tmp into an ImageGL
824  return new ImageGL(tmp, target, false, true);
825 }
826 
828 {
829  if(notOwnedGL) {
830  return;
831  }
832 
833  if(texture != 0) {
834  glDeleteTextures(1, &texture);
835  texture = 0;
836  target = 0;
837  }
838 
839  auto n = stack.size();
840  for(auto i = 0; i < n; i++) {
841  if(stack[i] != 0) {
842  glDeleteTextures(1, &stack[i]);
843  stack[i] = 0;
844  }
845  }
846 }
847 
849 {
850 #ifdef PIC_DEBUG
851  printf("ImageGL::allocateSimilarOneGL -- %d %d %d %d %d\n", frames, width, height, channels, mode);
852 #endif
853 
855  return ret;
856 }
857 
859 {
860  int mode, modeInternalFormat;
861  getModesGL(channels, mode, modeInternalFormat);
862 
863  glBindTexture(target, texture);
864 
865  switch(target) {
866  case GL_TEXTURE_2D: {
867  glTexImage2D(target, 0, modeInternalFormat, width, height, 0,
868  mode, GL_FLOAT, data);
869 
870  } break;
871 
872  case GL_TEXTURE_3D: {
873  glTexImage3D(GL_TEXTURE_3D, 0, modeInternalFormat, width, height, frames, 0,
874  mode, GL_FLOAT, data);
875  } break;
876  }
877 
878  glBindTexture(target, 0);
879 }
880 
882 {
883  if(texture == 0) {
884  #ifdef PIC_DEBUG
885  printf("This texture can not be trasferred from GPU memory\n");
886  #endif
887  return;
888  }
889 
890  if(data == NULL) {
891  #ifdef PIC_DEBUG
892  printf("RAM memory allocated: %d %d %d %d\n", width, height, channels, frames);
893  #endif
894 
896  this->mode = IMG_CPU_GPU;
897  }
898 
899  int mode, modeInternalFormat;
900  getModesGL(channels, mode, modeInternalFormat);
901 
902  bindTexture();
903 
904  glGetTexImage(target, 0, mode, GL_FLOAT, data);
905 
906  unBindTexture();
907 }
908 
910 {
911  int mode, modeInternalFormat;
912  getModesGL(channels, mode, modeInternalFormat);
913 
914  glBindTexture(target, texture);
915  i = i % frames;
916  glTexSubImage3D(target, 0, 0, 0, i, width, height, 1, mode, GL_FLOAT,
917  &data[i * tstride]);
918 
919  glBindTexture(target, 0);
920 }
921 
923 {
924  if(target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY) {
925  return;
926  }
927 
928  for(int i = 0; i < frames; i++) {
930  }
931 }
932 
933 PIC_INLINE void ImageGL::readFromFBO(Fbo *fbo, GLenum format)
934 {
935  //TO DO: check data
936  bool bCheck = (fbo->width != width) ||
937  (fbo->height != height);
938 
939  if(data == NULL || bCheck) {
940  allocate(fbo->width, fbo->height, 4, 1);
941  }
942 
943  //ReadPixels from the FBO
944  fbo->bind();
945  glReadPixels(0, 0, width, height, format, GL_FLOAT, data);
946  fbo->unbind();
947 
948  /* glBindTexture(GL_TEXTURE_2D, fbo->tex);
949  glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, data);
950  glBindTexture(GL_TEXTURE_2D, 0);*/
951 }
952 
954 {
955  if(mode == IMG_NULL) {
956  mode = IMG_CPU;
957  }
958 
959  readFromFBO(fbo, GL_RGBA);
960 }
961 
963 {
964 
965  int mode, modeInternalFormat;
966  getModesGL(channels, mode, modeInternalFormat);
967 
968  if(mode == 0x0) {
969  #ifdef PIC_DEBUG
970  printf("void ImageGL::readFromBindedFBO(): error unknown format!");
971  #endif
972  return;
973  }
974 
975  //TODO: check width height and data (mode and modeInternalFormat)
976 
977  glReadPixels(0, 0, width, height, mode, GL_FLOAT, data);
978  flipV();
979 }
980 
982 {
983  glBindTexture(target, texture);
984 }
985 
987 {
988  glBindTexture(target, 0);
989 }
990 
991 PIC_INLINE void ImageGL::clamp(float a = 0.0f, float b = 1.0f)
992 {
994  ops->list[BOGL_CLAMP]->update(a, b);
995  ops->list[BOGL_CLAMP]->Process(getTexture(), 0, getTexture(), width, height);
996 }
997 
999 {
1001 }
1002 
1003 PIC_INLINE void ImageGL::operator =(const float &a)
1004 {
1006 }
1007 
1009 {
1011 }
1012 
1013 PIC_INLINE void ImageGL::operator +=(const float &a)
1014 {
1016 }
1017 
1019 {
1020  return newOperatorImage(a, BOGL_ADD);
1021 }
1022 
1024 {
1025  return newOperatorConst(a, BOGL_ADD_CONST);
1026 }
1027 
1029 {
1031 }
1032 
1033 PIC_INLINE void ImageGL::operator -=(const float &a)
1034 {
1036 }
1037 
1039 {
1040  return newOperatorImage(a, BOGL_SUB);
1041 }
1042 
1044 {
1045  return newOperatorConst(a, BOGL_SUB_CONST);
1046 }
1047 
1049 {
1051 }
1052 
1053 PIC_INLINE void ImageGL::operator *=(const float &a)
1054 {
1056 }
1057 
1059 {
1060  return newOperatorImage(a, BOGL_MUL);
1061 }
1062 
1064 {
1065  return newOperatorConst(a, BOGL_MUL_CONST);
1066 }
1067 
1069 {
1071 }
1072 
1073 PIC_INLINE void ImageGL::operator /=(const float &a)
1074 {
1076 }
1077 
1079 {
1081 }
1082 
1084 {
1085  return newOperatorImage(a, BOGL_DIV);
1086 }
1087 
1089 {
1090  return newOperatorConst(a, BOGL_DIV_CONST);
1091 }
1092 
1093 } // end namespace pic
1094 
1095 #endif /* PIC_GL_IMAGE_RAW_HPP */
1096 
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
void unbind()
unbind
float * data
data is the main buffer where pixel values are stored.
Definition: filter_radial_basis_function.hpp:91
Definition: image.hpp:37
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 +
ImageGL()
ImageGL.
void clamp(float a, float b)
clamp
void changeOwnership(bool notOwned)
changeOwnership
Definition: filter_radial_basis_function.hpp:746
Definition: image.hpp:37
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
Definition: image.hpp:37
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
Definition: image.hpp:37
float * getMeanVal(float *ret=NULL)
getMeanVal
Definition: image.hpp:466
static ReduxOpsGL * getInstance()
getInstance
Definition: redux_ops.hpp:46
void bind()
bind
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
Definition: image.hpp:37