Improve image quality, grainy words

조회 수: 1 (최근 30일)
alessandro mutasci
alessandro mutasci 2021년 10월 18일
댓글: Rik 2021년 10월 18일
Good morning, I'm using this script to obtain a sequences of image. The problem is that the quality of the written part, or more in general of the final image is poor. If I try to zoom the image, it is all grainy. Is there a way to improve it? I attach the script I use and an example of image I obtain.
path='C:\Users\Utente\Desktop\xtreno\imm\New Folder1';
Dir=dir(path);
c=figure('Visible','off');
h1=subplot(1,2,1)
annotation(c,'line',[0.733928571428571 0.7875],[0.4 0.4],'Color',[1 0 0],'LineWidth',1);
annotation(c,'textbox',[0.779571428571429 0.354761904761906 0.131142857142857 0.107142857142858],'String',{'PROBE'},'FontSize',12,...
'FitBoxToText','off',...
'EdgeColor','none');
for i=1:17
h1=subplot(1,2,1)
hold on
plot(t1(1:i),s11(1:i),'Marker','x','LineStyle','--') %s1t1 camera, s3tefibra
if i<1
plot(t2(1:i),s3(1:i),'LineWidth',2)
else
plot(t2(1:i*10-7),s3(1:i*10-7),'LineWidth',2)
end
line([t1(i) t1(i)],[-2 2],'Color',[0 0 0]);
ylabel({'Phase (-)'},'FontName','Times New Roman');
xlabel({'t (s)'},'FontAngle','italic','FontName','Times New Roman');
legend1 = legend({'Camera','Fibre'});
h2=subplot(1,2,2)
I=imread([path,'/',Dir(2+i).name]);
imshow(I);
box(h1,'on');
h1.Position=[0.13 0.135714285714286 0.5075 0.789285714285715];
set(h1,'FontSize',10,'LineWidth',1.5,'XGrid','off','YTick',[0.2 0.9],'YTickLabel',{'Liq', 'Vap'},'XLim',[t1(i)-0.2,t1(i)+0.05],'XLimMode','Manual','YLim',[-0.2,1.2],'YLimMode','Manual');
F = getframe(c);
F1(:,:,:,i) = F.cdata;
imwrite(F1(:,:,:,i), sprintf('frame%d.png', i));
end
  댓글 수: 2
Rik
Rik 2021년 10월 18일
Your image is apparently fairly small. You can either increase the size of your figure, or use a different function that allows you to set the resolution (like @yanqi liu suggested).
alessandro mutasci
alessandro mutasci 2021년 10월 18일
yes you are right, I tried the function that @yanqi liu suggested, but it's still grainy. Could you tell me how to increse the size of my figure please?

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

답변 (1개)

yanqi liu
yanqi liu 2021년 10월 18일
sir,please use
print(gcf,'-dpng','-r200','your_image_name')
  댓글 수: 3
alessandro mutasci
alessandro mutasci 2021년 10월 18일
yes, using an higer DPI, it is going ok. but now I'm trying to use it for all images but it's not working. it says that there are multiple error, but I'm not understanding how to solve it.
for i=1:16
I=sprintf('frame%d.png',i)
print(I,'-dpng','-r1000','your_image_name%d')
end
Rik
Rik 2021년 10월 18일
You received an error. Now it is time to read the documentation of that function. You didn't do that yet, but you should.

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

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by