3

When building a simple image with only red Rred = Image[Table[{r, 0, 0}, {r, 0, 255}, {g, 0, 255}], "Byte"], enter image description here the corresponding histogram displays badly: each channel has a wrong colour ImageHistogram[Rred, Appearance -> "Separated"] enter image description here

PaoloS
  • 31
  • 2

1 Answers1

8

That is because you did not specify explicitly which color space you use in your image. The colors of the histograms are therefore the first three colors from the default Mathematica color scheme.

The following works as expected:

imageRed = 
 Image[Table[{r, 0, 0}, {r, 0, 255}, {g, 0, 255}], "Byte", 
  ColorSpace -> "RGB"]

ImageHistogram[imageRed, Appearance -> "Separated"]

enter image description here

Domen
  • 23,608
  • 1
  • 27
  • 45