Find black images in a file

1 visualización (últimos 30 días)
Sara Antonio
Sara Antonio el 18 de En. de 2017
Comentada: Sara Antonio el 18 de En. de 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!

Respuesta aceptada

Image Analyst
Image Analyst el 18 de En. de 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
  1 comentario
Sara Antonio
Sara Antonio el 18 de En. de 2017
Thanks! It worked perfectly!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by