reading multiple images fro desktop folder?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
romasha
am 24 Jan. 2014
Beantwortet: Image Analyst
am 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
Akzeptierte Antwort
Image Analyst
am 24 Jan. 2014
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!