getborder

returns a logical border inside or outside a mask
1,8K Downloads
Aktualisiert 4 Jan 2008

Lizenz anzeigen

Ib = getborder(I,method)

getborder returns the outline around logical values in I (mask) using a 8-connected neighborhood.
I must be a logical n*m matrix. method 'inside' returns the inner border around "islands" of logical values. 'outside' returns the border outside the islands.

Example:

I = peaks(8)<0;

Ib = getborder(I,'inside')

Ib =

0 0 1 1 1 1 1 1
0 0 1 1 0 1 1 0
1 0 0 1 1 1 0 0
1 1 1 0 0 0 0 0
1 1 1 0 0 0 0 0
1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

Ib = getborder(I,'outside')

Ib =

0 1 0 0 0 0 0 0
1 1 0 0 0 0 0 1
0 1 1 0 0 0 1 1
0 0 0 1 1 1 1 0
0 0 0 1 0 0 0 0
0 0 1 1 0 0 0 0
1 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0

Zitieren als

Wolfgang Schwanghart (2024). getborder (https://www.mathworks.com/matlabcentral/fileexchange/12303-getborder), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R14
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.0

removed padding since it was not neccessary