Closed PhilippPaetzold closed 3 months ago
You should define better the output you expect. Which info do you want from your "blobs"? Let's assume you have 2 vertical lines of foreground pixels on the left and on the right of your image. This goes on for 1000000 rows. If you want to keep track of the labeled image, we need to keep 1000000 lines into memory, because you cannot remove anything ever. If, instead, you just want to know some info on that blob (area, width, height, ...) you can just keep that info in a running fashion.
You should define better the output you expect. Which info do you want from your "blobs"?
// Holds an extracted blob
struct Blob
{
int left, top, right, bottom; // axis-align-bounding-box
int numberOfPixels; // aka area
int numberOfSegments;
BlobSegment* pSegments;
}
// Holds a horizontal blob segment
struct BlobSegment
{
int x0, int x1;
int y;
uint8_t* pPixels; // Pointer to underlying blob pixels, e.g. bgra data.
}
Let's assume you have 2 vertical lines of foreground pixels on the left and on the right of your image. This goes on for 1000000 rows. If you want to keep track of the labeled image, we need to keep 1000000 lines into memory, because you cannot remove anything ever.
Thats clear. Introducing a "limit" for the maximum height of a blob solves this. For my application I know single objects aka blobs can not exceed a height of lets say 512px. So the extraction should stop at this point for this blob and report this by callback.
pSegments
and pPixels
could use object/memory pools, but that is an implementation detail.
Dear @prittt ,
I am currently working on a project where I need to extract objects from an image stream that is continuously acquired line-by-line with the use of line scan cameras. So my image fixed in x-direction, but basically "endless" in y. After doing a bit of research, I think I need to implement a so called single Pass CCA/Blob Extractor, that can process my image line-by-line and continuously extracts blobs. Can you tell me which of the implemented algorithms would be suitable and how I could modify it so it can accept a continuous stream of data? Help is greatly appreciated. Thank you and kind regards. Philipp