dilatecv
Dilates the given image, handle.
Syntax
R = dilatecv(handle, kernel...)
R = dilatecv(handle, kernel, anchor, iterations, type, color)
Inputs
- handle
- Handle of an image.
- kernel
- Structuring element used for dilation. This can be created using the command getstructuringelementcv. An empty matrix, [] can also be used and a default structuring element will be used.
- anchor
- Optional vector of 2 integers specifying the anchor position. Default value is [-1 -1], indicating the anchor is at the center of the element.
- iterations
- Optional parameter specifying the number of times dilation is applied. Default value is 1.
- type
- Optional parameter specifying the pixel extrapolation method. Default value is 0.
Valid values are:
- 0
- Type cv::BORDER_CONSTANT - default value
- 1
- Type cv::BORDER_REPLICATE
- 2
- Type cv::BORDER_REFLECT
- 4
- Type cv::BORDER_REFLECT_101
- 16
- Type cv::BORDER_ISOLATED
- color
- Optional 3-element vector of integers representing blue, green, red (BGR) colors, if type is 0. Black will be the default color if nothing is specified with type.
Outputs
- r
- Handle of the dilated image.
Examples
Dilate an image with default options:
handle = imreadcv('image1.jpg');
R = dilatecv(handle, []);
Dilate an image with constant blue border:
handle = imreadcv('image1.jpg');
kernel = getstructuringelementcv(1, [10 10]);
R = dilatecv(handle, kernel, [-1 -1], 1, 0, [255 0 0]);
Detect the edges and dilate the output:
imgoriginal = imreadcv('Dog.jpg',1);
figure(1);
imshowcv(imgoriginal);
%Conver the image to gray scale
img = cvtcolorcv(imgoriginal, 6);
edges = cannycv(img, 70, 180);
dilatededges = dilatecv(edges, []);
figure(2);
imshowcv(erodededges);