Morphology
strel constructs structuring elements with a variety of shapes and sizes. Its basic syntax is
se=strel(shape,parameters)
se1 = strel('square',11) % 11-by-11 square
se2 = strel('line',10,45) % length 10, angle 45 degrees
se3 = strel('disk',15) % disk, radius 15
se4 = strel('ball',15,5) % ball, radius 15, height 5
strel(’diamond’,R)
|
Creates a flat, diamond-shaped structuring element,where R specifies the distance from the structuring element origin to the extreme points of the diamond
|
strel(’disk’,R)
|
Creates a flat, disk-shaped structuring element with radius R.
|
strel(’line’,LEN,DEG)
|
Creates a flat, linear structuring element, where LEN specifies the length, and DEG specifies the angle (in degrees) of the line, as measured in a counterclock-wise direction from the horizontal axes
|
strel(’octagon’,R)
|
Creates a flat, octagonal structuring element, where R specifies the distance from the structuring element origin to the sides of the octagon, as measured along the horizontal and vertical axes. R must be a nonnegative multiple of 3
|
strel(’pair’,OFFSET)
|
Creates a flat structuring element containing two members. One member is located at the origin. The second member’s location is specified by the vector OFFSET, which must be a two-element vector of integers.
|
strel(’periodicline’,P,V)
|
Creates a flat structuring element containing 2*P+1members.Vis a two-element vector con-taining integer-valued row and column offsets.One structuring element member is located atthe origin. The other members are located at1*V,-1*V,2*V,-2*V,V.
|
strel(’rectangle’,MN)
|
Creates a flat, rectangle-shaped structuring element, where MN specifies the size. MN must be a two- element vector of nonnegative integers. The first ele- ment of MN is the number of rows in the structuring el-ement; the second element is the number of columns
|
strel(’square’,W)
|
Creates a square structuring element whose width is W pixels. W must be a nonnegative integer scalar
|
strel(NHOOD)
|
Creates a structuring element of arbitrary shape. NHOOD is a matrix of 0s and 1s that specifies the shape
|
a=imread(‘image.jpg’);
% invert the array
a=255-a;
%create structuring element
se=strel(‘disk’,7);
a_erode=imerode(a,se);
a_dilate=imdilate(a,se);
a_open=imopen(a,se);
a_closed=imclose(a,se);
or
a=imread(‘image.jpg’);
B=[0 1 0;1 1 1;0 1 0];
A2=imdilate(a,B);
No comments:
Post a Comment