#include "HxSF.h"
Go to the source code of this file.
Functions | |
| HxImageRep L_HXIMAGEREP | HxSKIZ (HxImageRep input, int conn) |
| using the Luc Vincent watershed. More... | |
|
||||||||||||
|
using the Luc Vincent watershed.
00105 {
00106 HxImageRep mask=input;
00107 HxTagList tags;
00108 HxAddTag(tags, "connectivity", conn);
00109
00110 //to speedup compute here the min and max gray values
00111 int hmin,hmax;
00112 hmin = HxPixMin(input).HxScalarIntValue().x();
00113 hmax = HxPixMax(input).HxScalarIntValue().x();
00114 HxAddTag(tags,"hmin",hmin);
00115 HxAddTag(tags,"hmax",hmax);
00116
00117 //for more speedup, use a histogram to indicate the existing gray levels
00118
00119 HxImageRep out = input.queueBasedOp(mask, "qWaterShedLV", tags);
00120
00121 //because the LucVincent algorithm doesn't get all the watershed points
00122 //this neigborhoud operator replaces the smallest label with wshed value
00123 //out = HxLWshed(out,conn,WSHEDVAL);
00124 HxAddTag(tags, "conn", conn);
00125 HxAddTag(tags, "wshedval", WSHEDVAL);
00126
00127 out = out.neighbourhoodOp("lwshed", tags);
00128
00129 //now for SKIZ I have to replace all values BUT 0 with 255, so that we
00130 //keep only the border, and not the objects labeled.
00131 //this we can do with a binary pixel opeartion implementing a LUT (look-up table) operation
00132
00133 HxTagList tags2;
00134 HxAddTag(tags2, "holdValue", 0);
00135 HxAddTag(tags2, "newValue", 255);
00136
00137 return out.unaryPixOp("ReplaceAllValuesButOne", tags2);
00138
00139 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001