imread error: Unable to determine the file format.

15 Ansichten (letzte 30 Tage)
norah ik
norah ik am 31 Dez. 2016
Bearbeitet: norah ik am 31 Dez. 2016
EDIT:: problem solved, reason for crash is corrupted image files.
i have the following code, it calculate the mean image of multiple of images (under frames folder)
i tested the same code with 40 images and it worked fine.
cd '/Users/macuser/Desktop/frames/';
fileList= dir('frame*.png');
listLength= length(fileList);
im= rgb2gray(imread(fileList(1,1).name));
sumImage= double(im);
for i=2:listLength
grayImage= rgb2gray(imread(fileList(i,1).name));
sumImage = sumImage + double(grayImage);
end;
meanImage = sumImage/listLength;
listLength
imshow(meanImage,[]);
however when i tested it with 100 images i get the error [Unable to determine the file format.]
Error using imread (line 362)
Unable to determine the file format.
Error in framesMean (line 24)
grayImage= rgb2gray(imread(fileList(i,1).name));
i've tried to trace the error, line 24 which is causing the error works fine when i get it out of the loop.
fileList(i,1).name gets the full file name including the file extension ( png).
i can't find the cause of the error. any help would be appreciated.
  2 Kommentare
Image Analyst
Image Analyst am 31 Dez. 2016
What is the i value when it crashes? What is the filename when that happens? Can you attach that image here? It seems to be corrupt. Can you open it in Photoshop?
norah ik
norah ik am 31 Dez. 2016
i came back to clarify, its working now.
seems like what you said, i noticed the counter i stopping at value 31, i checked that file it seems to be corrupted.
i regenerate the frames out of the video again and its working fine now with over 400 frames.
thanks a lot.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by