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

Diff.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Diff_h
00002 #define Impala_Core_Array_Diff_h
00003 
00004 #include "Core/Array/Pattern/PatBinaryPixOp.h"
00005 #include "Core/Array/Trait/BpoTestEqual.h"
00006 
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace Array
00012 {
00013 
00014 
00015 template<class Src1ArrayT, class Src2ArrayT>
00016 inline int
00017 Diff(Src1ArrayT* src1, Src2ArrayT* src2, double epsilon)
00018 {
00019     ILOG_FUNCTION(Impala.Core.Array.Diff);
00020     if (src1->CW() != src2->CW())
00021     {
00022         ILOG_ERROR("Width differs: " << src1->CW() << " vs " << src2->CW());
00023         return 1;
00024     }
00025     if (src1->CH() != src2->CH())
00026     {
00027         ILOG_ERROR("Height differs: " << src1->CH() << " vs " << src2->CH());
00028         return 1;
00029     }
00030     Trait::BpoTestEqual<Src1ArrayT, Src1ArrayT, Src2ArrayT> bpo(epsilon);
00031     Src1ArrayT* tmp = 0;
00032     Pattern::PatBinaryPixOp(tmp, src1, src2, bpo);
00033     delete tmp;
00034     if (bpo.mNrDiff > 0)
00035     {
00036         ILOG_ERROR("Found " << bpo.mNrDiff << " differences, in "
00037                    << bpo.mNr << " pixels, sum diffs : " << bpo.mSumDiff 
00038                    << " avg diff : " << bpo.mSumDiff / bpo.mNrDiff 
00039                    << " avg src1 : " << bpo.mSumSrc1 / bpo.mNr
00040                    << " avg src2 : " << bpo.mSumSrc2 / bpo.mNr);
00041     }
00042     return bpo.mNrDiff;
00043 }
00044 
00045 } // namespace Array
00046 } // namespace Core
00047 } // namespace Impala
00048 
00049 #endif

Generated on Thu Jan 13 09:04:02 2011 for ImpalaSrc by  doxygen 1.5.1