Improve image quality, grainy words
1 view (last 30 days)
Show older comments
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 Comments
Rik
on 18 Oct 2021
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).
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!