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

GeodesicDistanceTransform.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_GeodesicDistanceTransform_h
00002 #define Impala_Core_Array_GeodesicDistanceTransform_h
00003 
00004 #include "Core/Array/Pattern/PatQueueBased.h"
00005 #include "Core/Array/Trait/QbWatershed.h"
00006 #include "Core/Array/PixMinMax.h"
00007 #include "Core/Matrix/MatSet.h"
00008 
00009 namespace Impala
00010 {
00011 namespace Core
00012 {
00013 namespace Array
00014 {
00015 
00016 
00021 template<class DstArrayT, class SrcArrayT>
00022 inline void
00023 GeodesicDistanceTransform(DstArrayT*& dst, SrcArrayT* src, int conn)
00024 {
00025     typedef typename SrcArrayT::ArithType ArithT; // expected to be int
00026 
00027     // to speedup compute here the min and max gray values 
00028     ArithT minVal, maxVal;
00029     PixMinMax(src, &minVal, &maxVal);
00030 
00031     // The result (distImage) is actually a side-effect of the watershed algo...
00032     Array2dScalarInt32 distImage(src->CW(), src->CH(), 0, 0);
00033     MatSet(&distImage, 0);
00034 
00035     Trait::QbWatershed<DstArrayT, SrcArrayT, SrcArrayT>
00036         qb(src->CW(), src->CH(), minVal, maxVal, &distImage);
00037     SrcArrayT* src2 = ArrayClone<SrcArrayT>(src);
00038     Pattern::PatQueueBased(dst, src, src2, qb, conn);
00039     delete src2;
00040 
00041     Set(dst, &distImage);
00042 }
00043 
00044 } // namespace Array
00045 } // namespace Core
00046 } // namespace Impala
00047 
00048 #endif

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