projectdir = 'the/directory_that/the/images/are_in';
selected_image_idx = get(handles.listbox1, 'Value');
all_image_names = cellstr( get(handles.listbox1, 'String') );
selected_image_names = all_image_names(selected_image_idx);
num_selected = length(selected_image_names);
for K = 1 : num_selected
this_name = selected_image_names{K};
this_image_file = fullfile( projectdir, this_name );
this_image = imread(this_image_file);
imshow(handles.axes1, this_image);
title(handles.axes1, ['Original image: ', this_name ];
title(handles.axes2, 'Segmentation being computed');
imshow(handles.axes2, nan(1,1,3));
drawnow();
segmented_image = segment_one_image(this_image);
imshow(handles.axes2, segmented_image);
title(handles.axes2, ['Segmented image: ', this_name ];
drawnow();
end
Best Answer