Matlab how to save a modified image from axes [closed]

There are several ways to do this, but maybe a good way is to store the image (after applying a filter) in the figure’s application data. You can do this with guidata.

After each filter you store the image;

% --- Executes on button press in black.
function black_Callback(hObject, eventdata, handles)
% hObject    handle to black (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
axes(handles.axes1);
global im
xb=im;
b=im2bw(xb);
imshow(b);
% Store the image
handles.image = b;
guidata(hObject, handles);

Then in your savebutton_Callback, simply refer to handles.image;

Leave a Comment