source:
issm/trunk-jpl/src/m/morphological/dilation.m@
14580
| Last change on this file since 14580 was 14525, checked in by , 13 years ago | |
|---|---|
| File size: 384 bytes | |
| Line | |
|---|---|
| 1 | function mask=dilation(mask,neighboorhood) |
| 2 | %deletion algorithm using 4 pixel neighboors. |
| 3 | |
| 4 | %convolve: |
| 5 | |
| 6 | matrix=ones(3,3); |
| 7 | |
| 8 | %4 neighboorhood: |
| 9 | %corners |
| 10 | if neighboorhood==4, |
| 11 | matrix(1,1)=0; |
| 12 | matrix(1,3)=0; |
| 13 | matrix(3,1)=0; |
| 14 | matrix(3,3)=0; |
| 15 | end |
| 16 | %center |
| 17 | matrix(2,2)=0; |
| 18 | |
| 19 | %convolve mask: |
| 20 | convol=filter2(matrix,mask,'same'); |
| 21 | |
| 22 | pos=find(mask==0); |
| 23 | pos2=find(convol(pos)~=0); |
| 24 | |
| 25 | mask(pos(pos2))=1; |
Note:
See TracBrowser
for help on using the repository browser.
![(please configure the [header_logo] section in trac.ini)](/trac/issm/chrome/common/trac_banner.png)