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
Image Analyst 2014-1-24
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 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by