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

M9N4poFHS.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Trait_M9N4poFHS_h
00002 #define Impala_Core_Array_Trait_M9N4poFHS_h
00003 
00004 #include "Core/Array/Pattern/Categories.h"
00005 #include "Core/Array/Element/E1Sqrt.h"
00006 
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace Array
00012 {
00013 namespace Trait
00014 {
00015 
00016 
00019 template<class DstArrayT, class SrcArrayT>
00020 class M9N4poFHS
00021 {
00022 public:
00024     typedef Pattern::TagTransInVar TransVarianceCategory;
00025 
00027     typedef Pattern::TagCallValue CallCategory;
00028 
00029     typedef typename DstArrayT::StorType DstStorT;
00030     typedef typename DstArrayT::ArithType DstArithT;
00031     typedef typename SrcArrayT::ArithType SrcArithT;
00032 
00034     M9N4poFHS()
00035     {
00036         mC = ::sqrt(3.0);
00037     }
00038 
00040     void
00041     DoIt(DstStorT* FHx, DstStorT* FHy, DstStorT* FSx, DstStorT* FSy,
00042          const SrcArithT& R, const SrcArithT& G, const SrcArithT& B,
00043          const SrcArithT& Rx, const SrcArithT& Gx, const SrcArithT& Bx,
00044          const SrcArithT& Ry, const SrcArithT& Gy, const SrcArithT& By)
00045     {
00046         SrcArithT saturation = Element::E1Sqrt(2*(R*R + G*G + B*B - R*G - R*B - G*B));
00047         
00048         *FHx = (saturation == 0) ? 0 : (R*(Bx-Gx) + G*(Rx-Bx) + B*(Gx-Rx)) / saturation;
00049         *FHy = (saturation == 0) ? 0 : (R*(By-Gy) + G*(Ry-By) + B*(Gy-Ry)) / saturation;
00050         saturation *= mC; //because S divides by sqrt(3)*saturation
00051         *FSx = (saturation == 0) ? 0 : (R*(2.*Rx-Gx-Bx)+G*(2.*Gx-Rx-Bx)+B*(2.*Bx-Rx-Gx)) / saturation;
00052         *FSy = (saturation == 0) ? 0 : (R*(2.*Ry-Gy-By)+G*(2.*Gy-Ry-By)+B*(2.*By-Ry-Gy)) / saturation;
00053     }
00054 
00055     SrcArithT mC;
00056 };
00057 
00058 } // namespace Trait
00059 } // namespace Array
00060 } // namespace Core
00061 } // namespace Impala
00062 
00063 #endif

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