imfinfo unable to open a file

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.

回答 (2 件)

dpb
dpb 2014 年 8 月 26 日

2 投票

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.
Ben11
Ben11 2014 年 8 月 26 日

1 投票

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 2017 年 8 月 15 日
Better to use fullfile than strcat.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

タグ

質問済み:

2014 年 8 月 26 日

コメント済み:

2017 年 8 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by