#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... |
|
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)
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 } |