image = | genericSeededDistanceMap2dImg (inBinImg,inBinSeedImg,inDistWeight2d) |
image = | genericSeededDistanceMap2dImg (inBinImg,inBinSeedImg,inDistWeight2d,maxDistance) |
generic seeded distance map transform of an input binary image according to a seeded image
2d generic seeded distance map algorithm allows to compute the distance to the closest seeded pixel in a region for each pixel of this region, according to given weights stored in a ipsdk::imaproc::attr::DistWeight2d attribute. As in Seeded Distance Map 2d, the region is defined by a binary image with pixel intensities set to 1 and the seeded pixels are defined by a seeded image with pixel intensities set to 1.The weights can be seen as a distance between 2 successive pixels. If the parameter is provided, the propagation is constrained so that it stops when the distance is higher than the
value.
The resulting image buffer type must be one of the following :
Output image values are given by :
Where is the pixel's neighbourhood,
is the set of directions allowed by
and can be lateral (along the x-axis), axial (along the y-axis) or diagonal.
is the weight corresponding to the direction
.
The following figure illustrates the algorithm with a simple example :
If, for instance, ,
and
. The neighbours along the diagonals are not taken into account : it corresponds to a 4-connexity. In this case, the resulting distance will be :
Here is an example of a 2d generic seeded distance map computation applied to a binary input image with a real result image and with weighting coefficients along the x an y directions set to 1 and the weighting coefficient along the diagonal set to :