How to save full size image in axes 2?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ahmad Nor
am 28 Okt. 2014
Kommentiert: Ahmad Nor
am 30 Okt. 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
0 Kommentare
Akzeptierte Antwort
Geoff Hayes
am 28 Okt. 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!
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Convert Image Type finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!