| [Top] [Up] [Prev] [Next] | [Up] [Basic Concepts] [Demonstrations] [Functions] | SDC Morphology Toolbox V1.1 15Jan02 |
B = mmseline( l, theta ) l: Non-negative integer. Default: 3.theta: (degrees) Default: 0.B: Structuring element. mmseline creates a structuring element B that is a line segment that has an extremity at the origin, length l and angle theta (0 degrees is east direction). If l=0, it generates the origin.mmseshow(mmseline) ans = 0 0 1 1 1 b1 = mmseline(4,45); mmseshow(b1) ans = 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 b2 = mmseline(4,-180); mmseshow(b2) ans = 1 1 1 1 0 0 0 a=mmtext('Line'); b=mmdil(a,b1); mmshow(a); mmshow(b);
|

function B = mmseline_equ(l, theta) theta = pi*theta/180; if abs(tan(theta)) <= 1 s = sign(cos(theta)); x1 = 0:s:round(l * cos(theta))-s; x2 = round(x1 * tan(theta)); else s = sign(sin(theta)); x2 = 0:s:round(l * sin(theta))-s; x1 = round(x2 / tan(theta)); end %convert to center image X1=max(abs(x1)); X2=max(abs(x2)); L1=2*X1+1; L2=2*X2+1; Bimg=full(sparse(x2+X2+1, x1+X1+1,1, L2,L1)); B=mmimg2se(logical(uint8(Bimg)));
| [Top] [Up] [Prev] [Next] | [Up] [Basic Concepts] [Demonstrations] [Functions] |
|
| Copyright (c) 1998-2002 by SDC Information Systems | ||