00001 #ifndef Impala_Core_Array_InvQuasi_h
00002 #define Impala_Core_Array_InvQuasi_h
00003
00004 #include <vector>
00005 #include "Core/Array/InvCompDer.h"
00006 #include "Core/Array/InvOpponentDer.h"
00007 #include "Core/Array/InvSphericalDer.h"
00008 #include "Core/Array/InvHsiDer.h"
00009 #include "Core/Array/Arrays.h"
00010 #include "Core/Array/Add.h"
00011 #include "Core/Array/AddSquared.h"
00012 #include "Core/Array/Sqrt.h"
00013
00014 namespace Impala
00015 {
00016 namespace Core
00017 {
00018 namespace Array
00019 {
00020
00021
00041 inline std::vector<Array2dScalarReal64*>
00042 InvQuasi(Array2dVec3Real64* src, double sigma, double precision)
00043 {
00044 std::vector<Array2dScalarReal64*> quasiInvariants;
00045
00046
00047 std::vector<Array2dScalarReal64*> rgbDerList = InvCompDer(src, sigma, precision);
00048 std::vector<Array2dScalarReal64*> opponentDerList = InvOpponentDer(rgbDerList);
00049 std::vector<Array2dScalarReal64*> sphericalDerList = InvSphericalDer(rgbDerList);
00050 std::vector<Array2dScalarReal64*> hsiDerList = InvHsiDer(rgbDerList);
00051
00052
00053
00054 Array2dScalarReal64* temp = 0;
00055 Array2dScalarReal64* image = 0;
00056 AddSquared(image, opponentDerList[0], opponentDerList[1]);
00057 AddSquared(temp, opponentDerList[2], opponentDerList[3]);
00058 Add(image, image, temp);
00059 Sqrt(image, image);
00060 quasiInvariants.push_back(image);
00061
00062
00063 temp = 0;
00064 image = 0;
00065 AddSquared(image, opponentDerList[4], opponentDerList[5]);
00066 Sqrt(image, image);
00067 quasiInvariants.push_back(image);
00068
00069
00070
00071 temp = 0;
00072 image = 0;
00073 AddSquared(image, sphericalDerList[0], sphericalDerList[1]);
00074 AddSquared(temp, sphericalDerList[2], sphericalDerList[3]);
00075 Add(image, image, temp);
00076 Sqrt(image, image);
00077 quasiInvariants.push_back(image);
00078
00079
00080 temp = 0;
00081 image = 0;
00082 AddSquared(image, sphericalDerList[4], sphericalDerList[5]);
00083 Sqrt(image, image);
00084 quasiInvariants.push_back(image);
00085
00086
00087
00088 temp = 0;
00089 image = 0;
00090 AddSquared(image, hsiDerList[0], hsiDerList[1]);
00091 Sqrt(image, image);
00092 quasiInvariants.push_back(image);
00093
00094
00095 temp = 0;
00096 image = 0;
00097 AddSquared(image, hsiDerList[2], hsiDerList[3]);
00098 AddSquared(temp, hsiDerList[4], hsiDerList[5]);
00099 Add(image, image, temp);
00100 Sqrt(image, image);
00101 quasiInvariants.push_back(image);
00102
00103 int i;
00104 for(i=0 ; i<rgbDerList.size() ; ++i)
00105 delete rgbDerList[i];
00106 for(i=0 ; i<opponentDerList.size() ; ++i)
00107 delete opponentDerList[i];
00108 for(i=0 ; i<sphericalDerList.size() ; ++i)
00109 delete sphericalDerList[i];
00110 for(i=0 ; i<hsiDerList.size() ; ++i)
00111 delete hsiDerList[i];
00112
00113 return quasiInvariants;
00114 }
00115
00116 }
00117 }
00118 }
00119
00120 #endif