フィルターのクリア

Error in imread function

5 ビュー (過去 30 日間)
Amere
Amere 2022 年 4 月 12 日
コメント済み: Amere 2022 年 4 月 12 日
I am receiving this error when trying to read images into my script
Error using imread>get_format_info (line 491)
Unable to determine the file format.
Error in imread/call_format_specific_reader (line 422)
fmt_s = get_format_info(fullname);
Error in imread (line 403)
[X, map] = call_format_specific_reader();
Error in untitled (line 14)
dots=imread(fullFileNames{r});
Looking into it, it appears that full stops are being introduced into the 'FullFileNames' cell before the image name. These full stops are not present in the raw images. There are 10 raw images with file names of IMG_0001-IMG_0010.jpg.
Why is this happening and how can I fix it?
My code is
clc;
clearvars;
fds=fileDatastore('*.jpg','ReadFcn',@importdata);
fullFileNames=fds.Files;
numFiles=length(fullFileNames);
for r=1:numFiles
fprintf('Now reading file %s\n',fullFileNames{r})
dots=imread(fullFileNames{r});

採用された回答

DGM
DGM 2022 年 4 月 12 日
編集済み: DGM 2022 年 4 月 12 日
Files that start with a dot are hidden files, possibly temporary files. Who knows where they came from or if they're actually readable or complete.
Just don't read them. Use a more selective pattern like
fds = fileDatastore('IMG*.jpg','ReadFcn',@importdata);
I'm assuming that the dot in the directory name is real.
  1 件のコメント
Amere
Amere 2022 年 4 月 12 日
Thank you so much for your help!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by