bramp/Connected-component-labelling

Typo i readme

dage opened this issue · 7 comments

dage commented

This implementation seems to work great, but I think there's a typo in the readme: The only way I could get BlobExtraction to work as expected is to prepare my 1D matrix representation with 255 for unset/background and -1 for set/foreground (not "zeroes and ones").

Sorry for the typo. I haven't touched this project in a while, but a quick look at the code, and I would think these constants would apply:

        var BACKGROUND = 255;
        var FOREGROUND = 0;

I will test and update the README.

thanks

seems FOREGROUND was not used at all.

I am very appreciate with your work.But I just can not get the correct way to make it work.If you can offer a example that will be very helpful.

thanks.

bramp commented

I haven't touched this project in a while, but I just read the code again. It seems it considers the background to be 255, and all other values to be part of the component.

Also, it accepts a 1D array, so something like this: (I've not tested this code)

data = [
  255,   1,   1,
  255, 255,   1,
    1, 255,   1,
    1, 255, 255,
];
matrix = BlobExtraction(data, 3, 4);

image
Cool, thanks, you are awsome.
I just take the example above, but get this.

bramp commented

gah, sorry then. I don't know. It's been 8 years since I wrote this, and I haven't used it since. If you can figure out what's wrong, I'd happily accept a pull request to improve the documentation/code.

thanks, will have a try