AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

Integer Labelling of Connected Components

Forum to discuss AForge.NET Framework, its features, API, how-tos, etc.

Integer Labelling of Connected Components

Postby mcmalburg » Mon Aug 05, 2019 3:03 pm

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
mcmalburg
 
Posts: 8
Joined: Mon Sep 13, 2010 10:30 pm

Re: Integer Labelling of Connected Components

Postby andrew.kirillov » Wed Aug 07, 2019 5:01 pm

Yes. Check Blob Counter, which is part of the AForge.NET Framework.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3453
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: Integer Labelling of Connected Components

Postby mcmalburg » Thu Aug 08, 2019 1:16 pm

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.
mcmalburg
 
Posts: 8
Joined: Mon Sep 13, 2010 10:30 pm

Re: Integer Labelling of Connected Components

Postby andrew.kirillov » Thu Aug 08, 2019 10:23 pm

With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3453
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: Integer Labelling of Connected Components

Postby mcmalburg » Fri Aug 16, 2019 12:00 pm

Ahhh. I was looking for int[,] in the docs prior to posting. That's a huge help. Thank you.
mcmalburg
 
Posts: 8
Joined: Mon Sep 13, 2010 10:30 pm




Return to AForge.NET Framework

cron