distancetransformcv
Calculates the distance to the closest zero pixel and normalizes the output image.
Syntax
R = distancetransformcv(handle, dtype, msize...)
R = distancetransformcv(handle, dtype, msize, type)
Inputs
- handle
- Handle of a single channel grayscale image.
- dtype
- Distance type. Valid values are:
- -1
- cv::DIST_USER
- 1
- cv::DIST_L1
- 2
- cv::DIST_L2
- 3
- cv::DIST_C
- 4
- cv::DIST_L12
- 5
- cv::DIST_FAIR
- 6
- cv::WELSCH
- 7
- cv::DIST_HUBER
- msize
- Size of the mask. Valid values are:
- 3
- cv::DIST_MASK_3.
- 5
- cv::DIST_MASK_5
- 0
- cv::DIST_MASK_PRECISE
- type
- Optional parameter specifying the output type. Default value is
5. Valid values are:
- 5
- CV_32F: Default value.
- 0
- CV_8U: Output can be this type only if dtype has a value of 1 (cv::DIST_L1)
Outputs
- R
- Handle of the output image.
Example
Apply distance transformation on an image:
handle = imreadcv('and1.jpeg', 0);
dtype = 1;
msize = 3;
type = 5;
R = distancetransformcv(handle, dtype, msize, type);