Usage: connected components labelling
Posted: 2017-01-27T22:39:57-07:00
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.
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.