I have many sequential gray scale images (2048*2048 pixels, 8bit).
To determine the brightness, standard deviation, and count of pixels with in two bins, zero and non-zero brightness, I use the code below, which I hope can be improved.
For a single image I need about 0.5 sec.
SetSharedVariable[stdDeviation, mean, zeroPixels, nonzeroPixels];
(* for testing with a single image*)
numFiles = 1;
fNames={"F:\\20160122_example_image.png"};
stdDeviation = Array[0 &, numFiles];
mean = Array[0 &, numFiles];
zeroPixels = Array[0 &, numFiles];
nonzeroPixels = Array[0 &, numFiles];
ParallelTable[
image = Import[fNames[[i]]];
imageData = Flatten[ImageData[image]];
mean[[i]] = Mean[imageData];
zeroPixels[[i]] = Length[ImageValuePositions[image, 0.]];
nonzeroPixels[[i]] = 2^22 - zeroPixels[[i]];
stdDeviation[[i]] = StandardDeviation[imageData],
{i, 1, numFiles}
]; // AbsoluteTiming
{0.460753, Null}
Here is an example image: https://drive.google.com/open?id=0B9wKP6yNcpyfbTlRU096dWhxT1U
This image is an CMOS sensor image taken with the lens was covered. Therefore it is mainly black. I am interested in investigating sensor noise and the number of 'defect' pixels.