How to shade bins in an ImageHistogram
to match the image GrayLevel
?
Inputs
Import the following graphic:
B = Import["https://i.sstatic.net/F3Fxc.png"];
Create a histogram of the pixel intensities:
ImageHistogram[B]
The output is
How to shade the histogram bins to match the image?
The goal is to shade the bins to match the image. For example, if the bin counts the number of pixels with GrayLevel
s between 0.09
and 0.1
, the bin would be GrayLevel[0.09]
Attempts
ImageHistogram
provides controls for Filling
, yet I am unable to exploit FillingStyle
.
While I can shade a graphics primitive using LinearGradientFilling[{Black, White}]
(below), it was not clear how to apply this in ImageHistogram
.
Investigated, without luck, this post: Histograms of grayscale images and this post Difference of ImageHistogram and Histogram of grayscale image
ImageHistogram[B,6,ColorFunction->(GrayLevel[Floor[#,1/5]]&)]
, but it doesn't work -- the color is a gradient and not choppy as I desire! $\endgroup$ImageHistogram
does supportFillingStyle
! Which version are you using? $\endgroup$