Page 1 of 1

Integer Labelling of Connected Components

PostPosted: Mon Aug 05, 2019 3:03 pm
by mcmalburg
I have an application whereby I need Connected Components output via integer "blob number" rather than a color. I may have 1000's of blobs in an image and need to create a two dimensional int array of blob references much like: https://en.wikipedia.org/wiki/Connected ... t_labeling

Thus instead of a bitmap wtih colors, I need an int[,] with blob index numbers.

Is this possible?

Thanks

Re: Integer Labelling of Connected Components

PostPosted: Wed Aug 07, 2019 5:01 pm
by andrew.kirillov
Yes. Check Blob Counter, which is part of the AForge.NET Framework.

Re: Integer Labelling of Connected Components

PostPosted: Thu Aug 08, 2019 1:16 pm
by mcmalburg
The blob counter seems to require that I calculate individual blobs and then create an int[,] map of labels. This is slow on my images with many (1000s) of blobs.

Is this int[,] array already computed internally via ConnectedComponents and stored somewhere (and I'm not finding it)? I don't need an output image. I need an int[,] matching the original image size with all blob labels present.

An input image:
1 1 0 0 0 0 0
1 1 0 0 1 1 0
0 0 0 0 1 1 0
0 1 1 0 0 0 0

Should give me the int[,] that looks like this based on blob number:

1 1 0 0 0 0 0
1 1 0 0 2 2 0
0 0 0 0 2 2 0
0 3 3 0 0 0 0

Thanks!




Many thanks in advance.

Re: Integer Labelling of Connected Components

PostPosted: Thu Aug 08, 2019 10:23 pm
by andrew.kirillov

Re: Integer Labelling of Connected Components

PostPosted: Fri Aug 16, 2019 12:00 pm
by mcmalburg
Ahhh. I was looking for int[,] in the docs prior to posting. That's a huge help. Thank you.