Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

FuncRgbOp.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Pattern_FuncRgbOp_h
00002 #define Impala_Core_Array_Pattern_FuncRgbOp_h
00003 
00004 #include "Core/Array/Pattern/Categories.h"
00005 #include "Core/Array/Pattern/ArrayFunc.h"
00006 
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace Array
00012 {
00013 namespace Pattern
00014 {
00015 
00016 
00062 template <class ArrayT, class RgbT>
00063 void
00064 FuncRgbOp(ArrayT* src, UInt8* pixels, int resWidth, int resHeight,
00065           Geometry::GeoIntType gi, RgbT& rgb)
00066 {
00067     typedef typename ArrayT::StorType StorT;
00068     typedef typename ArrayT::ArithType ArithT;
00069 
00070     int width = ArrayCW(src);
00071     int height = ArrayCH(src);
00072 
00073     if (((resWidth == -1) && (resHeight == -1)) ||
00074                 ((resWidth == width) && (resHeight == height)))
00075     {
00076         for (int y=0 ; y<height ; y++)
00077         {
00078             StorT* sPtr = ArrayCPB(src, 0, y);
00079             for (int x=0 ; x<width ; x++)
00080             {
00081                 rgb.DoIt(PtrRead(sPtr, ArithT()), pixels);
00082                 sPtr += ArrayT::ElemSize();
00083                 pixels += 3;
00084             }
00085         }
00086         return;
00087     }
00088     /*
00089     double sx = (double) width / resWidth;
00090     double sy = (double) height / resHeight;
00091     if (gi == NEAREST) {
00092         for (int y=0 ; y<resHeight ; y++) {
00093             for (int x=0 ; x<resWidth ; x++) {
00094                 DataPtrT p = imPtr;
00095                 p.incXYZ((int) (sx * x + 0.5), (int) (sy * y + 0.5), 0);
00096                 *pixels++ = rgb.DoIt(p.read());
00097             }
00098         }
00099         return;
00100     }
00101 
00102     typedef typename RgbT::ArithTypeDouble ArithTypeDouble;
00103     ArithTypeDouble result;
00104     for (int y=0 ; y<resHeight ; y++) {
00105         for (int x=0 ; x<resWidth ; x++) {
00106             result = Func2dSample(imPtr, result, sx * x, sy * y, 0, gi);
00107             *pixels++ = rgb.DoItDouble(result);
00108         }
00109     }
00110     */
00111 }
00112 
00113 } // namespace Pattern
00114 } // namespace Array
00115 } // namespace Core
00116 } // namespace Impala
00117 
00118 #endif

Generated on Fri Mar 19 09:30:50 2010 for ImpalaSrc by  doxygen 1.5.1