MATLAB-如何避免出现锯齿状图像? [英] MATLAB - How to avoid a jagged image?
问题描述
如何避免在 MATLAB 中出现锯齿状图像?
How do I avoid a jagged image in MATLAB?
我在MATLAB中打开了一个600 x 600像素的图像,并对图像进行了一些处理.但是,当我保存它时,它看起来是如此模糊和参差不齐.我该怎么办?
I have a 600 x 600 pixels image opened in MATLAB and do some processing on the image. However, when I save it, it looks so blurred and jagged. What should I do?
(此问题与我之前的问题 MATLAB-如何在图像上绘制x,y并保存? )
(This question is related to my previous question, 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
推荐答案
我的猜测是JPEG压缩伪像. JPEG对于包含许多高频成分的数据来说不是一种很好的格式.您是否尝试过降低压缩率?像这样:
My guess would be JPEG compression artifacts. JPEG isn't a great format for data with a lot of high frequency components. Have you tried turning the compression down? Like so:
imwrite(f.cdata,([num2str(imagefile) '.jpg']),'Quality',100);
quality参数的默认值仅为75.在很多情况下都足够了,但是您可能还需要更多.
The default for the quality parameter is only 75. That's plenty for a lot of cases, but you might need more.
这篇关于MATLAB-如何避免出现锯齿状图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!