MATLAB Answers

imfinfo unable to open a file

조회 수: 39(최근 30일)
Pavlov
Pavlov 26 Aug 2014
댓글: David Young 15 Aug 2017
My goal is ultimately to get time stamps for a large number of JPEG images so that I know the time that each frame of video data was collected.
cd(video_dir);
info = imfinfo([video_dir],'jpg');
Which gives the error, "Unable to open file ..." (imfinfo line 163).
I've used this function successfully to extract information about tiff images on the same data, but I don't see why this isn't working for JPEG images.

  댓글 수: 0

로그인 to comment.

답변(2개)

dpb
dpb 26 Aug 2014
info = imfinfo([video_dir],'jpg');
Because you didn't give imfinfo a legitimate file name...it's simply looking for a filename that is just a directory name with '.jpg' appended.
There's no indication in the doc's that imfinfo can work on multiple files at a time via wildcard expansion, use dir for that and the process the resulting structure.

  댓글 수: 0

로그인 to comment.


Ben11
Ben11 26 Aug 2014
It looks like you try to open a directory instead of an image. I tried your syntax and got the same error.
What if you try something like this:
imfinfo(strcat(video_dir,'/YourImageName.jpg'))

  댓글 수: 1

David Young
David Young 15 Aug 2017
Better to use fullfile than strcat.

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그


Translated by