I want to calculate the mean brightness and the standard deviation of columns in a gray scale image (8bit).
Can the following calculation code be made faster or/and shorter:
imageData = ImageData[Import["https://i.stack.imgur.com/i6qjE.png"], "Byte"];
dim = Dimensions@imageData;
list = Range@dim[[2]];
meanColumnBrightness = Mean@imageData[[All, #]] & /@ list;
stdDevColumnBrightness = StandardDeviation@imageData[[All, #]] & /@ list;
The result is:
Needs["ErrorBarPlots`"];
yWithErrors =
Transpose[{Transpose[{list, meanColumnBrightness}],
ErrorBar /@ stdDevColumnBrightness}]
Show[ErrorListPlot[yWithErrors], Joined -> True, PlotStyle -> {Blue},
Epilog -> {PointSize[Small],
Point[Transpose[{list, meanColumnBrightness}]]}, PlotRange -> All,
Frame -> True, FrameLabel -> {{"y", ""}, {"x", ""}},
BaseStyle -> {FontSize -> 20, FontFamily -> "Calibri"},
ImageSize -> 600]