Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxWatershed.h File Reference

More...

#include "HxImageRep.h"

Go to the source code of this file.

Functions

HxImageRep L_HXIMAGEREP HxWatershed (HxImageRep input, int conn)
 Watershed function creates the result image by detecting the domain of the catchment basins of "im" using the "flooding definition", according to the connectivity defined by "sf". More...


Detailed Description


Function Documentation

HxImageRep L_HXIMAGEREP HxWatershed HxImageRep    input,
int    conn
 

Watershed function creates the result image by detecting the domain of the catchment basins of "im" using the "flooding definition", according to the connectivity defined by "sf".

According to the flag "linereg" the result image will be a labeled image of the catchment basins domain or just a binary image that presents the watershed lines.

Implementation based on Vincent algorithm (PAMI) Evaluation using SDC Matlab toolbox (www.morph.com)

  • im is the input image (HxImageRep)
  • mark is the marker image (HxImageRep)
  • sf is the structuring function; default type is crossSF (HxSF)
  • linereg HxString. Possible values 'LINES' or ' REGIONS'. Default: "LINES".
Returns:
the watershed Image, ImageRep
* references: L. Vincent and P. Soille, Watersheds in digital spaces: an efficient algorithm based on immersion simulations, IEEE Transactions on Pattern Analysis and Machine Intelligence. 13:583-598, 1991.

Remarks:
this queue based implementation is based on sorted lists of pixels for color images there is no partial ordering therefore we cannot use this for color

00433 {
00434     HxTagList tags;
00435     HxAddTag(tags, "connectivity", conn);
00436     HxImageRep mask=input;
00437     //to speedup compute here the min and max gray values 
00438     int     hmin,hmax;
00439     hmin = HxPixMin(input).HxScalarIntValue().x(); 
00440     hmax = HxPixMax(input).HxScalarIntValue().x();
00441     HxAddTag(tags,"hmin",hmin);
00442     HxAddTag(tags,"hmax",hmax);
00443 
00444     //for more speedup, use a histogram to indicate the existing gray levels
00445 
00446     HxImageRep out = input.queueBasedOp(mask, "qWaterShedLV", tags);
00447 
00448     //because the LucVincent algorithm doesn't get all the watershed points
00449     //this neigborhoud operator replaces the smallest label with wshed value
00450     HxAddTag(tags, "conn", conn);
00451     HxAddTag(tags, "wshedval", WSHEDVAL);
00452 
00453     out = out.neighbourhoodOp("lwshed", tags);
00454 
00455 
00456     return out;
00457 }


Generated on Mon Jan 27 15:48:56 2003 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001