From: Uyen Pham on 12 May 2010 00:51 Dear all, I have now finished the "Select images" button (multiple select on) and import them all into the listbox. However, I don't know how to choose the selected image from the listbox and display it on the axes as well as show its information on the static text box (I have drawn an axes and static text box on my GUI). Here is my code. Please show me where is the wrong things. % --- Executes on button press in find. function find_Callback(hObject, eventdata, handles) % hObject handle to find (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Read the input image %Image formats %.bmp .gif.hdf.jpg.jp2.jpx.pbm.pcx.pgm.png.pnm.ppm.ras.tiff.xwd [files, path] = uigetfile(... {'*.bmp;*.gif;*.hdf;*.jpg;*.jp2;*.jpx;*.pbm;*.pcx;*.pgm;*.png;*.pnm;*.ppm;*.ras;*.tiff;*.xwd',... 'All Image Files' },... 'Pick files','MultiSelect', 'on'); if ~path return; end inputImages = get(handles.listbox,'String'); if iscell(files) == 0 inputImages{length(inputImages)+1} = fullfile(path, files); else for n = 1:length(files) inputImages{length(inputImages)+1} = fullfile(path, files{n}); end end set(handles.listbox, 'String', inputImages); set(handles.listbox, 'Value', 1); guidata(hObject, handles); % --- Executes on selection change in listbox. function listbox_Callback(hObject, eventdata, handles) % hObject handle to listbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %Assign the maximum and minimum when pressing "Ctrl" to choose files set(handles.listbox, 'Max', 10); set(handles.listbox, 'Min', 0); inputImages = get(handles.listbox, 'String'); option = get(handles.listbox, 'Value'); selected_img = imread(fullfile(inputImage(option))); axes(handles.listbox); imshow(selected_img); handles.img = selected_img; % tao mot truong moi cho handles guidata(hObject, handles); info = imageinfo(selected_image); set(handles.img_info, 'String', info); Thank you very much for your help!!!
First
|
Prev
|
Pages: 1 2 3 Prev: www.voguesneakers.com Cheap Jordan Shoes,Cheap Air Max Shoes Next: cosine transform |