Histogram of a binary image - bug?

Hello,

I’m seeing a weird behavior when checking the histogram of a binary image, which I generated by color thresholding an RGB image in Fiji. I was wondering if I encountered a bug?

Here are the steps to reproduce my case:

  1. Open an RGB image, e.g. Clown.jpg from the samples.

  2. Run Color Threshold… in the HSB space and adjust values to H:0-4, S:0-255, B:114-255, all Pass, check Dark background.

  3. Run “Make Binary” or “Convert to Mask”. This generates an 8-bit binary image with value 0 for the black background pixels and 255 for the white foreground pixels.

  4. Now, if I check the histogram of this binary image, I see min=255, max=255. Shouldn’t the min=0, since there are lots of black background pixels (value=0) in the binary image?

Thanks,
Ved

Good day Ved,

I can’t confirm your finding.

Which version of ImageJ are you using?

Regards

Herbie

Dear Herbie,

I am using version 2.0.0-rc-69/1.52i. I updated it to the latest version 2.0.0-rc-69/1.52j, but the bug still persists (at least on my end).

If it helps, I’m running Fiji on Windows 10 with java.version: 1.8.0_172.

Ved

Here is the screenshot:

Screenshot

… and here is mine:

Sorry to see this discrepancy but I’ve no idea what causes it.

In any case please try to update to the daily build of ImageJ.

Regards

Herbie

You are seeing this weird behavior because the Color Threshold command is setting an invisible threshold and you have “Limit to Threshold” enabled in Analyze>Set Measurements. This unexpected behavior should probably be considered a bug so the Histogram command in the latest daily build (1.52k68) ignores invisible thresholds.

1 Like

That was it. Thanks Wayne!

Ved