Find black images in a file
조회 수: 1 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
채택된 답변
Image Analyst
2017년 1월 18일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!