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!