00001 #ifndef Impala_Core_Array_ColorGaussResponses_h
00002 #define Impala_Core_Array_ColorGaussResponses_h
00003
00004 #include <vector>
00005 #include "Util/Math.h"
00006 #include "Core/Array/ColorSegmentationInvariant.h"
00007 #include "Core/Array/ColorSegmentationAlgorithm.h"
00008 #include "Core/Array/ArrayPool.h"
00009 #include "Core/Array/ColorSpace.h"
00010 #include "Core/Array/ProjectRange.h"
00011 #include "Core/Array/Set.h"
00012 #include "Core/Array/RecGauss.h"
00013 #include "Core/Array/Norm2.h"
00014
00015 namespace Impala
00016 {
00017 namespace Core
00018 {
00019 namespace Array
00020 {
00021
00022
00023 inline std::vector<Array2dScalarReal64*>
00024 ColorGaussResponses(Array2dVec3Real64* im)
00025 {
00026 const int nrScales = 4;
00027 double scales[nrScales];
00028
00029 scales[0] = 1.0 ;
00030 scales[1] = 2.0 ;
00031 scales[2] = 3.5 ;
00032 scales[3] = 7.0 ;
00033
00034
00035 ColorSpace(im, im, Element::RGB, Element::OOO);
00036
00037 int width = im->CW();
00038 int height = im->CH();
00039
00040
00041 std::vector<Array2dScalarReal64*> imList;
00042 int borderSize = 14;
00043 ArrayPool imOOO(width, height, 0, 0);
00044 imOOO.AllocSR64(3, borderSize, borderSize);
00045 imOOO.AllocC64(3, borderSize, borderSize);
00046 for (int ii=0 ; ii<3 ; ii++)
00047 {
00048 Array2dScalarReal64* tmpSR64 = imOOO.GetSR64(ii);
00049 ProjectRange(tmpSR64, im, ii+1);
00050 Array2dComplex64* tmpC64 = imOOO.GetC64(ii);
00051 Set(tmpC64, tmpSR64);
00052 }
00053
00054 for (int si=0; si<nrScales-1; si++)
00055 {
00056 for (int derx=0 ; derx<=1 ; derx++)
00057 {
00058 for (int dery=0 ; dery<=derx ; dery++)
00059 {
00060 for (int pixDim=1 ; pixDim<=3 ; pixDim++)
00061 {
00062 Array2dScalarReal64* res = 0;
00063 RecGauss(res, imOOO.GetSR64(pixDim-1), scales[si],
00064 scales[si], derx, dery, 3);
00065 Norm2(res, res);
00066 RecGauss(res, res, 1.95*scales[si], 1.95*scales[si],
00067 0, 0, 3);
00068 imList.push_back(res);
00069 std::cout << "imList.size = " << imList.size() << std::endl;
00070 }
00071 }
00072 }
00073 }
00074
00075 return imList;
00076 }
00077
00078 }
00079 }
00080 }
00081
00082 #endif