2010-07-05 185 views
0

如何避免MATLAB中的锯齿图像?MATLAB - 如何避免锯齿状图像?

我有一个600 x 600像素的图像在MATLAB中打开,并对图像做了一些处理。但是,当我保存它时,它看起来如此模糊和参差不齐。我该怎么办?

如果它仅仅是一个解决问题,也许使用打印命令(如下所示)有明确的分辨率选项可能会解决(这个问题是涉及到我刚才的问题,MATLAB - How to plot x,y on an image and save?

fid = fopen(datafile.txt); 
A = textscan(fid,'%f%f%f'); %read data from the file 
code = A{1}; 
xfix = A{2}; 
yfix = A{3}; 

for k=1:length(code) 
    imagefile=code(k); 
    rgb = imread([num2str(imagefile) '.jpg']); 
    imshow(rgb); 
    hold on; 
    x = xfix2(k); 
    y = yfix2(k); 
    plot(x,y,'-+ b'); % plot x,y on the 
    saveas(([num2str(imagefile) '.jpg'])) % Save the image with the same name as it open. 
end 
hold off 
+0

@Jessy你能发表一个代码片段吗? – 2010-07-05 17:52:15

+0

@Vitor,我附上了代码的链接。 – Jessy 2010-07-05 18:02:54

+0

你使用imwrite或imsave来保存图像吗? imwrite有哪些选项? – 2010-07-05 18:13:40

回答

0

它。

print(gcf,'-djpeg','-r600',[num2str(imagefile)]) 
0

我的猜测是JPEG压缩失真。对于具有大量高频成分的数据,JPEG格式不是很好的格式。你尝试过压缩吗?像这样:

imwrite(f.cdata,([num2str(imagefile) '.jpg']),'Quality',100); 

质量参数的默认值只有75.这对很多情况很有用,但您可能需要更多。

+0

感谢现在的图像更加清晰:) ...但我用来绘制xy坐标的“+”(我用蓝色设置)在保存时变成了黑色。为什么? – Jessy 2010-07-07 13:53:51