Finding continuous parts in a mask (ie a binary matrix)
Antoine Monmayrant
antoine.monmayrant at laas.fr
Tue Mar 8 10:58:13 CET 2011
Hi everyone,
I have question that is more about image filtering than scilab, but I
haven't found any answer so far so I'm turning towards scilab users.
I am looking for a way to determine continuous parts in a matrix made of
1 or 0.
Basically, this matrix is used as a mask to filter an image and I need
to determine the number of isolated "grains" (ie continuous parts where
the matrix is equal to 1) in this mask.
As an example, here is a mask:
-->mask
mask =
0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 1. 1. 1. 0.
0. 0. 0. 0. 0. 0. 1. 1. 1. 0.
0. 0. 0. 0. 0. 0. 1. 1. 1. 0.
0. 1. 1. 0. 0. 0. 0. 0. 0. 0.
0. 1. 1. 1. 0. 0. 0. 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. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
It contains 2 "grains", one in the upper-right corner, and one in the
middle-left.
I would like to be able to isolate them in order to determine their
position in the matrix, size,...
Do any of you know of a good algorithm to achieve this?
Do any of you know what are the relevant names or keywords associated to
this kind of algorithm?
Thank you in advance,
Antoin
More information about the users
mailing list