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

InvQuasi.h

Go to the documentation of this file.
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     // get needed Derivatives
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     //specular quasi invariant & variant
00053     //sp_inv=sqrt(O1_x.^2+O1_y.^2+O2_x.^2+O2_y.^2+eps);
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     //sp_var=sqrt(O3_x.^2+O3_y.^2+eps);
00063     temp = 0;
00064     image = 0;
00065     AddSquared(image, opponentDerList[4], opponentDerList[5]);
00066     Sqrt(image, image);
00067     quasiInvariants.push_back(image);
00068 
00069     //shadow-shading quasi invariant & variant
00070     //ss_inv=sqrt(theta_x.^2+theta_y.^2+phi_x.^2+phi_y.^2+eps);
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     //ss_var=sqrt(r_x.^2+r_y.^2+eps);
00080     temp = 0;
00081     image = 0;
00082     AddSquared(image, sphericalDerList[4], sphericalDerList[5]);
00083     Sqrt(image, image);
00084     quasiInvariants.push_back(image);
00085     
00086     //specular shadow-shading quasi invariant & variant
00087     //spss_inv=sqrt(h_x.^2+h_y.^2+eps);
00088     temp = 0;
00089     image = 0;
00090     AddSquared(image, hsiDerList[0], hsiDerList[1]);
00091     Sqrt(image, image);
00092     quasiInvariants.push_back(image);
00093 
00094     //spss_var=sqrt(i_x.^2+i_y.^2+s_x.^2+s_y.^2+eps);
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 } // namespace Array
00117 } // namespace Core
00118 } // namespace Impala
00119 
00120 #endif

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