Imagine I have a stack of image frames, $(f_1, ..., f_N) \in F$, where each $f_i$ has the same set of $(x,y)$ dimensions. Using these frames, I'd like to create an image where each pixel in the image consists of the standard deviation of the values at the corresponding pixel position in each of the $f_i$.
Unfortunately, the following procedure is painfully slow (when applied to a $256 \times 256$ pixel image):
SDImage = ImageData@FrameStack[[1]];
For[a = 1, a <= ImageDimensions[FrameStack[[1]]][[1]], a++,
For[b = 1, b <= ImageDimensions[FrameStack[[1]]][[2]], b++,
SDImage[[a, b]] = StandardDeviation[Table[ImageData[FrameStack[[k]]][[a, b]], {k, 1, Length[FrameStack]}]];
Print[SDImage[[a, b]]];
];
];
SDImage = Image[SDImage]
Is there a faster method of doing this, or perhaps a built in tool (like in ImageJ)?
For
loops and using Mathematica build in functions is always a good way in making the code more efficient. $\endgroup$