#include "HxSF.h"
Go to the source code of this file.
Functions | |
| HxImageRep L_HXIMAGEREP | HxDistanceTransformMM (HxImageRep im, HxSF sf) |
| /input f: image /input Bc: SF. More... | |
|
||||||||||||
|
/input f: image /input Bc: SF. this is defined for BW image only im mmorph algorithm z = 0; g = f; ero = f; while (ero != z) ero = HxErosion(ero,Bc); g = mmaddm(g,mmgray(ero,'uint8',1)); end NOTE: mmadd is addition with saturation!
00048 {
00049 HxImageRep ero, res;
00050
00051 if( HxPixMax(im).HxScalarIntValue() > 1 )
00052 {
00053 // std::cout<<im.signature() << std::endl;
00054 // std::cout<< HxPixMax(im) << std::endl;
00055 std::cout<< std::endl<<"HxDistanceTransformMM works only on binary images!" << std::endl;
00056
00057 return res; //return null image
00058 }
00059
00060
00061
00062 res = im;
00063 ero = im;
00064
00065 HxValue zero(0);
00066
00067 int i=0;
00068 // while( HxScalarInt(HxPixMax(ero)) != 0 )
00069 // while( i < 50 )
00070 while( HxPixSum(HxEqualVal(ero, 0)).HxScalarIntValue() != ero.numberOfPixels() )
00071 {
00072 i++;
00073 ero = HxErosion(ero, sf);
00074 res = HxAddSat( res, ero);
00075 }
00076
00077 return res;
00078 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001