00001 #ifndef Impala_Core_Array_Resample_h
00002 #define Impala_Core_Array_Resample_h
00003
00004 #include <vector>
00005 #include "Util/Math.h"
00006 #include "Core/Array/ProjectRange.h"
00007
00008 #include "Core/Array/RecGauss.h"
00009 #include "Core/Array/Set.h"
00010 #include "Core/Array/Scale.h"
00011 #include "Core/Array/MakeFrom3Images.h"
00012 #include "Core/Array/ArrayListDelete.h"
00013
00014 namespace Impala
00015 {
00016 namespace Core
00017 {
00018 namespace Array
00019 {
00020
00021
00022
00023 inline void
00024
00025 Resample(Array2dVec3UInt8*& dst, Array2dVec3UInt8* src, int newWidth,
00026 int newHeight)
00027 {
00028 double scaleX = (double) newWidth / src->CW();
00029 double scaleY = (double) newHeight / src->CH();
00030
00031
00032
00033
00034 double sigmaX = 0.75;
00035 double sigmaY = sigmaX;
00036
00037 std::vector<Array2dScalarReal64*> resList;
00038 for (int d=1 ; d<=src->ElemSize() ; d++)
00039 {
00040 Array2dScalarUInt8* comp = 0;
00041 ProjectRange(comp, src, d);
00042 double precision = 3.0;
00043 Array2dScalarReal64* compReal = 0;
00044
00045 Scale(compReal, comp, scaleX, scaleY, Geometry::LINEAR, true);
00046 Array2dScalarReal64* p = 0;
00047 RecGauss(p, compReal, sigmaX, sigmaY, 0, 0, precision);
00048 resList.push_back(p);
00049 delete comp;
00050 delete compReal;
00051 }
00052 MakeFrom3Images(dst, resList[0], resList[1], resList[2]);
00053 ArrayListDelete(&resList);
00054 }
00055
00056 }
00057 }
00058 }
00059
00060 #endif