reading multiple images fro desktop folder?

2 vues (au cours des 30 derniers jours)
romasha
romasha le 24 Jan 2014
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

Réponse acceptée

Image Analyst
Image Analyst le 24 Jan 2014
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);

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by