I suppose this isn't a bug, but a trap for the unwary.
The documentation http://magick.imagemagick.org/script/co ... onents.php correctly states: "By default, the labeled image is grayscale."
The darkest output gray will be black. I thought the next would be 1, the next would be 2, etc, on a scale from 0 to QuantumRange. This is true for Q16, but not for Q32.
For Q32, the grays are 0, 65537, 2*65537, etc.
The reason for this is that the code uses a map with MaxColormapSize elements, initialized to the range zero to QuantumRange. Hence the intervals are QuantumRange/MaxColormapSize, which is 1 for Q16 but 65537 for Q32.
Usage: connected components labelling
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Usage: connected components labelling
snibgo's IM pages: im.snibgo.com
Re: Usage: connected components labelling
The objects are enumerated as the colormap indexes, not the sRGB components. So colormap index 0 is object 0, colormap index 1 is object 1, etc.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Usage: connected components labelling
Yes, indeed. And the colour of colormap index 0 is black, and of index 1 is rgb(1,1,1) in Q16 but index 1 is rgb(65537,65537,65537) in Q32.
snibgo's IM pages: im.snibgo.com