Hi, Well, this is not a GSL solution, but may be the following can help you. Once I had a similar problem. I was working with openCV and I couldn't find a function like the 'bwlabel' function of Octave or Matlab. May be it is implemented in openCV, but ... I spent some time and I didn't get it.
So I just took the function bwlabel.c from Octave (well, from its image processing package) and I adapted it from the openCV data type. It took me a few hours. I was interested only in binary input images. You should check the behaviour with gray images. Best regards: Carlos Medrano On Wednesday 10 March 2010 18:02:15 [email protected] wrote: > Send Help-gsl mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.gnu.org/mailman/listinfo/help-gsl > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Help-gsl digest..." > > > Today's Topics: > > 1. connected component analysis with GSL? (Dan Lenski) > 2. connected component analysis with GSL? (Dan Lenski) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 9 Mar 2010 15:58:24 +0000 (UTC) > From: Dan Lenski <[email protected]> > Subject: [Help-gsl] connected component analysis with GSL? > To: [email protected] > Message-ID: <[email protected]> > Content-Type: text/plain; charset=UTF-8 > > Hi, > > I am trying to write a program to clean up small dust specks in scanned > TIFF images. I wrote this first in Python/SciPy, but it's rather slow > unfortunately. > > I was hoping to reimplement it using Libtiff and GSL, in C. I was > wondering if GSL has any routines for connected component analysis. > E.g., given a matrix/array that looks like this: > > A = [[ 0 1 1 0 1 > 0 0 2 2 2 > 1 1 1 1 0 > 0 3 3 2 2 ]] > > ... I'd like generate a labeled structure that looks something like this: > > labels = [[ 0 1 1 0 2 > 0 0 3 3 3 > 4 4 4 4 0 > 0 5 5 6 6 ]] > > ... where each contiguous (4- or 8-way connected) region of non-zero has > been given its own label. > > I googled around, but did not find much. Does anyone know of some open- > source code to do this in GSL? I suppose I could re-invent the wheel, > but would rather not if I can avoid it. > > Thanks for any pointers! > > Dan > > > > > > > ------------------------------ > > Message: 2 > Date: Tue, 9 Mar 2010 17:48:56 +0000 (UTC) > From: Dan Lenski <[email protected]> > Subject: [Help-gsl] connected component analysis with GSL? > To: [email protected] > Message-ID: <[email protected]> > Content-Type: text/plain; charset=UTF-8 > > Hi, > > I am trying to write a program to clean up small dust specks in scanned > TIFF images. I wrote this first in Python/SciPy, but it's rather slow > unfortunately. > > I was hoping to reimplement it using Libtiff and GSL, in C. I was > wondering if GSL has any routines for connected component analysis. > E.g., given a matrix/array that looks like this: > > A = [[ 0 1 1 0 1 > 0 0 2 2 2 > 1 1 1 1 0 > 0 3 3 2 2 ]] > > ... I'd like generate a labeled structure that looks something like this: > > labels = [[ 0 1 1 0 2 > 0 0 3 3 3 > 4 4 4 4 0 > 0 5 5 6 6 ]] > > ... where each contiguous (4- or 8-way connected) region of non-zero has > been given its own label. > > I googled around, but did not find much. Does anyone know of some open- > source code to do this in GSL? I suppose I could re-invent the wheel, > but would rather not if I can avoid it. > > Thanks for any pointers! > > Dan > > > > > > ------------------------------ > > _______________________________________________ > Help-gsl mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/help-gsl > > > End of Help-gsl Digest, Vol 77, Issue 6 > *************************************** _______________________________________________ Help-gsl mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gsl
