why does whiteness show up ? !

조회 수: 1 (최근 30일)
Mayssa
Mayssa 2015년 8월 21일
댓글: Star Strider 2015년 8월 22일
I saved an image in my file using "saveas" and I have used those instructions
DirectoryPath =('C:\Users\Mayssa\Desktop\pfe\Matlab\interface');
whereToStore=fullfile(DirectoryPath,a);
saveas(gcf, whereToStore);
But when I try to read it (with imread) it shows up on a a white background, how can I get rid of it ? :(

답변 (3개)

Star Strider
Star Strider 2015년 8월 21일
From the saveas documentation:
  • If you do not specify an extension, then saveas saves the figure to a FIG-file.
Instead of imread, see if openfig works.
  댓글 수: 6
Mayssa
Mayssa 2015년 8월 22일
편집: Mayssa 2015년 8월 22일
@Star Strider, It does work for me too, but in my code I am plotting over an image texture than saving the whole in another image.
Star Strider
Star Strider 2015년 8월 22일
Try this:
figure(1)
plot(-10:10, exp(-([-10:10]/5).^2))
saveas(gcf, '#TestSAVEAS_01.png');
figure(2)
plot(-10:10, 1-exp(-([-10:10]/5).^2))
saveas(gcf, '#TestSAVEAS_02.png');
A = imread('#TestSAVEAS_01.png');
B = imread('#TestSAVEAS_02.png');
figure(2)
image(uint8((double(A)/2 + double(B)/2)))
hold on
hold off
title('Retrieved & Combined Images')
delete('#TestSAVEAS_01.png')
delete('#TestSAVEAS_02.png')

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2015년 8월 21일

Image Analyst
Image Analyst 2015년 8월 21일

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by