Image Component Library (ICL)
Img.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLCore/src/ICLCore/Img.h **
10 ** Module : ICLCore **
11 ** Authors: Christof Elbrechter, Michael Goetting, Robert **
12 ** Haschke, Andre Justus, Sergius Gaulik **
13 ** **
14 ** **
15 ** GNU LESSER GENERAL PUBLIC LICENSE **
16 ** This file may be used under the terms of the GNU Lesser General **
17 ** Public License version 3.0 as published by the **
18 ** **
19 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
20 ** included in the packaging of this file. Please review the **
21 ** following information to ensure the license requirements will **
22 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
23 ** **
24 ** The development of this software was supported by the **
25 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
26 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
27 ** Forschungsgemeinschaft (DFG) in the context of the German **
28 ** Excellence Initiative. **
29 ** **
30 ********************************************************************/
31 
32 #pragma once
33 
34 #include <ICLUtils/SmartPtr.h>
35 #include <ICLUtils/Exception.h>
36 #include <ICLCore/ImgBase.h>
37 #include <ICLCore/ImgIterator.h>
38 #include <ICLCore/Channel.h>
39 #include <ICLCore/PixelRef.h>
40 #include <ICLMath/DynMatrix.h>
41 #include <cmath>
42 #include <algorithm>
43 
44 
45 namespace icl {
46  namespace core{
48  template<class Type>
49  class ICLCore_API Img : public ImgBase
50  {
51 
52  /* this is declare as fried, because it accesses the private append function */
53  template<class ImgType> friend
54  const ImgType* combineImages (const std::vector<const ImgType*>& vec, ImgBase** ppoDst);
55 
57 
60  Img<Type>& shallowCopy(const Img<Type>& tSource);
61 
63 
66  void append(const Img<Type> *src, int iChannel=-1);
67 
69 
72  void append(const Img<Type> *src, const std::vector<int>& vChannels);
73 
74  protected:
75 
77  /* {{{ open */
78 
80  std::vector<utils::SmartArray<Type> > m_vecChannels;
82 
83  /* }}} */
84 
86  /* {{{ open */
87 
89 
92  utils::SmartArray<Type> createChannel(Type *ptDataToCopy=0) const;
93 
95 
121  int getStartIndex(int iIndex) const { return iIndex < 0 ? 0 : iIndex; }
122 
124 
129  int getEndIndex(int iIndex) const { return iIndex < 0 ? getChannels() : iIndex+1; }
130 
132 
133  /* }}} */
134 
136  /* {{{ open */
137 
139 
148  void normalize(int iChannel,
149  const utils::Range<Type> &srcRange,
150  const utils::Range<Type> &dstRange);
151 
153 
158  void mirror(axis eAxis, int iChannel,
159  const utils::Point& oOffset,
160  const utils::Size& oSize);
162  /* }}} */
163 
164  public:
165 
167  static const Img<Type> null;
168 
169  /* {{{ open */
171 
174  Img(const ImgParams &params = ImgParams::null);
175 
177 
181  Img(const utils::Size &size, int channels);
182 
184 
187  Img(const utils::Size &s, format fmt);
188 
190 
197  Img(const utils::Size &s, int channels, format fmt);
198 
200 
211  Img(const utils::Size &size, format format, const std::vector<Type*>& vptData,
212  bool passOwnerShip=false);
213 
215 
226  Img(const utils::Size &size, int channels,
227  const std::vector<Type*>& vptData, bool passOwnerShip=false);
228 
230 
243  Img(const utils::Size &size, int channels, format fmt,
244  const std::vector<Type*>& vptData, bool passOwnerShip=false);
245 
247 
262  Img(const Img<Type>& tSrc);
263 
264 
266 
278  Img(const math::DynMatrix<Type> &c1,
283 
284 
286  ~Img();
287 
289  bool isNull() const{
290  return getSize()==utils::Size::null && getChannels() == 0;
291  }
292 
293 
294  /* }}} */
295 
297  /* {{{ open */
298 
300  operator Img<Type>&(){
301  return *this;
302  }
303 
305  operator const Img<Type>&() const {
306  return *this;
307  }
308 
310 
324  Img<Type>& operator=(const Img<Type>& tSource) {
325  // call private const-version
326  return this->shallowCopy (static_cast<const Img<Type>&>(tSource));
327  }
328  /*
329  #ifdef WIN32
330  Img<Type>& operator=(const Img<Type>& tSource) {
331  // call private const-version
332  return this->shallowCopy (static_cast<const Img<Type>&>(tSource));
333  }
334  #endif
335 
336  #ifdef GCC_VER_423
337  Img<Type>& operator=(const Img<Type>& tSource) {
338  // call private const-version
339  return this->shallowCopy (static_cast<const Img<Type>&>(tSource));
340  }
341  #endif
342  */
343 
345 
372  Type& operator()(int iX, int iY, int iChannel) {
373  return const_cast<Type&>(static_cast<const Img<Type>*>(this)->operator()(iX,iY,iChannel));
374  }
375 
377  const Type& operator()(int iX, int iY, int iChannel) const {
378  return getData(iChannel)[iX+getWidth()*iY];
379  }
380 
382 
387  inline PixelRef<Type> operator()(int x, int y){
388  return PixelRef<Type>(x,y,getWidth(),m_vecChannels);
389  }
390 
392  inline const PixelRef<Type> operator()(int x, int y) const{
393  return const_cast<Img<Type>*>(this)->operator()(x,y);
394  }
395 
397 
400  return Channel<Type>(begin(channel),getSize(),getROI());
401  }
402 
404 
406  inline const Channel<Type> operator[](int channel) const {
407  return Channel<Type>(const_cast<Type*>(begin(channel)),getSize(),getROI());
408  }
409 
410 
412  float subPixelNN(float fX, float fY, int iChannel) const {
413  return (*this)((int)fX, (int)fY, iChannel);
414  }
415 
417  float subPixelLIN(float fX, float fY, int iChannel) const;
418 
420  float subPixelRA(float fX, float fY, float w, float h, int iChannel) const;
421  float subPixelRA(const unsigned int xB, const unsigned int xE,
422  const unsigned int yB, const unsigned int yE,
423  const float xBMul, const float xEMul, const float BMul, const float yEMul,
424  const Type *d, const unsigned int w) const;
425 
427  Type operator()(float fX, float fY, int iChannel, scalemode eMode) const;
428 
430 
431  /* }}} */
432 
434  /* {{{ open */
435 
436  /*inline <Type> operator[](int channel) {
437  return DynMatrix<Type>(getWidth(),getHeight(),begin(channel),false);
438  }*/
439 
441  /* This function cannot be called on (0,x) or (x,0)-sized images */
443  {
444  return math::DynMatrix<Type>(getWidth(),getHeight(),begin(channel),false);
445  }
447  /* This function cannot be called on (0,x) or (x,0)-sized images */
449  {
450  return math::DynMatrix<Type>(getWidth(),getHeight(),const_cast<Type*>(begin(channel)),false);
451  }
452 
454  inline void extractChannels(Channel<Type> *dst){
455  ICLASSERT_RETURN(dst);
456  for(int i=0;i<getChannels();++i){
457  dst[i] = (*this)[i];
458  }
459  }
460 
462 
463  inline void extractChannels(Channel<Type> *dst) const{
464  (void)dst;
465  ERROR_LOG("extracting channels of a const Img into an un-const Channel\n"
466  "is forbidden because it violates the const concept");
467  }
468 
470 
471  inline void extractChannels(const Channel<Type> *dst) const{
472  return const_cast<Img<Type>*>(this)->extractChannels(const_cast<Channel<Type>*>(dst));
473  }
474 
476  inline void extractPointers(Type **dst){
477  for(int i=0;i<getChannels();++i){
478  dst[i] = begin(i);
479  }
480  }
481 
483 
484  inline void extractPointers(Type **dst) const{
485  (void)dst;
486  ERROR_LOG("extracting channel data of a const Img into an un-const pointer\n"
487  "is forbidden because it violates the const concept");
488  }
489 
491  inline void extractPointers(const Type **dst) const{
492  for(int i=0;i<getChannels();++i){
493  dst[i] = begin(i);
494  }
495  }
496 
497 
498 
500 
501  /* }}} */
502 
503 
505  /* {{{ open */
506 
507  virtual Img<Type> *shallowCopy(const utils::Rect &roi,
508  const std::vector<int> &channelIndices,
509  format fmt,
511  ImgBase **ppoDst = NULL);
512 
526  const std::vector<int> &channelIndices,
527  format fmt,
528  utils::Time time=utils::Time::null) const{
529  // casting constness away is safe, because we effectively return a const Img<Type>*
530  return const_cast<Img<Type>*>(this)->shallowCopy(roi,channelIndices,fmt,time,0);
531  }
532 
533 
535 
541  ImgBase *poDstBase = poDst;
542  return shallowCopy(getROI(),std::vector<int>(),newFmt,getTime(),&poDstBase);
543  }
544 
545 
547 
552  return shallowCopy(getROI(),std::vector<int>(),newFmt,getTime());
553  }
555 
567  ImgBase *poDstBase = poDst;
568  return shallowCopy(roi,std::vector<int>(),getFormat(),getTime(),&poDstBase);
569  }
570 
572 
581  const Img<Type>* shallowCopy(const utils::Rect& roi) const {
582  // casting constness away is safe, because we effectively return a const Img<Type>*
583  return const_cast<Img<Type>*>(this)->shallowCopy(roi,0);
584  }
585 
586 
588 
597  Img<Type>* selectChannels (const std::vector<int>& channelIndices, Img<Type>* poDst=0){
598  ImgBase *poDstBase = poDst;
599  return shallowCopy(getROI(),channelIndices,formatMatrix,getTime(),&poDstBase);
600  }
601 
603 
610  Img<Type> *selectChannel(int channelIndex, Img<Type> *poDst=0){
611  ICLASSERT_RETURN_VAL(validChannel(channelIndex), 0);
612  std::vector<int> v(1); v[0]= channelIndex;
613  return selectChannels(v,poDst);
614  }
616 
619  const Img<Type>* selectChannels (const std::vector<int>& channelIndices) const {
620  // casting constness away is safe, because we effectively return a const Img<Type>*
621  return const_cast<Img<Type>*>(this)->selectChannels(channelIndices, 0);
622  }
623 
625 
631  const Img<Type> *selectChannel(int channelIndex) const{
632  ICLASSERT_RETURN_VAL(validChannel(channelIndex), 0);
633  std::vector<int> v(1); v[0]= channelIndex; return selectChannels(v);
634  }
635 
636  //------------------------------------------------------------------------------
637  //------------------------------------------------------------------------------
638  //------------------------------------------------------------------------------
639 
640 
641 
642 
643 
645 
646  virtual Img<Type>* deepCopy(ImgBase** ppoDst=0) const;
647 
649 
656  Img<Type> *deepCopy(Img<Type> *poDst) const;
657 
659 
660  virtual Img<Type> *deepCopyROI(ImgBase **ppoDst=0) const;
661 
662 
664 
674  Img<Type> *deepCopyROI(Img<Type> *poDst) const;
675 
677  /* }}} */
678 
680  /* {{{ open */
681 
683 
684  virtual Img<Type> *scaledCopy(const utils::Size &newSize, scalemode eScaleMode=interpolateNN) const;
685 
687 
688  virtual Img<Type> *scaledCopy(ImgBase **ppoDst=0, scalemode eScaleMode=interpolateNN) const;
689 
690 
692 
698  Img<Type> *scaledCopy(Img<Type> *poDst, scalemode eScaleMode=interpolateNN) const;
699 
701 
702  virtual Img<Type> *scaledCopyROI(const utils::Size &newSize, scalemode eScaleMode=interpolateNN) const;
703 
705 
706  virtual Img<Type> *scaledCopyROI(ImgBase **ppoDst=0, scalemode eScaleMode=interpolateNN) const;
707 
709 
715  Img<Type> *scaledCopyROI(Img<Type> *poDst, scalemode eScaleMode=interpolateNN) const;
716 
718  /* }}} */
719 
721  /* {{{ open */
722 
724 
725  virtual void detach(int iIndex = -1);
726 
728 
735  inline Img<Type> detached() const {
736  Img<Type> detachedCopy = *this;
737  detachedCopy.detach();
738  return detachedCopy;
739  }
740 
742 
743  virtual void removeChannel(int iChannel);
744 
746 
756  void append(Img<Type> *src, int iChannel=-1) {
757  // call private const-version
758  this->append (static_cast<const Img<Type>*>(src), iChannel);
759  }
760 
762 
764  void append(Img<Type> *src, const std::vector<int>& vChannels) {
765  // call private const-version
766  this->append (static_cast<const Img<Type>*>(src), vChannels);
767  }
768 
770 
772  Img<Type> extractChannelImg(int index);
773 
775 
777  const Img<Type> extractChannelImg(int index) const;
778 
780 
782  Img<Type> extractChannelImg(const std::vector<int> &indices);
783 
785 
787  const Img<Type> extractChannelImg(const std::vector<int> &indices) const;
788 
789 
791 
792  virtual void swapChannels(int iIndexA, int iIndexB);
793 
795 
800  void replaceChannel(int iThisIndex, Img<Type> *poOtherImg, int iOtherIndex);
801 
803 
804  virtual void setChannels(int iNewNumChannels);
805 
807 
808  virtual void setSize(const utils::Size &s);
809 
811 
812  /* }}} */
813 
815  /* {{{ open */
816 
818 
822  Type getMax(int iChannel, utils::Point *coords=0) const;
823 
825 
829  Type getMin(int iChannel, utils::Point *coords=0) const;
830 
831 
833  Type getMin() const;
834 
836  Type getMax() const;
837 
839 
845  const utils::Range<Type> getMinMax(int iChannel,
846  utils::Point *minCoords=0,
847  utils::Point *maxCoords=0) const;
848 
850  const utils::Range<Type> getMinMax() const;
851 
853 
854  virtual int getLineStep() const{
855  return getSize().width*sizeof(Type);
856  }
857 
859 
864  Type* getData(int iChannel) {
865  return const_cast<Type*>(static_cast<const Img<Type>*>(this)->getData(iChannel));
866  }
867 
869 
870  const Type* getData(int iChannel) const {
871  FUNCTION_LOG("");
872  ICLASSERT_RETURN_VAL(validChannel(iChannel), 0);
873  return m_vecChannels[iChannel].get();
874  }
875 
877 
896  Type* getROIData(int iChannel) {
897  return const_cast<Type*>(static_cast<const Img<Type>*>(this)->getROIData(iChannel));
898  }
899 
901 
902  const Type* getROIData(int iChannel) const {
903  FUNCTION_LOG("");
904  ICLASSERT_RETURN_VAL(validChannel(iChannel),0);
905  return getData(iChannel) + m_oParams.getPixelOffset();
906  }
907 
909 
918  Type* getROIData(int iChannel, const utils::Point &p) {
919  return const_cast<Type*>(static_cast<const Img<Type>*>(this)->getROIData(iChannel, p));
920  }
922 
923  const Type* getROIData(int iChannel, const utils::Point &p) const {
924  FUNCTION_LOG("");
925  ICLASSERT_RETURN_VAL(validChannel(iChannel),0);
926  return getData(iChannel) + p.x + (p.y * getWidth());
927  }
928 
930 
931  virtual void* getDataPtr(int iChannel){
932  return getData(iChannel);
933  }
934 
936 
937  virtual const void* getDataPtr(int iChannel) const{
938  return getData(iChannel);
939  }
940 
942 
943  /* }}} */
944 
946  /* {{{ open */
947 
948 
950 
976  template<typename UnaryFunction>
977  inline Img<Type> &forEach_C(UnaryFunction f, int channel){
978  ICLASSERT_RETURN_VAL(validChannel(channel),*this);
979  if(hasFullROI()){
980  std::for_each<Type*,UnaryFunction>(getData(channel),getData(channel)+getDim(),f);
981  }else{
982  const_roi_iterator end = endROI(channel);
983  for(ImgIterator<Type> it = beginROI(channel); it != end; it.incRow()){
984  std::for_each<Type*,UnaryFunction>(&(*it),&(*it)+it.getSubRectWidth(),f);
985  }
986  }
987  return *this;
988  }
989 
991 
1010  template<typename UnaryFunction>
1011  inline Img<Type> &forEach(UnaryFunction f){
1012  for(int c=0;c<getChannels();++c){
1013  forEach_C(f,c);
1014  }
1015  return *this;
1016  }
1017 
1019 
1042  template<typename UnaryFunction, class dstType>
1043  inline Img<dstType> &transform_C(UnaryFunction f, int srcChannel, int dstChannel, Img<dstType> &dst) const{
1044  ICLASSERT_RETURN_VAL(getROISize() == dst.getROISize(),dst);
1045  ICLASSERT_RETURN_VAL(validChannel(srcChannel),dst);
1046  ICLASSERT_RETURN_VAL(dst.validChannel(dstChannel),dst);
1047 
1048  if(hasFullROI() && dst.hasFullROI()){
1049  std::transform(getData(srcChannel),getData(srcChannel)+getDim(),dst.getData(dstChannel),f);
1050  }else{
1051  ImgIterator<dstType> itDst = dst.beginROI(dstChannel);
1052  const_roi_iterator end = endROI(srcChannel);
1053  for(const_roi_iterator it = beginROI(srcChannel); it != end; it.incRow(), itDst.incRow()){
1054  std::transform(&(*it),&(*it)+it.getSubRectWidth(),&(*itDst),f);
1055  }
1056  }
1057  return dst;
1058  }
1059 
1061 
1083  template<typename UnaryFunction,class dstType>
1084  inline Img<dstType> &transform(UnaryFunction f, Img<dstType> &dst) const{
1085  ICLASSERT_RETURN_VAL(getChannels() == dst.getChannels(),dst);
1086  for(int c=0;c<getChannels();++c){
1087  transform_C(f,c,c,dst);
1088  }
1089  return dst;
1090  }
1091 
1092 
1094 
1134  template<typename BinaryFunction, class dstType, class otherSrcType>
1135  inline Img<dstType> &combine_C(BinaryFunction f,
1136  int thisChannel,
1137  int otherSrcChannel,
1138  int dstChannel,
1139  const Img<otherSrcType> &otherSrc,
1140  Img<dstType> &dst) const{
1141  ICLASSERT_RETURN_VAL(getROISize() == dst.getROISize()&& getROISize() == otherSrc.getROISize(),dst);
1142  ICLASSERT_RETURN_VAL(validChannel(thisChannel),dst);
1143  ICLASSERT_RETURN_VAL(otherSrc.validChannel(otherSrcChannel),dst);
1144  ICLASSERT_RETURN_VAL(dst.validChannel(dstChannel),dst);
1145 
1146  if(hasFullROI() && dst.hasFullROI() && otherSrc.hasFullROI()){
1147  std::transform(getData(thisChannel),getData(thisChannel)+getDim(),otherSrc.getData(otherSrcChannel),dst.getData(dstChannel),f);
1148  }else{
1149  ImgIterator<dstType> itDst = dst.beginROI(dstChannel);
1150  const ImgIterator<otherSrcType> itOtherSrc = otherSrc.beginROI(otherSrcChannel);
1151  const_roi_iterator end = endROI(thisChannel);
1152  for(const_roi_iterator it = beginROI(thisChannel); it!=end; it.incRow(), itDst.incRow(),itOtherSrc.incRow()){
1153  std::transform(&(*it),&(*it)+it.getROIWidth(),&(*itOtherSrc),&(*itDst),f);
1154  }
1155  }
1156  return dst;
1157  }
1158 
1159 
1161 
1189  template<typename BinaryFunction, class dstType, class otherSrcType>
1190  inline Img<dstType> &combine(BinaryFunction f, const Img<otherSrcType> &otherSrc, Img<dstType> &dst) const{
1191  ICLASSERT_RETURN_VAL(getChannels() == otherSrc.getChannels(),dst);
1192  ICLASSERT_RETURN_VAL(getChannels() == dst.getChannels(),dst);
1193  for(int c=0;c<getChannels();++c){
1194  combine_C(f,c,c,c,otherSrc,dst);
1195  }
1196  return dst;
1197  }
1198 
1199 
1200 
1201  private:
1203  template<typename Tsrc, typename Tdst, int Nsrc, int Ndst, typename ReduceFunc>
1204  static inline void reduce_arrays(const Tsrc *src[Nsrc], Tdst *dst[Ndst], unsigned int dim, ReduceFunc reduce){
1205  for(int i=dim-1;i>=0;--i){
1206  Tsrc tsrc[Nsrc];
1207  Tdst tdst[Ndst];
1208  for(int j=0;j<Nsrc;tsrc[j]=src[j][i],++j) {}
1209  reduce(tsrc,tdst);
1210  for(int j=0;j<Ndst;dst[j][i]=tdst[j],++j) {}
1211 
1212  }
1213  }
1214 
1215  public:
1216 
1217 
1219 
1253  template<typename Tdst, int Nthis, int Ndst, typename ReduceFunc>
1254  void reduce_channels(Img<Tdst> &dst, ReduceFunc reduce) const {
1255  ICLASSERT_RETURN(this->getROISize() == dst.getROISize());
1256  ICLASSERT_RETURN((Nthis > 0) && (Ndst > 0));
1257  ICLASSERT_RETURN((this->getChannels()==Nthis) && (dst.getChannels()==Ndst));
1258 
1259  const Type *psrc[Nthis];
1260  Tdst *pdst[Ndst];
1261  if(this->hasFullROI() && dst.hasFullROI()){
1262  for(int i=0;i<Nthis;psrc[i]=this->getData(i),++i) {}
1263  for(int i=0;i<Ndst;pdst[i]=dst.getData(i),++i) {}
1264  reduce_arrays<Type,Tdst,Nthis,Ndst,ReduceFunc>(psrc,pdst,this->getDim(),reduce);
1265  }else{
1266  const_roi_iterator itSrc[Nthis];
1267  ImgIterator<Tdst> itDst[Ndst];
1268  for(int i=0;i<Nthis;itSrc[i]=this->beginROI(i),++i) {}
1269  for(int i=0;i<Ndst;itDst[i]=dst.beginROI(i),++i) {}
1270 
1271  for(int l=this->getROI().height-1, w=this->getROI().width ;l>=0;--l){
1272  for(int i=0;i<Nthis;itSrc[i].incRow(),++i){
1273  psrc[i]=&(*(itSrc[i]));
1274  }
1275  for(int i=0;i<Ndst;itDst[i].incRow(),++i){
1276  pdst[i]=&(*(itDst[i]));
1277  }
1278  reduce_arrays<Type,Tdst,Nthis,Ndst,ReduceFunc>(psrc,pdst,w,reduce);
1279  }
1280  }
1281  }
1282 
1284 
1287  Img<Type> *lut(const Type *lut, Img<Type> *dst = 0,int bits=8) const;
1288 
1290 
1291  virtual void scale(const utils::Size &s, scalemode eScaleMode=interpolateNN);
1292 
1294 
1295  virtual void mirror(axis eAxis, bool bOnlyROI=false);
1296 
1298 
1302  void clear(int iChannel = -1, Type tValue = 0, bool bROIOnly=true);
1303 
1305 
1321  template<class T>
1322  inline void fill(const T &value){
1323  for(int i=0;i<getChannels();++i){
1324  std::fill(begin(i),end(i),value);
1325  }
1326  }
1327 
1329  template<class T>
1330  inline void fillChannel(int channel, const T &value){
1331  std::fill(begin(channel),end(channel),value);
1332  }
1333 
1334 
1336  template<class T>
1337  inline void fillROI(const T &value){
1338  for(int i=0;i<getChannels();++i){
1339  std::fill(beginROI(i),endROI(i),value);
1340  }
1341  }
1342 
1344  template<class T>
1345  inline void fillChannelROI(int channel, const T &value){
1346  std::fill(beginROI(channel),endROI(channel),value);
1347  }
1348 
1349 
1351 
1355  void normalizeAllChannels(const utils::Range<Type> &dstRange);
1356 
1358 
1362  void normalizeChannel(int iChannel, const utils::Range<Type> &srcRange,
1363  const utils::Range<Type> &dstRange);
1364 
1366 
1371  void normalizeChannel(int iChannel,const utils::Range<Type> &dstRange);
1372 
1374 
1377  void normalizeImg(const utils::Range<Type> &srcRange,
1378  const utils::Range<Type> &dstRange);
1379 
1381 
1385  void normalizeImg(const utils::Range<Type> &dstRange);
1386 
1388 
1389  /* }}} */
1390 
1392  /* {{{ open */
1393 
1395  typedef Type* iterator;
1396 
1398  typedef const Type* const_iterator;
1399 
1402 
1405  // old typedef constConstImgIterator<Type> const_iterator;
1406 
1407 
1408 
1410  inline iterator begin(int channel){
1411  return getData(channel);
1412  }
1413 
1415  inline const_iterator begin(int channel) const{
1416  return const_cast<Img<Type>*>(this)->begin(channel);
1417  }
1418 
1421  return getData(channel)+getDim();
1422  }
1423 
1426  return getData(channel)+getDim();
1427  }
1428 
1431  ICLASSERT_RETURN_VAL(validChannel(channel), roi_iterator());
1432  return roi_iterator(getData(channel),getWidth(),getROI());
1433  }
1434 
1437  ICLASSERT_RETURN_VAL(validChannel(channel), roi_iterator());
1438  return const_cast<Img<Type>*>(this)->beginROI(channel);
1439  }
1440 
1442 
1444  ICLASSERT_RETURN_VAL(validChannel(channel), roi_iterator());
1445  return roi_iterator::create_end_roi_iterator(getData(channel),getWidth(),getROI());
1446  }
1447 
1449  inline const_roi_iterator endROI(int channel) const{
1450  ICLASSERT_RETURN_VAL(validChannel(channel), roi_iterator());
1451  return const_roi_iterator::create_end_roi_iterator(getData(channel),getWidth(),getROI());
1452  }
1453 
1454 
1456 
1467  utils::Point getLocation(const Type *p, int channel, bool relToROI=false) const;
1468 
1470 
1476  void printAsMatrix(const std::string &format="5.3", bool visROI=true) const;
1477 
1479 
1480  virtual bool isIndependent() const;
1482 
1483  /* }}} */
1484 
1486  /* {{{ open */
1487 
1489 
1493  virtual void fillBorder(bool setFullROI=true);
1494 
1496  virtual void fillBorder(icl64f val, bool setFullROI=true);
1497 
1499 
1502  virtual void fillBorder(const std::vector<icl64f> &vals, bool setFullROI=true);
1503 
1504 
1506 
1510  virtual void fillBorder(const ImgBase *src, bool setFullROI=true);
1511 
1513  /* }}} */
1514 
1515 
1516  };// class Img<Type>
1517 
1518 
1519  /* {{{ global functions */
1520 
1522 
1525  template<class T> struct ICLCore_API ImgBasePtrPtr {
1527  ImgBasePtrPtr(Img<T> &i);
1528 
1530  ImgBasePtrPtr(Img<T> *i);
1531 
1533 
1543  ~ImgBasePtrPtr();
1544 
1546  operator ImgBase** (){ return &r; }
1547 
1548  private:
1550  ImgBase *o,*r,*rbef;
1551  };
1552 
1554 
1584  template<class T>
1585  ImgBasePtrPtr<T> bpp(Img<T> *image) { return ImgBasePtrPtr<T>(image); }
1586 
1588 
1589  template<class T>
1590  ImgBasePtrPtr<T> bpp(Img<T> &image) { return ImgBasePtrPtr<T>(image); }
1591 
1592 
1594 
1638  template<class T>
1639  static inline T p2o(T *ptr){
1640  return *utils::SmartPtr<T>(ptr);
1641  }
1642 
1644  template<class ImgType>
1645  const ImgType* combineImages(const std::vector<const ImgType*>& vec);
1646 
1648  template<class ImgType>
1649  ImgType* combineImages(const std::vector<ImgType*>& vec) {
1650  return const_cast<ImgType*>(combineImages(reinterpret_cast<const std::vector<const ImgType*>&>(vec)));
1651  }
1652 
1653  /* {{{ deepCopyChannel */
1655  template<class T>
1656  inline void deepCopyChannel(const Img<T> *src, int srcC, Img<T> *dst, int dstC){
1657  FUNCTION_LOG("");
1658  ICLASSERT_RETURN( src && dst );
1659  ICLASSERT_RETURN( src->getSize() == dst->getSize() );
1660  ICLASSERT_RETURN( src->validChannel(srcC) );
1661  ICLASSERT_RETURN( dst->validChannel(dstC) );
1662  icl::core::copy<T>(src->getData(srcC),src->getData(srcC)+src->getDim(),dst->getData(dstC));
1663  }
1664 
1665  /* }}} */
1666 
1667  /* {{{ convertChannel */
1668 
1670 
1678  template<class S,class D>
1679  inline void convertChannel(const Img<S> *src, int srcC, Img<D> *dst, int dstC){
1680  FUNCTION_LOG("");
1681  ICLASSERT_RETURN( src && dst );
1682  ICLASSERT_RETURN( src->getSize() == dst->getSize() );
1683  ICLASSERT_RETURN( src->validChannel(srcC) );
1684  ICLASSERT_RETURN( dst->validChannel(dstC) );
1685  icl::core::convert<S,D>(src->getData(srcC),src->getData(srcC)+src->getDim(),dst->getData(dstC));
1686  }
1687 
1688  /* }}} */
1689 
1690  /* {{{ clearChannelROI */
1691 
1693 
1701  template<class T>
1702  inline void clearChannelROI(Img<T> *im, int c, T clearVal, const utils::Point &offs,
1703  const utils::Size &size) {
1704  FUNCTION_LOG("");
1705  ICLASSERT_RETURN( im );
1706 
1707  ImgIterator<T> it(im->getData(c),im->getSize().width,utils::Rect(offs,size));
1709  im->getWidth(),
1710  utils::Rect(offs,size));
1711  std::fill(it,itEnd,clearVal);
1712  }
1713 
1715 #ifdef ICL_HAVE_IPP
1716  template <>
1718  inline void clearChannelROI(Img<icl8u> *im, int c, icl8u clearVal, const utils::Point &offs,
1719  const utils::Size &size){
1720  FUNCTION_LOG("");
1721  ICLASSERT_RETURN( im );
1722  ippiSet_8u_C1R(clearVal,im->getROIData(c,offs),im->getLineStep(),size);
1723  }
1725  template <>
1726  inline void clearChannelROI(Img<icl16s> *im, int c, icl16s clearVal, const utils::Point &offs,
1727  const utils::Size &size){
1728  FUNCTION_LOG("");
1729  ICLASSERT_RETURN( im );
1730  ippiSet_16s_C1R(clearVal,im->getROIData(c,offs),im->getLineStep(),size);
1731  }
1733  template <>
1734  inline void clearChannelROI(Img<icl32s> *im, int c, icl32s clearVal,
1735  const utils::Point &offs, const utils::Size &size){
1736  FUNCTION_LOG("");
1737  ICLASSERT_RETURN( im );
1738  ippiSet_32s_C1R(clearVal,im->getROIData(c,offs),im->getLineStep(),size);
1739  }
1741  template <>
1742  inline void clearChannelROI(Img<icl32f> *im, int c, icl32f clearVal,
1743  const utils::Point &offs, const utils::Size &size){
1744  FUNCTION_LOG("");
1745  ICLASSERT_RETURN( im );
1746  ippiSet_32f_C1R(clearVal,im->getROIData(c,offs),im->getLineStep(),size);
1747  }
1748 #endif
1749 
1751  /* }}} */
1752 
1754 #define CHECK_VALUES(src,srcC,srcOffs,srcSize,dst,dstC,dstOffs,dstSize) \
1756  FUNCTION_LOG(""); \
1757  ICLASSERT_RETURN( src && dst ); \
1758  ICLASSERT_RETURN( srcSize == dstSize ); \
1759  ICLASSERT_RETURN( src->validChannel(srcC) ); \
1760  ICLASSERT_RETURN( dst->validChannel(dstC) ); \
1761  ICLASSERT_RETURN( srcOffs.x >= 0 && srcOffs.y >= 0 && dstOffs.x >= 0 && dstOffs.y >= 0); \
1762  ICLASSERT_RETURN( srcOffs.x+srcSize.width <= src->getWidth() && srcOffs.y+srcSize.height <= src->getHeight() ); \
1763  ICLASSERT_RETURN( dstOffs.x+dstSize.width <= dst->getWidth() && dstOffs.y+dstSize.height <= dst->getHeight() );
1764 
1769  /* {{{ deepCopyChannelROI */
1770 
1772 
1782  template <class T>
1783  inline void deepCopyChannelROI(const Img<T> *src, int srcC, const utils::Point &srcOffs,
1784  const utils::Size &srcSize,
1785  Img<T> *dst,int dstC, const utils::Point &dstOffs,
1786  const utils::Size &dstSize) {
1787  CHECK_VALUES(src,srcC,srcOffs,srcSize,dst,dstC,dstOffs,dstSize);
1788 
1789  const ImgIterator<T> itSrc(const_cast<T*>(src->getData(srcC)),
1790  src->getSize().width,
1791  utils::Rect(srcOffs,srcSize));
1792  ImgIterator<T> itDst(dst->getData(dstC),dst->getSize().width,utils::Rect(dstOffs,dstSize));
1794  src->getWidth(),
1795  utils::Rect(srcOffs,srcSize));
1796 
1797  for(;itSrc != itSrcEnd;itSrc.incRow(),itDst.incRow()){
1798  icl::core::copy<T>(&*itSrc,&*itSrc+srcSize.width,&*itDst);
1799  }
1800  }
1801 
1802  /* }}} */
1803 
1804  /* {{{ convertChannelROI */
1805 
1808 
1822  template <class S,class D>
1823  inline void convertChannelROI(const Img<S> *src, int srcC, const utils::Point &srcOffs,
1824  const utils::Size &srcROISize,
1825  Img<D> *dst,int dstC, const utils::Point &dstOffs,
1826  const utils::Size &dstROISize)
1827  {
1828  FUNCTION_LOG("");
1829  CHECK_VALUES(src,srcC,srcOffs,srcROISize,dst,dstC,dstOffs,dstROISize);
1830 
1831  const ImgIterator<S> itSrc(const_cast<S*>(src->getData(srcC)),
1832  src->getSize().width,
1833  utils::Rect(srcOffs,srcROISize));
1834  ImgIterator<D> itDst(dst->getData(dstC),dst->getSize().width,
1835  utils::Rect(dstOffs,dstROISize));
1837  src->getWidth(),
1838  utils::Rect(srcOffs,srcROISize));
1839  for(;itSrc != itSrcEnd ;itSrc.incRow(),itDst.incRow()){
1840  icl::core::convert<S,D>(&*itSrc,&*itSrc+srcROISize.width,&*itDst);
1841  }
1842  }
1843 
1845 
1846  /* }}} */
1847 
1848  /* {{{ scaledCopyChannelROI */
1849 
1852 
1865  template<class T> ICLCore_API
1866  void scaledCopyChannelROI(const Img<T> *src, int srcC,
1867  const utils::Point &srcOffs,
1868  const utils::Size &srcSize,
1869  Img<T> *dst,int dstC,
1870  const utils::Point &dstOffs,
1871  const utils::Size &dstSize,
1872  scalemode eScaleMode);
1873 
1874  /* }}} */
1875 
1876  /* {{{ flippedCopyChannelROI */
1877 
1879 
1891  template <class T> ICLCore_API
1892  void flippedCopyChannelROI(axis eAxis,
1893  const Img<T> *src,int srcC, const utils::Point &srcOffs,
1894  const utils::Size &srcSize,
1895  Img<T> *dst,int dstC, const utils::Point &dstOffs,
1896  const utils::Size &dstSize);
1897 
1898 
1900 
1914  ICLCore_API void flippedCopy(axis eAxis, const ImgBase *poSrc, ImgBase **ppoDst = 0);
1915 
1917 
1934  ICLCore_API void flippedCopyROI(axis eAxis, const ImgBase *poSrc, ImgBase **ppoDst = 0);
1935  /* }}} */
1936 
1937  /* }}} */
1938  } // namespace core
1939 } //namespace icl
1940 
1941 #undef CHECK_VALUES
1942 
Img< Type > & forEach(UnaryFunction f)
STL based "for_each" implementations applying an Unary function on each ROI-pixel.
Definition: Img.h:1011
ImgBase * rbef
Definition: Img.h:1550
class representing a range defined by min and max value
Definition: Range.h:49
int getWidth() const
returns the images width
Definition: ImgBase.h:480
Pixel-Type class for copying image pixles to image pixels.
Definition: PixelRef.h:60
void append(Img< Type > *src, const std::vector< int > &vChannels)
Append a set of selected channels from source image.
Definition: Img.h:764
const Img< Type > * selectChannels(const std::vector< int > &channelIndices) const
Create a shallow copy of selected channels of a const image.
Definition: Img.h:619
int getEndIndex(int iIndex) const
returns the end index for a channel loop
Definition: Img.h:129
iterator begin(int channel)
returns the image iterator (equal to getData(channel))
Definition: Img.h:1410
undocument this line if you encounter any issues!
Definition: Any.h:37
void extractChannels(Channel< Type > *dst) const
this function is forbidden, it produces an error message
Definition: Img.h:463
static const Size null
null is w=0, h=0
Definition: Size.h:64
const_iterator begin(int channel) const
returns the image iterator (equal to getData(channel)) (const)
Definition: Img.h:1415
Ipp8u icl8u
8Bit unsigned integer type for the ICL
Definition: BasicTypes.h:64
ImgBasePtrPtr< T > bpp(Img< T > *image)
utility function to cast an Img<T> implicitly into an ImgBase **
Definition: Img.h:1585
Img< Type > & operator=(const Img< Type > &tSource)
Assign operator (flat copy of channels) WARNING: Violates const concept.
Definition: Img.h:324
Img< Type > * selectChannels(const std::vector< int > &channelIndices, Img< Type > *poDst=0)
Create a shallow copy of selected channels of an image.
Definition: Img.h:597
void convertChannelROI(const Img< S > *src, int srcC, const utils::Point &srcOffs, const utils::Size &srcROISize, Img< D > *dst, int dstC, const utils::Point &dstOffs, const utils::Size &dstROISize)
Definition: Img.h:1823
const Img< Type > * selectChannel(int channelIndex) const
Create a shallow copy of a single image channel of a const image.
Definition: Img.h:631
Highly flexible and optimized matrix class implementation.
Definition: DynMatrix.h:81
void deepCopyChannel(const Img< T > *src, int srcC, Img< T > *dst, int dstC)
Copies the channel from one image to another.
Definition: Img.h:1656
const ImgIterator< Type > const_roi_iterator
type definition for a const ROI iterator
Definition: Img.h:1404
ICL Time class (taken from the Ice lib)
Definition: Time.h:52
void append(Img< Type > *src, int iChannel=-1)
Append channels of external Img to the existing Img.
Definition: Img.h:756
ICLQt_API ImgROI roi(ImgQ &r)
creates a ROI-struct from an image
const Img< Type > * reinterpretChannels(format newFmt)
Create a shallow copy of this image with a new format (const version)
Definition: Img.h:551
void reduce_channels(Img< Tdst > &dst, ReduceFunc reduce) const
Utility function for combining image channels into another image.
Definition: Img.h:1254
const Img< Type > * shallowCopy(const utils::Rect &roi, const std::vector< int > &channelIndices, format fmt, utils::Time time=utils::Time::null) const
Definition: Img.h:525
const PixelRef< Type > operator()(int x, int y) const
as above, but const
Definition: Img.h:392
ImgIterator< Type > roi_iterator
type definition for ROI iterator
Definition: Img.h:1401
Type * getROIData(int iChannel)
returns a Type save data pointer to the first pixel within the images roi
Definition: Img.h:896
void deepCopyChannelROI(const Img< T > *src, int srcC, const utils::Point &srcOffs, const utils::Size &srcSize, Img< T > *dst, int dstC, const utils::Point &dstOffs, const utils::Size &dstSize)
copies the channel roi from one image to another
Definition: Img.h:1783
Img< dstType > & combine(BinaryFunction f, const Img< otherSrcType > &otherSrc, Img< dstType > &dst) const
STL-based "transform function combining two images pixel-wise into a given destination image (with RO...
Definition: Img.h:1190
ICLCore_API void flippedCopy(axis eAxis, const ImgBase *poSrc, ImgBase **ppoDst=0)
mirror copy of an image from source to destination image (1:1 copy)
Img< dstType > & transform_C(UnaryFunction f, int srcChannel, int dstChannel, Img< dstType > &dst) const
STL based "transform" implementation applying an Unary function on ROI-pixles with given destination ...
Definition: Img.h:1043
const Type * const_iterator
const iterator type (just a const pointer)
Definition: Img.h:1398
roi_iterator beginROI(int channel)
returns the iterator for an images ROI
Definition: Img.h:1430
void fillChannelROI(int channel, const T &value)
fills the given channel's with given source type value
Definition: Img.h:1345
The ImgParams class stores all image parameters .
Definition: ImgParams.h:58
void extractChannels(const Channel< Type > *dst) const
extracts all image channels at once into given channel pointer (const)
Definition: Img.h:471
Type * getData(int iChannel)
returns a Type save data data pointer to the channel data origin
Definition: Img.h:864
int getStartIndex(int iIndex) const
returns the start index for a channel loop
Definition: Img.h:121
format
determines the color-format, that is associated with the images channels
Definition: Types.h:70
bool isNull() const
null check : null images have 0-Channels and null-size
Definition: Img.h:289
Ipp32s icl32s
32bit signed integer type for the ICL
Definition: BasicTypes.h:58
Iterator class used to iterate through an Images ROI-pixels.
Definition: ImgIterator.h:242
const ImgType * combineImages(const std::vector< const ImgType * > &vec)
Combine several images using shallow copy.
static T p2o(T *ptr)
Conversion function to transform a pointer into an object.
Definition: Img.h:1639
const_roi_iterator endROI(int channel) const
returns the end-iterator for an images ROI (const)
Definition: Img.h:1449
Ipp32f icl32f
32Bit floating point type for the ICL
Definition: BasicTypes.h:55
ICLQt_API void fill(float r, float g=-1, float b=-1, float alpha=255)
sets the current fill color to given r,g,b,alpha value
#define ICLASSERT_RETURN_VAL(X, VALUE)
Definition: Macros.h:148
Ipp64f icl64f
64Bit floating point type for the ICL
Definition: BasicTypes.h:52
Type * iterator
iterator type (just a data pointer)
Definition: Img.h:1395
const Channel< Type > operator[](int channel) const
extracts an image channel
Definition: Img.h:406
Img< Type > * selectChannel(int channelIndex, Img< Type > *poDst=0)
Create a shallow copy of a single image channel of an image.
Definition: Img.h:610
Size class of the ICL.
Definition: Size.h:61
void fillROI(const T &value)
fills the whole image with given source type value
Definition: Img.h:1337
utility class that helps for an implicit conversion between Img<T>* to ImgBase**
Definition: Img.h:1525
void convertChannel(const Img< S > *src, int srcC, Img< D > *dst, int dstC)
copies/converts the data from one image to another image (IPP-OPTIMIZED)
Definition: Img.h:1679
Img< dstType > & combine_C(BinaryFunction f, int thisChannel, int otherSrcChannel, int dstChannel, const Img< otherSrcType > &otherSrc, Img< dstType > &dst) const
STL-based "transform function combining two images pixel-wise into a given destination image (with RO...
Definition: Img.h:1135
void extractChannels(Channel< Type > *dst)
extracts all image channels at once into given channel pointer
Definition: Img.h:454
void extractPointers(Type **dst) const
this function is forbidden, it produces an error message
Definition: Img.h:484
Utility helper class for faster and more convenient access to single channel image data.
Definition: Channel.h:145
ICLCore_API void flippedCopyROI(axis eAxis, const ImgBase *poSrc, ImgBase **ppoDst=0)
mirror copy of an images ROI into a destination images ROI
bool validChannel(const int iChannel) const
validate the given channel index
Definition: ImgBase.h:817
void incRow(int numLines=1) const
move the pixel vertically forward
Definition: MatrixSubRectIterator.h:249
const Img< Type > * shallowCopy(const utils::Rect &roi) const
Create a shallow copy of a const source image.
Definition: Img.h:581
int hasFullROI() const
returns ROISize == ImageSize
Definition: ImgBase.h:563
roi_iterator endROI(int channel)
returns the end-iterator for an images ROI
Definition: Img.h:1443
static const ImgParams null
as default size=(0,0), channels=0, format=matrix, roi=(0,0,0,0)
Definition: ImgParams.h:61
Img< Type > * shallowCopy(const utils::Rect &roi, Img< Type > *poDst=NULL)
Create a shallow copy of the image.
Definition: Img.h:566
void clearChannelROI(Img< T > *im, int c, T clearVal, const utils::Point &offs, const utils::Size &size)
sets an arbitrary image ROI to a given value
Definition: Img.h:1702
int getDim() const
returns the pixel count of each channel
Definition: ImgBase.h:486
ICLCore_API void scaledCopyChannelROI(const Img< T > *src, int srcC, const utils::Point &srcOffs, const utils::Size &srcSize, Img< T > *dst, int dstC, const utils::Point &dstOffs, const utils::Size &dstSize, scalemode eScaleMode)
virtual void * getDataPtr(int iChannel)
returns the raw- data pointer of an image channel
Definition: Img.h:931
Img< dstType > & transform(UnaryFunction f, Img< dstType > &dst) const
STL based "transform" implementation applying an Unary function on ROI-pixles with given destination ...
Definition: Img.h:1084
#define ERROR_LOG(x)
Definition: Macros.h:111
scalemode
for scaling of Img images theses functions are provided
Definition: Types.h:84
const Type * getData(int iChannel) const
returns a Type save data data pointer to the channel data origin (const)
Definition: Img.h:870
Type * getROIData(int iChannel, const utils::Point &p)
returns the data pointer to a pixel with defined offset
Definition: Img.h:918
const math::DynMatrix< Type > extractDynMatrix(int channel) const
extracts given channel as DynMatrix<Type> const
Definition: Img.h:448
Channel< Type > operator[](int channel)
extracts an image channel
Definition: Img.h:399
const_roi_iterator beginROI(int channel) const
returns the iterator for an images ROI (const)
Definition: Img.h:1436
ICLCore_API void flippedCopyChannelROI(axis eAxis, const Img< T > *src, int srcC, const utils::Point &srcOffs, const utils::Size &srcSize, Img< T > *dst, int dstC, const utils::Point &dstOffs, const utils::Size &dstSize)
mirror copy ROI data from one image to the ROI of another image (IPP-OPTIMIZED)
PixelRef< Type > operator()(int x, int y)
extracts a pixels channel values at once
Definition: Img.h:387
static void scale(const int deg, xcomplex *P)
Definition: PolynomialSolver.h:133
virtual const void * getDataPtr(int iChannel) const
returns the raw- data pointer of an image channel (const)
Definition: Img.h:937
math::DynMatrix< Type > extractDynMatrix(int channel)
extracts given channel as DynMatrix<Type>
Definition: Img.h:442
Point class of the ICL used e.g. for the Images ROI offset.
Definition: Point.h:58
std::vector< utils::SmartArray< Type > > m_vecChannels
internally used storage for the image channels
Definition: Img.h:80
void fillChannel(int channel, const T &value)
fills the given channel with given source type value
Definition: Img.h:1330
utils::Size getROISize() const
returns the images ROI size
Definition: ImgBase.h:521
math::FixedColVector< T, 4 > normalize(const math::FixedMatrix< T, 1, 4 > &v)
normalize a vector to length 1
Definition: HomogeneousMath.h:97
int getChannels() const
returns the channel count of the image
Definition: ImgBase.h:489
Definition: Types.h:85
float subPixelNN(float fX, float fY, int iChannel) const
sub-pixel access using nearest neighbor interpolation
Definition: Img.h:412
static void reduce_arrays(const Tsrc *src[Nsrc], Tdst *dst[Ndst], unsigned int dim, ReduceFunc reduce)
private helper function called from reduce_channels template
Definition: Img.h:1204
#define ICLASSERT_RETURN(X)
Definition: Macros.h:141
void extractPointers(const Type **dst) const
extracts all data pointers into given destination pointer (const)
Definition: Img.h:491
const Type * getROIData(int iChannel, const utils::Point &p) const
returns the data pointer to a pixel with defined offset (const)
Definition: Img.h:923
#define FUNCTION_LOG(x)
Definition: Macros.h:123
axis
for flipping of images
Definition: Types.h:99
const Type & operator()(int iX, int iY, int iChannel) const
as above, but const
Definition: Img.h:377
Rectangle class of the ICL used e.g. for the Images ROI-rect.
Definition: Rect.h:95
ICLQt_API ImgQ channel(const ImgQ &image, int channel)
picks a specific image channel
const_iterator end(int channel) const
returns the image end-iterator (const)
Definition: Img.h:1425
Ipp16s icl16s
16bit signed integer type for the ICL (range [-32767, 32768 ])
Definition: BasicTypes.h:61
static const Time null
Definition: Time.h:59
Img< Type > * reinterpretChannels(format newFmt, Img< Type > *poDst=NULL)
Create a shallow copy of this image with a new format.
Definition: Img.h:540
void fill(const T &value)
fills the whole image with given source type value
Definition: Img.h:1322
void extractPointers(Type **dst)
extracts all data pointers into given destination pointer
Definition: Img.h:476
virtual void detach(int iIndex=-1)
Makes the image channels inside the Img independent from other Img.
iterator end(int channel)
returns the image end-iterator (equal to getData(channel)+getDim())
Definition: Img.h:1420
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
Img< Type > & forEach_C(UnaryFunction f, int channel)
STL based "for_each" implementations applying an Unary function on each ROI-pixel of given channel.
Definition: Img.h:977
The Img class implements the ImgBase Image interface with type specific functionalities .
Definition: Img.h:49
Specialization of the SmartPtrBase class for Pointers.
Definition: SmartPtr.h:75
virtual int getLineStep() const
Returns the width of an image line in bytes.
Definition: Img.h:854
const Type * getROIData(int iChannel) const
returns a Type save data pointer to the first pixel within the images roi (const)
Definition: Img.h:902
static const ImgIterator< Type > create_end_roi_iterator(const Type *data, int width, const utils::Rect &roi)
Definition: ImgIterator.h:245
#define ICLCore_API
Definition: CompatMacros.h:174
Img< Type > detached() const
Utility method, that returns a detached version of this image.
Definition: Img.h:735
Definition: Types.h:77
Type & operator()(int iX, int iY, int iChannel)
pixel access operator
Definition: Img.h:372
const utils::Size & getSize() const
returns the size of the images
Definition: ImgBase.h:477