2010-07-05 182 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