Azzera filtri
Azzera filtri

Find black images in a file

3 visualizzazioni (ultimi 30 giorni)
Sara Antonio
Sara Antonio il 18 Gen 2017
Commentato: Sara Antonio il 18 Gen 2017
Hello, So I have this file with jpg images (more than 5000 images), and some of them are completely black. I want to know how many black images I have in my file. I never worked with loading and doing loops with jpg images so I don't know how to generate the code. I was thinking on doing a loop where if the sum of the pixels would be zero (all pixels black), then it would be a black image, else a color image. The problem is that I don't know how to address the pixels in the image matrix.
Thanks in advance!

Risposta accettata

Image Analyst
Image Analyst il 18 Gen 2017
Yes, you can do that. First use one of the code samples in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
Before the loop, put this:
count = 0;
In the middle of the loop, put this:
theSum = sum(sum(imageArray));
if theSum == 0
count = count + 1;
blackFiles{count} = fullFileName; % Or whatever
end

Più risposte (0)

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by