フィルターのクリア

Files not read in correct order

5 ビュー (過去 30 日間)
BlueBee77
BlueBee77 2016 年 4 月 19 日
コメント済み: BlueBee77 2016 年 4 月 19 日
Hi! So i am having a problem. I am reading a number of files from a directory in Matlab. The file are named as crop1.jpg crop2.jpg....... The issue is that Matlab doesn't read them like crop1.jpg crop2.jp and so on rather it read it like crop1.jpg crop10.jpg crop11.jp....Seems like reading all the files starting with 1 then all the with 2 like crop2.jpg crop21 crop22... and so on I don't understand what is going wrong. Below is my code. any help will be appreciated
imageNames = dir(fullfile('Test Images/*.jpg'));
nfiles= length(imageNames);
for ii = 1:nfiles
filename = strcat('/Users/name/Documents/Test Images/',imageNames(ii).name);
frame= imread(filename);
imshow(BWframe)
end

採用された回答

Image Analyst
Image Analyst 2016 年 4 月 19 日
See discussion here http://blogs.mathworks.com/pick/2014/12/05/natural-order-sorting/ of Stephen Cobeldick's utility.
  1 件のコメント
BlueBee77
BlueBee77 2016 年 4 月 19 日
That solved my problem. Thanks alot Image analyst.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by