reading multiple images fro desktop folder?
2 ビュー (過去 30 日間)
古いコメントを表示
i want maximum images for batch processing... i use following code but facing errors.. kindly help me
code a='C:\Users\Romesha\Desktop\2'; imagefiles = dir(fullfile(a,'*.bmp')); nfiles = length(imagefiles); % Number of files found for ii=1:nfiles currentfilename = imagefiles(ii).name; currentimage = imread(currentfilename); images{ii} = currentimage; imshow(images{ii}); end
Error >> gui Warning: Single line Edit Controls can not have multi-line text > In openfig at 135 In gui_mainfcn>local_openfig at 286 In gui_mainfcn at 234 In gui at 42 Warning: Single line Edit Controls can not have multi-line text > In openfig at 135 In gui_mainfcn>local_openfig at 286 In gui_mainfcn at 234 In gui at 42 Warning: Single line Edit Controls can not have multi-line text Warning: Single line Edit Controls can not have multi-line text Error using imread (line 350) File "001_2_1.bmp" does not exist.
Error in gui>PB1_Callback (line 112) currentimage = imread(currentfilename);
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in gui (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)gui('PB1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
採用された回答
Image Analyst
2014 年 1 月 24 日
See the FAQ for code that works: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
I don't even see an edit box control referred to in your code. Anyway, your code will just overwrite all the images in the display and the only one you'll most likely even see is the very last one. By the way you need to be using fullfile() with (the very badly-named) "a", or else it won't find your images
currentfilename = imagefiles(ii).name;
fullFileName = fullfile(a, currentfilename);
currentimage = imread(fullFileName);
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!