5.0

5.0 | 2 ratings Rate this file 25 downloads (last 30 days) File Size: 747.79 KB File ID: #21376

ISLANDS

by Matt Fig

 

08 Sep 2008 (Updated 23 Sep 2008)

Code covered by the BSD License  

Finds all "islands" which are 4-connected components in a matrix.

Download Now | Watch this File

File Information
Description

ISLANDS finds all "islands" which are 4-connected components in a matrix. The function will return three output arguments, including the largest connected island in the input matrix. See the detailed help for all descriptions.

Inspired by a recent puzzler posted here:
http://blogs.mathworks.com/pick/2008/08/18/puzzler-find-largest-connected-island/
and by the submission from Tim Davis.

Also included is a MEX-File version which runs faster than the M-File version.

Tested on 2007a and 2007b.

Please email me about bugs and other concerns. Thanks.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
find_components

MATLAB release MATLAB 7.5 (R2007b)
Zip File Content  
Other Files Islands/humor.mat,
Islands/islands.m,
Islands/islandsmx.cpp,
Islands/islandsmx.m,
Islands/islandsmx.mexw32
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
15 Sep 2008 Richard B.

It took me a while to get the humor, I am slow though. Nicely done.

31 Oct 2008 Tim Davis

Nice work!

Please login to add a comment or rating.
Updates
11 Sep 2008

Added more input checking.

18 Sep 2008

Faster mex-file.

19 Sep 2008

M-File now twice as fast.

23 Sep 2008

Now 3 times faster for a large binary matrix.

Tag Activity for this File
Tag Applied By Date/Time
morphology Matt Fig 22 Oct 2008 10:18:22
segmentation Matt Fig 22 Oct 2008 10:18:22
4connected Matt Fig 22 Oct 2008 10:18:22
puzzler Matt Fig 22 Oct 2008 10:18:22
pixel connectivity Matt Fig 22 Oct 2008 10:18:22
connected component Matt Fig 22 Oct 2008 10:18:22
mex Matt Fig 22 Oct 2008 10:18:22

Contact us at files@mathworks.com