Main Page   Class Overview   Pixels   Images   Geometry   Quick Index  

HxDistanceTransform.h File Reference

More...

#include "HxImageRep.h"

Go to the source code of this file.

Functions

HxImageRep L_HXIMAGEREP HxDistanceTransform (HxImageRep img)
 Distance transform replaces each pixel of an object with an estimate of its shortest distance to the background (the distance to the nearest background pixel). More...


Detailed Description


Function Documentation

HxImageRep L_HXIMAGEREP HxDistanceTransform HxImageRep    img
 

Distance transform replaces each pixel of an object with an estimate of its shortest distance to the background (the distance to the nearest background pixel).

Background is defined as all pixels with value 0.

00086 {
00087     HxImageRep input = BinMap(HxImageAsDouble(img), inf, 0);
00088 
00089     double filterData[] = {
00090         inf,    sqrt_5, inf,    sqrt_5, inf,
00091         sqrt_5, sqrt_2, 1,      sqrt_2, sqrt_5,
00092         inf,    1,      0,      1,      inf,
00093         sqrt_5, sqrt_2, 1,      sqrt_2, sqrt_5,
00094         inf,    sqrt_5, inf,    sqrt_5, inf
00095     };
00096     HxImageRep kernel = HxMakeFromDoubleData(1, 2, HxSizes(5, 5, 1), filterData);
00097 
00098     return input.recursiveNeighOp(kernel, "add", "minAssign");
00099 }


Generated on Tue Jan 8 13:59:19 2002 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001