Is there a good way to "bin" image data, which is analogous to hardware binning of a detector array? I'd like it to treat image data such that multiple values are averaged to form one mega-sample, giving the impression of a coarser detector array.
Here's an try with ImageResize
and ArrayResample
:
Module[{data, fn},
data = ImageData@ColorConvert[ExampleData[{"TestImage", "Lena"}], "Grayscale"];
fn = ImageResize[#, Scaled[5], Resampling -> "Nearest"] &;
fn@Image@ArrayResample[data, Scaled[0.2], Resampling -> "Nearest"]]
I would like to set the bins with more flexibility, for instance, binning in a single dimension.
Partiton
the image and take the mean of each subset. $\endgroup$