Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
clfImage2D.cpp
1 /*
2  This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4  Copyright (C) 2003, 2004 (see file CONTACTS for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10  BIAS is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation; either version 2.1 of the License, or
13  (at your option) any later version.
14 
15  BIAS is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with BIAS; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  */
24 
25 #include <Base/Common/BIASpragma.hh>
26 #include <OpenCLFramework/clfImage2D.hh>
27 #include <OpenCLFramework/clfException.hh>
28 #include <Base/Debug/Error.hh>
29 
30 using namespace BIAS;
31 
32 std::vector<cl::ImageFormat> clfImage2D::imageFormatsReadable_;
33 std::vector<cl::ImageFormat> clfImage2D::imageFormatsWritable_;
34 std::vector<cl::ImageFormat> clfImage2D::imageFormatsReadWrite_;
35 
36 
37 clfImage2D::clfImage2D(cl::Context *context, cl::CommandQueue *queue) : clfMemory(context, queue) {
38  width_ = 0;
39  height_ = 0;
40  stride_ = 0;
41  bitdepth_ = 8;
44  tex_ = NULL;
45  isSpare_ = false;
46  isInUse_ = false;
47 
48  if (imageFormatsReadable_.empty()) {
49  context_->getSupportedImageFormats(CL_MEM_READ_ONLY, CL_MEM_OBJECT_IMAGE2D, &imageFormatsReadable_);
50  }
51  if (imageFormatsWritable_.empty()) {
52  context_->getSupportedImageFormats(CL_MEM_READ_ONLY, CL_MEM_OBJECT_IMAGE2D, &imageFormatsWritable_);
53  }
54  if (imageFormatsReadWrite_.empty()) {
55  context_->getSupportedImageFormats(CL_MEM_READ_WRITE, CL_MEM_OBJECT_IMAGE2D, &imageFormatsReadWrite_);
56  }
57 }
58 
60 }
61 
64  unsigned int width, unsigned int height, unsigned int stride,
65  bool readonly, bool writeonly, const void *hostptr, bool copy) {
66 
67  st_ = st;
68  cm_ = cm;
69 
70  int cl_mem_flags = DetermineMemFlags_(readonly, writeonly, hostptr, copy);
71  if (cm == BIAS::ImageBase::CM_RGB) {
72  // if (!initialized_) {
73  // BIASWARN("RGB not supported, interpreting as Grey, width*3");
74  // }
76  height = height * 3;
77  }
78  cl::ImageFormat format = DetermineImageFormat_(st,cm);
79  if (!GetFormatSupported_(format, readonly, writeonly)) {
80  THROW_CL_EXCEPTION(cl::Error(-100, "requested image format is not supported by device."));
81  }
82  try {
83  if (stride == 0) {
84  switch (st) {
86  stride = BIAS::ImageBase::GetChannelcount(cm)*width*sizeof(float);
87  break;
89  stride = BIAS::ImageBase::GetChannelcount(cm)*width*sizeof(unsigned char);
90  break;
92  stride = BIAS::ImageBase::GetChannelcount(cm)*width*sizeof(unsigned short);
93  break;
95  stride = BIAS::ImageBase::GetChannelcount(cm)*width*sizeof(int);
96  break;
98  stride = BIAS::ImageBase::GetChannelcount(cm)*width*sizeof(unsigned int);
99  break;
100  default:
101  stride = BIAS::ImageBase::GetChannelcount(cm)*width*sizeof(unsigned char);
102  THROW_CL_EXCEPTION(cl::Error(-100, "please provide stride for your data type or extend code for automatic support."));
103  break;
104  }
105  }
106  if (initialized_ && !sharedGL_ && stride_ == stride && width == width_ && height == height_) {
107  // already allocated with correct size
108  return;
109  }
110  width_ = width;
111  height_ = height;
112  stride_ = stride;
113  size_ = stride*height;
114  buffer_ = cl::Image2D(*context_, cl_mem_flags, format, width_, height_, 0, (void*)hostptr);
115 
116  } catch(cl::Error &err) {
117  THROW_CL_EXCEPTION(err);
118  }
119  initialized_ = true;
120  sharedGL_ = false;
121 }
122 
123 void clfImage2D::AllocateFromBiasImage(const BIAS::ImageBase &image, bool readonly, bool writeonly, bool copy) {
124  Allocate(
125  image.GetStorageType(), image.GetColorModel(),
126  image.GetWidth(), image.GetHeight(), image.GetWidthStep(),
127  readonly, writeonly,
128  image.GetImageData(), copy);
129  bitdepth_ = image.GetBitDepth();
130  SetMetaData(*image.GetMetaData());
131 }
132 
133 void clfImage2D::AllocateFromBiasTemplate(const BIAS::ImageBase &image, bool readonly, bool writeonly) {
134  Allocate(
135  image.GetStorageType(), image.GetColorModel(),
136  image.GetWidth(), image.GetHeight(), image.GetWidthStep(),
137  readonly, writeonly);
138  bitdepth_ = image.GetBitDepth();
139  SetMetaData(*image.GetMetaData());
140 }
141 
142 void clfImage2D::AllocateFromTemplate(const clfImage2D &src, bool readonly, bool writeonly) {
143  if (src.st_ == BIAS::ImageBase::ST_invalid) {
146  // todo how to use cl::Imageformat directly here?
147  cl_image_format formatc = src.image().getImageInfo<CL_IMAGE_FORMAT>();
148  cl::ImageFormat format(formatc.image_channel_order, formatc.image_channel_data_type);
149  DetermineBIASFormat_(format, st, cm);
150  Allocate(st,cm, src.width_, src.height_, src.stride_, readonly, writeonly);
151  } else {
152  Allocate(src.st_, src.cm_, src.width_, src.height_, src.stride_, readonly, writeonly);
153  }
154 }
155 
156 void clfImage2D::AllocateFromTexture2D(BIAS::glfTexture2D &tex, bool readonly, bool writeonly) {
157  int cl_mem_flags = DetermineMemFlags_(readonly, writeonly);
158  cl_int err=0;
159  try {
160 #ifdef CL_VERSION_1_2
161  buffer_ = cl::ImageGL(*context_, cl_mem_flags, tex.GetTextureTarget(), 0, tex.GetTextureID());
162 #else
163  buffer_ = cl::Image2DGL(*context_, cl_mem_flags, tex.GetTextureTarget(), 0, tex.GetTextureID(),&err);
164 #endif
165  size_t memsize=0;
166  buffer_.getInfo(CL_MEM_SIZE, &memsize);
167  size_ = memsize;
168  /* todo this needs to be pulled from decs
169  width_ = tex.GetAllocWidth();
170  height_ = tex.GetAllocHeight();
171  st_ = tex.GetStorageType();
172  cm_ = tex.GetColorModel();
173  */
174  width_ = 0;
175  height_ = 0;
176  st_ = ImageBase::ST_float;
177  cm_ = ImageBase::CM_RGBA;
178  // st_ = ImageBase::ST_float;
179  if (size_ == 0) {// nvidia bug?? is always 0 on nv // changed from NULL to 0
180  BIASWARNONCE("cl image memory size reported 0. nvidia bug?");
182  }
183  } catch(cl::Error &e) {
184  THROW_CL_EXCEPTION(e);
185  }
186  initialized_ = true;
187  sharedGL_ = true;
188  tex_ = &tex;
189 }
190 
191 cl::Image2D& clfImage2D::image() const {
192  return (cl::Image2D&)buffer_;
193 }
194 
195 void clfImage2D::WriteToImage(const void *data, unsigned int originX, unsigned int originY, unsigned int regionX, unsigned int regionY, bool blocking) {
196  if (regionX == 0) {
197  regionX = width_;
198  }
199  if (regionY == 0) {
200  regionY = height_;
201  }
202  cl::size_t<3> origin, region;
203  MakeDim_(origin, originX, originY, 0);
204  MakeDim_(region, regionX, regionY, 1);
205 
206  try {
207  if (blocking)
208  queue_->enqueueWriteImage(image(), CL_TRUE, origin, region, 0, 0, (void*)data);
209  else
210  queue_->enqueueWriteImage(image(), CL_FALSE, origin, region, 0, 0, (void*)data);
211  } catch (cl::Error &error) {
212  THROW_CL_EXCEPTION(error);
213  }
214 }
215 
216 void clfImage2D::ReadFromImage(void *data, unsigned int originX, unsigned int originY, unsigned int regionX, unsigned int regionY) {
217  if (regionX == 0) {
218  regionX = width_;
219  }
220  if (regionY == 0) {
221  regionY = height_;
222  }
223  cl::size_t<3> origin, region;
224  MakeDim_(origin, originX, originY, 0);
225  MakeDim_(region, regionX, regionY, 1);
226  try {
227  queue_->enqueueReadImage(image(), CL_TRUE, origin, region, 0, 0, data);
228  } catch (cl::Error &error) {
229  THROW_CL_EXCEPTION(error);
230  }
231 }
232 
233 void clfImage2D::CopyToImage(clfImage2D &outputimage, unsigned int srcoriginX, unsigned int srcoriginY, unsigned int dstoriginX, unsigned int dstoriginY, unsigned int regionX, unsigned int regionY, bool blocking) {
234  if (regionX == 0) {
235  regionX = width_;
236  }
237  if (regionY == 0) {
238  regionY = height_;
239  }
240  cl::size_t<3> srcorigin, dstorigin, region;
241  MakeDim_(srcorigin, srcoriginX, srcoriginY, 0);
242  MakeDim_(dstorigin, dstoriginX, dstoriginY, 0);
243  MakeDim_(region, regionX, regionY, 1);
244  try {
245  if (blocking) {
246  cl::Event event;
247  queue_->enqueueCopyImage(image(), outputimage.image(), srcorigin, dstorigin, region, NULL, &event);
248  event.wait();
249  } else {
250  queue_->enqueueCopyImage(image(), outputimage.image(), srcorigin, dstorigin, region);
251  }
252  } catch (cl::Error &error) {
253  // BIASABORT;
254  THROW_CL_EXCEPTION(error);
255  }
256  outputimage.SetMetaData(MetaData_);
257 }
258 
259 void* clfImage2D::MapImage(bool write, unsigned int originX, unsigned int originY, unsigned int regionX, unsigned int regionY) {
260  try {
261  cl_map_flags mapflags = 0;
262  if (write) {
263  mapflags = CL_MAP_WRITE;
264  } else {
265  mapflags = CL_MAP_READ;
266  }
267  if (regionX == 0) {
268  regionX = width_;
269  }
270  if (regionY == 0) {
271  regionY = height_;
272  }
273  cl::size_t<3> origin, region;
274  MakeDim_(origin, originX, originY, 0);
275  MakeDim_(region, regionX, regionY, 1);
276  return queue_->enqueueMapImage(image(), CL_TRUE, mapflags, origin, region, 0, NULL);
277  } catch (cl::Error &error) {
278  THROW_CL_EXCEPTION(error);
279  }
280  return NULL;
281 }
282 
284  unsigned int originX, unsigned int originY,
285  unsigned int regionX, unsigned int regionY) {
286 
287  if (regionX == 0) {
288  regionX = width_;
289  }
290  if (regionY == 0) {
291  regionY = height_;
292  }
294  // todo really set for image?
295  cl_image_format formatc = this->image().getImageInfo<CL_IMAGE_FORMAT>();
296  cl::ImageFormat format(formatc.image_channel_order, formatc.image_channel_data_type);
297  DetermineBIASFormat_(format, st_, cm_);
298  }
299 // int sx = regionX - originX;
300 // int sy = regionY - originY;
301  if (!image.IsEmpty()) {
302  if (regionX == (int)image.GetWidth() && regionY == (int)image.GetHeight() && cm_ == image.GetColorModel() && st_ == image.GetStorageType()) {
303  // is already correctly initialized
304  } else {
305  if (st_ == image.GetStorageType()) {
306  image.Release(false);
307  } else {
308  image.Release(true);
309  }
310  image.Init(regionX,regionY, BIAS::ImageBase::GetChannelcount(cm_), st_);
311  }
312  } else {
313  image.Init(regionX,regionY, BIAS::ImageBase::GetChannelcount(cm_), st_);
314  }
315  ReadFromImage( image.GetImageData(), originX, originY, regionX, regionY );
316  image.SetMetaData(MetaData_);
317  image.SetColorModel(cm_);
318 }
319 
322  cl::Error err(-100, "only for rgba->rgb conversion");
323  THROW_CL_EXCEPTION(err);
324  }
325  unsigned int depth = image.GetByteDepth();
326  unsigned char *cldata = (unsigned char*)MapImage(false);
327  unsigned char *data = (unsigned char*)image.GetImageData();
328  for (unsigned int x=0;x<width_*height_;x++) {
329  for (unsigned int byte=0;byte<depth;byte++) {
330  *data++ = *cldata++;
331  }
332  for (unsigned int byte=0;byte<depth;byte++) {
333  *data++ = *cldata++;
334  }
335  for (unsigned int byte=0;byte<depth;byte++) {
336  *data++ = *cldata++;
337  }
338  for (unsigned int byte=0;byte<depth;byte++) {
339  cldata++;
340  }
341  }
342  UnMap(cldata);
343  image.SetMetaData(MetaData_);
344 }
345 
347  if (IsSharedGL()) {
348  st_ = st;
349  cm_ = cm;
350  } else {
351  cl::Error err(-100, "only for shared gl textures");
352  THROW_CL_EXCEPTION(err);
353  }
354 }
355 
356 std::vector<std::string> clfImage2D::GetSupportedImageFormats(bool readonly, bool writeonly) {
357  std::vector<cl::ImageFormat> *dat = NULL;
358  if (readonly) {
359  dat = &clfImage2D::imageFormatsReadable_;
360  } else if (writeonly) {
361  dat = &clfImage2D::imageFormatsWritable_;
362  } else {
363  dat = &clfImage2D::imageFormatsReadWrite_;
364  }
365  std::vector<std::string> result( dat->size() );
366  for (unsigned int i=0;i<dat->size();i++) {
367  switch ((*dat)[i].image_channel_order) {
368  case CL_R:
369  result[i] = "one channel (R) \t";
370  break;
371  case CL_A:
372  result[i] = "one channel (A) \t";
373  break;
374  case CL_INTENSITY:
375  result[i] = "one channel (Intensity)\t";
376  break;
377  case CL_LUMINANCE:
378  result[i] = "one channel (Luminance)\t";
379  break;
380  case CL_RG:
381  result[i] = "two channels (RG) \t";
382  break;
383  case CL_RA:
384  result[i] = "two channels (RA) \t";
385  break;
386  case CL_Rx:
387  result[i] = "two channels (Rx) \t";
388  break;
389  case CL_RGB:
390  result[i] = "three channels (RGB) \t";
391  break;
392  case CL_RGx:
393  result[i] = "three channels (RGx) \t";
394  break;
395  case CL_RGBA:
396  result[i] = "four channels (RGBA) \t";
397  break;
398  case CL_BGRA:
399  result[i] = "four channels (BGRA) \t";
400  break;
401  case CL_ARGB:
402  result[i] = "four channels (ARGB) \t";
403  break;
404  case CL_RGBx:
405  result[i] = "four channels (RGBx) \t";
406  break;
407  };
408  switch ((*dat)[i].image_channel_data_type) {
409  case CL_SNORM_INT8:
410  result[i] += "signed normalized char";
411  break;
412  case CL_SNORM_INT16:
413  result[i] += "signed normalized short";
414  break;
415  case CL_UNORM_INT8:
416  result[i] += "unsigned normalized char";
417  break;
418  case CL_UNORM_INT16:
419  result[i] += "unsigned normalized short";
420  break;
421  case CL_UNORM_SHORT_565:
422  result[i] += "unsigned normalized short 565";
423  break;
424  case CL_UNORM_SHORT_555:
425  result[i] += "unsigned normalized short 555";
426  break;
427  case CL_UNORM_INT_101010:
428  result[i] += "unsigned normalized int 101010";
429  break;
430  case CL_SIGNED_INT8:
431  result[i] += "signed char";
432  break;
433  case CL_SIGNED_INT16:
434  result[i] += "signed short";
435  break;
436  case CL_SIGNED_INT32:
437  result[i] += "signed int";
438  break;
439  case CL_UNSIGNED_INT8:
440  result[i] += "unsigned char";
441  break;
442  case CL_UNSIGNED_INT16:
443  result[i] += "unsigned short";
444  break;
445  case CL_UNSIGNED_INT32:
446  result[i] += "unsigned int";
447  break;
448  case CL_HALF_FLOAT:
449  result[i] += "half float";
450  break;
451  case CL_FLOAT:
452  result[i] += "float";
453  break;
454  }
455  }
456  return result;
457 }
458 
459 cl::ImageFormat clfImage2D::DetermineImageFormat_(BIAS::ImageBase::EStorageType st, BIAS::ImageBase::EColorModel cm) {
460  cl::ImageFormat format;
461  switch (st) {
463  format.image_channel_data_type = CL_SIGNED_INT8;
464  break;
466  format.image_channel_data_type = CL_UNSIGNED_INT16;
467  break;
469  format.image_channel_data_type = CL_SIGNED_INT16;
470  break;
472  format.image_channel_data_type = CL_UNSIGNED_INT32;
473  break;
475  format.image_channel_data_type = CL_SIGNED_INT32;
476  break;
478  format.image_channel_data_type = CL_FLOAT;
479  break;
481  format.image_channel_data_type = CL_UNSIGNED_INT8;
482  break;
485  default:
486  THROW_CL_EXCEPTION(cl::Error(-100, "image storage type not supported!"));
487  break;
488  }
489 
490  switch (cm) {
491  // one channel
497  format.image_channel_order = CL_R;
498  break;
501  format.image_channel_order = CL_INTENSITY;
502  break;
503  // two channel
508  format.image_channel_order = CL_RG;
509  break;
510  // three channel
519  format.image_channel_order = CL_RGB;
520  break;
521  // four channel
525  format.image_channel_order = CL_RGBA;
526  break;
527  default:
528  THROW_CL_EXCEPTION(cl::Error(-100, "color model not supported!"));
529  break;
530  }
531  return format;
532 }
533 
534 void clfImage2D::DetermineBIASFormat_(cl::ImageFormat format, BIAS::ImageBase::EStorageType &st, BIAS::ImageBase::EColorModel &cm) {
535  switch (format.image_channel_data_type) {
536  case CL_UNSIGNED_INT8:
538  break;
539  case CL_UNSIGNED_INT16:
541  break;
542  case CL_UNSIGNED_INT32:
544  break;
545  case CL_FLOAT:
547  break;
548  default:
550  break;
551  }
552 
553  switch (format.image_channel_order) {
554  case CL_R:
555  case CL_INTENSITY:
557  break;
558  case CL_RA:
559  case CL_RG:
561  break;
562  case CL_RGB:
564  break;
565  case CL_RGBA:
567  break;
568  default:
570  break;
571  }
572 }
573 
574 
575 bool clfImage2D::GetFormatSupported_(cl::ImageFormat test, bool readonly, bool writeonly) {
576  std::vector<cl::ImageFormat> *dat = NULL;
577  if (readonly) {
578  dat = &clfImage2D::imageFormatsReadable_;
579  } else if (writeonly) {
580  dat = &clfImage2D::imageFormatsWritable_;
581  } else {
582  dat = &clfImage2D::imageFormatsReadWrite_;
583  }
584  for (unsigned int i=0;i<dat->size();i++) {
585  if (test.image_channel_data_type == (*dat)[i].image_channel_data_type) {
586  if (test.image_channel_order == (*dat)[i].image_channel_order) {
587  return true;
588  }
589  }
590  }
591  return false;
592 }
593 
594 void clfImage2D::MakeDim_(cl::size_t<3> &dest, int x, int y, int z) {
595  dest[0] = x;
596  dest[1] = y;
597  dest[2] = z;
598 }
EColorModel
These are the most often used color models.
Definition: ImageBase.hh:127
YUYV422, 2 channels, full luminance Y, subsampled half U,V.
Definition: ImageBase.hh:133
std::vector< std::string > GetSupportedImageFormats(bool readonly=false, bool writeonly=false)
Definition: clfImage2D.cpp:356
Bayer_GRBG, 1 channel RGB image Bayer tile.
Definition: ImageBase.hh:145
hsl, similar to HSL but euclidean (h,s) for CNCC
Definition: ImageBase.hh:148
LAB, 3 channels, http://en.wikipedia.org/wiki/Lab_color_space.
Definition: ImageBase.hh:157
(16bit) unsigned integer image storage type
Definition: ImageBase.hh:114
void AllocateFromTexture2D(BIAS::glfTexture2D &tex, bool readonly=false, bool writeonly=false)
Allocation of a memory buffer from a GL Texture2D (works only on shared context!) ...
Definition: clfImage2D.cpp:156
virtual ~clfImage2D()
Definition: clfImage2D.cpp:59
void ReadFromImage(void *data, unsigned int originX=0, unsigned int originY=0, unsigned int regionX=0, unsigned int regionY=0)
read from image to host memory
Definition: clfImage2D.cpp:216
void * MapImage(bool write=false, unsigned int originX=0, unsigned int originY=0, unsigned int regionX=0, unsigned int regionY=0)
Definition: clfImage2D.cpp:259
HSL, similar to HSV but space is a double tipped cone.
Definition: ImageBase.hh:147
gray values, 1 channel
Definition: ImageBase.hh:130
A 2D texture.
Definition: glfTexture2D.hh:40
void Allocate(BIAS::ImageBase::EStorageType st, BIAS::ImageBase::EColorModel cm, unsigned int width, unsigned int height, unsigned int stride=0, bool readonly=false, bool writeonly=false, const void *hostptr=NULL, bool copy=false)
Allocation of a memory buffer as 2D image, either call directly or use wrapper for BIAS::ImageBase...
Definition: clfImage2D.cpp:62
bool IsEmpty() const
check if ImageData_ points to allocated image buffer or not
Definition: ImageBase.hh:245
(8bit) signed char image storage type
Definition: ImageBase.hh:113
unsigned int GetWidthStep() const
returns the number of bytes per line
Definition: ImageBase.hh:400
static int GetStorageSizeByte(const unsigned int &width, const unsigned int &height, const unsigned int nChannels, const enum EStorageType storageType)
computes the storage data size in Byte required for a given video format.
Definition: ImageBase.cpp:115
clfImage2D(cl::Context *context, cl::CommandQueue *queue)
Definition: clfImage2D.cpp:37
OpenCL Image2D wrapper.
Definition: clfImage2D.hh:46
void SetColorModel(EColorModel Model)
Definition: ImageBase.hh:561
void SetMetaData(const BIAS::MetaData &m)
Definition: clfImage2D.hh:138
Bayer_RGGB, 1 channel RGB image Bayer tile.
Definition: ImageBase.hh:143
MetaData * GetMetaData()
Definition: ImageBase.hh:456
float image storage type
Definition: ImageBase.hh:118
static int GetChannelcount(const enum BIAS::ImageBase::EColorModel &colormodel)
get the number of channels corresponding to the enum ColorModel Determines the number of (packed) dat...
Definition: ImageBase.cpp:1366
bool IsSharedGL()
Definition: clfMemory.hh:38
double image storage type
Definition: ImageBase.hh:119
XYZ, 3 channels, http://en.wikipedia.org/wiki/Xyz_color_space.
Definition: ImageBase.hh:156
void UnMap(void *data)
Definition: clfMemory.cpp:54
unsigned int GetWidth() const
Definition: ImageBase.hh:312
cl_channel_type image_channel_data_type
Definition: cl.h:87
unsigned int GetBitDepth() const
returns the bits per channel Is not necessairily 8*sizeof(StorageType), could be fewer bits...
Definition: ImageBase.hh:344
void AllocateFromBiasImage(const BIAS::ImageBase &image, bool readonly=false, bool writeonly=false, bool copy=false)
Allocation of a memory buffer as 2D image, either call directly or use wrapper for BIAS::ImageBase...
Definition: clfImage2D.cpp:123
int DetermineMemFlags_(bool readonly, bool writeonly, const void *hostptr=NULL, bool copy=false)
Definition: clfMemory.cpp:73
invalid not set image storage type
Definition: ImageBase.hh:111
cl::Context * context_
Definition: clfMemory.hh:54
GLuint GetTextureID() const
Returns the OpenGL texture id.
Definition: glfTexture.hh:144
(16bit) signed integer image storage type
Definition: ImageBase.hh:115
color values, 3 channels, order: blue,green,red
Definition: ImageBase.hh:132
Bayer_BGGR, 1 channel RGB image Bayer tile.
Definition: ImageBase.hh:146
const void * GetImageData() const
Definition: ImageBase.hh:280
void CopyToBiasImageUncheckedRGBAToRGB(BIAS::ImageBase &image)
Definition: clfImage2D.cpp:320
Disparity images Q: should disp and depth be treated separately, if not what would be a good name to ...
Definition: ImageBase.hh:158
void AllocateFromBiasTemplate(const BIAS::ImageBase &image, bool readonly=false, bool writeonly=false)
Definition: clfImage2D.cpp:133
Bayer_GBRG, 1 channel RGB image Bayer tile.
Definition: ImageBase.hh:144
cl::CommandQueue * queue_
Definition: clfMemory.hh:55
color values, 3 channels, order: red,green,blue
Definition: ImageBase.hh:131
cl_channel_order image_channel_order
Definition: cl.h:86
CIELUV color space, 3 channels, http://en.wikipedia.org/wiki/CIELUV_color_space.
Definition: ImageBase.hh:155
unsigned int GetHeight() const
Definition: ImageBase.hh:319
void SetStorageAndColorModelInfo(const BIAS::ImageBase::EStorageType &st, const BIAS::ImageBase::EColorModel &cm)
Definition: clfImage2D.cpp:346
cl::Image2D & image() const
Definition: clfImage2D.cpp:191
UYVY422, 2 channels, full luminance Y, subsampled half U,V inverse order.
Definition: ImageBase.hh:134
RGBA, 4 channels, order: red,green,blue,alpha.
Definition: ImageBase.hh:141
void Release(const bool reset_storage_type=false)
Free the allocated data structures Hands off: Do !!NOT!! change the default of reset_storage_type: Im...
Definition: ImageBase.cpp:350
enum EColorModel GetColorModel() const
Definition: ImageBase.hh:407
(32bit) signed integer image storage type
Definition: ImageBase.hh:117
RGBE color values, 4 channels, RADIANCE hdr format, four low dynamic channels meaning: 3x mantissa (r...
Definition: ImageBase.hh:151
void CopyToBiasImage(BIAS::ImageBase &image, unsigned int originX=0, unsigned int originY=0, unsigned int regionX=0, unsigned int regionY=0)
Definition: clfImage2D.cpp:283
void Init(unsigned int width, unsigned int height, unsigned int nChannels=1, enum EStorageType storageType=ST_unsignedchar, const bool interleaved=true)
Initialize image size and channels.
Definition: ImageBase.cpp:229
invalid (not set) image format
Definition: ImageBase.hh:129
enum EStorageType GetStorageType() const
Definition: ImageBase.hh:414
(8bit) unsigned char image storage type
Definition: ImageBase.hh:112
HSV, 3 channels, order: hue, sat , value.
Definition: ImageBase.hh:138
void AllocateFromTemplate(const clfImage2D &src, bool readonly=false, bool writeonly=false)
Definition: clfImage2D.cpp:142
GLenum GetTextureTarget() const
Returns the OpenGL texture target.
Definition: glfTexture.hh:150
cl::Memory buffer_
Definition: clfMemory.hh:56
void SetMetaData(const MetaData &m)
Definition: ImageBase.hh:470
Todo: Unclear, I think one channel float, why isn&#39;t grey used for that?
Definition: ImageBase.hh:153
GreyA, 2 channels, grey plus Alpha.
Definition: ImageBase.hh:142
This is the base class for images in BIAS.
Definition: ImageBase.hh:102
Depth images A: separated for now.
Definition: ImageBase.hh:159
unsigned int GetByteDepth() const
Definition: ImageBase.hh:334
void WriteToImage(const void *data, unsigned int originX=0, unsigned int originY=0, unsigned int regionX=0, unsigned int regionY=0, bool blocking=true)
write from host memory to image
Definition: clfImage2D.cpp:195
void CopyToImage(clfImage2D &outputimage, unsigned int srcoriginX=0, unsigned int srcoriginY=0, unsigned int dstoriginX=0, unsigned int dstoriginY=0, unsigned int regionX=0, unsigned int regionY=0, bool blocking=true)
Definition: clfImage2D.cpp:233
BGRA color values, 4 channels, order: blue,green,red,alpha.
Definition: ImageBase.hh:150
unsigned int size_
Definition: clfMemory.hh:58
(32bit) unsigned integer image storage type
Definition: ImageBase.hh:116