How to save full size image in axes 2?

1 visualización (últimos 30 días)
Ahmad Nor
Ahmad Nor el 28 de Oct. de 2014
Comentada: Ahmad Nor el 30 de Oct. de 2014
(this is when I load an image in axes1)
axes(handles.axes1);
handles.DummyImage = uigetfile({'*.jpg';'*.jpeg';'*.png';'*.bmp'});
guidata(hObject,handles);
I=imread(handles.DummyImage);
imshow(I);
(example of processing method)
axes(handles.axes2);
L=imread(handles.DummyImage);
M=adapthisteq(L);
imshow(M);
(this is what I used to save image)
[FileName, PathName] = uiputfile('*.jpg','*.tif', 'Save As');
Name = fullfile(PathName,FileName);
F=getframe(handles.axes2);
W=frame2im(F);
imwrite(W, Name, 'tif');
*I want to save full size image and not in frame size

Respuesta aceptada

Geoff Hayes
Geoff Hayes el 28 de Oct. de 2014
Ahmad - since your code is showing the image M in your axes2 as
axes(handles.axes2);
L=imread(handles.DummyImage);
M=adapthisteq(L);
imshow(M);
then why not re-use M to save the image to file as
imwrite(M, Name, 'tif');
Are you grabbing the frame because the "save" code is in a different callback and so you no longer have access to M? If so, you have a couple of options - either save M as a member of the handles structure (use guidata for this), or try to access the image data directly as
[FileName, PathName] = uiputfile('*.jpg','*.tif', 'Save As');
Name = fullfile(PathName,FileName);
% get the handle to the child object axes2
hChildAxes2 = get(handles.axes2,'Children');
% assume one child only and grab the image data
W = get(hChildAxes2(1),'CData');
% write the image to file
imwrite(W, Name, 'tif');
Try the above and see what happens!
  1 comentario
Ahmad Nor
Ahmad Nor el 30 de Oct. de 2014
Thank you very much.It is really working.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by