I'm looking over a number of images with missing aspects, namely missing either red, green or blue channels (which have been removed accidentally by an automated process before I was give the images). I need to fine the valid images.
Is there a quick way of checking to see if an image has all three (R, G & B) channels? Alpha channels (if included) are ignored.
I've been using PIL up until this for image processing in Python point (I realise it might not be the way forward). I've not tried anything yet as I'm not sure the best way forward: My first guess, and this may be long winded would be to loop over every pixel and working out if all the Red, Green or Blue data is zero (presumed missing) However I 've a feeling there's a faster method.
Pretty much any image processing library provides means for reading pixel values. The simplest and most efficient way is indeed iterating over all pixels checking if any value is 0 for all pixels.
Of course many libraries also provide convenient tools for extracting color planes and calculating average pixel values. But internally, they do nothing but iterating over pixels. How else should any algorithm know if all values are zero if not by checking every value? So your feeling is wrong, unless the pixel reading function is poorly implemented and the algorithm is using someething more efficient, which is quite unlikely.
So you're doing nothing wrong either way.
Validate existance of RGB channels