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

template<class DstArrayT, class SrcArrayT>
void Impala::Core::Array::Watershed ( DstArrayT *&  dst,
SrcArrayT *  src,
int  conn 
) [inline]

Watershed function based on Luc Vincent's algorithm.

Type of Src and Dst should be scalar integer based.

Definition at line 24 of file Watershed.h.

References Impala::Core::Array::Pattern::PatNgbOp2d(), Impala::Core::Array::Pattern::PatQueueBased(), PixMinMax(), and Impala::Core::Array::Trait::WSHEDVAL.

Referenced by Impala::Application::Im::DoWatershedVec3UInt8(), Impala::Application::Src::WindowSrc::HandleNewFrame(), Impala::Core::Test::TestWatershed::Run(), and SKIZ().

00025 {
00026     typedef typename SrcArrayT::ArithType ArithT; // expected to be int
00027 
00028     // to speedup compute here the min and max gray values 
00029     ArithT minVal, maxVal;
00030     PixMinMax(src, &minVal, &maxVal);
00031     // for more speedup, use a histogram to indicate the existing gray levels
00032 
00033     Trait::QbWatershed<DstArrayT, SrcArrayT, SrcArrayT>
00034         qb(src->CW(), src->CH(), minVal, maxVal);
00035     SrcArrayT* src2 = ArrayClone<SrcArrayT>(src);
00036     Pattern::PatQueueBased(dst, src, src2, qb, conn);
00037     delete src2;
00038 
00039     //because the LucVincent algorithm doesn't get all the watershed points
00040     //this neigborhoud operator replaces the smallest label with wshed value
00041     Trait::NgbLWshed<DstArrayT, DstArrayT> lwshed(conn, Trait::WSHEDVAL);
00042     Pattern::PatNgbOp2d(dst, dst, lwshed);
00043 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:58:48 2010 for ImpalaSrc by  doxygen 1.5.1