image() and imread() displays lower quality image

30 次查看(过去 30 天)
Apologies if I'm misusing any image-processing terms; I'm not very familiar with them.
When I display an image in Matlab using the imread() function, the displayed image is noticably lower quality than the original image before I load it into Matlab. To clarify, this doesn't have anything to do with saving an image through Matlab; I am loading an image that when viewed in another image viewing program (Windows Photo Viewer, Adobe Illustrator, etc) seems to have one level of quality, but when loaded and displayed in Matlab seems to lose that quality.
I've attached the original image and a screenshot comparison of the original image (on the left) and Matlab's display of the image (on the right). My code is as follows:
cadPic = imread('original.png');
image(cadPic)
I've tried various combinations of image(), imread(), and imshow(). I've also tried converting the original image from an int8 RGB triplet into a double, with this method:
I've also tried to use the
axis image
command specified by this answer, with no effect. I can manually resize the image in Adobe Illustrator without seeing this kind of quality loss, so I'm not sure if the solution in that answer applies to this case.
  2 个评论
Walter Roberson
Walter Roberson 2019-1-16
It looks to me to be a challenge with aliasing on lines that are only one pixel wide with an image that is several times screen size.
I am not sure how the other programs are coping with this. It is possible, I suppose, that they have algorithms to detect lines and prioritize those.
I agree that the output leaves rather something to be desired.
sgreess
sgreess 2019-1-17
Interestingly, the output varies based on the file format I save it in; EPS seems to keep the blurring while PDF doesn't. I've attached an example comparison. In any case, the problem is solved.
Thanks for commenting!

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2019-1-16
I think the image is just being subsampled for display. If you zoom in you'll probably see all the details. See attached zoom demo.
  1 个评论
sgreess
sgreess 2019-1-16
编辑:sgreess 2019-1-17
You're right about the magnification showing that those details still exist. Interestingly, I've found that whether or not this blurriness issue propogates to the file I end up saving seems to depend on what type of file I try to save it as. I was originally using EPS, which showed the blurriness, but PNG and PDF don't.
In any case, the issue is solved. Thank you!
Edit: added a screenshot showing the difference between the Matlab result in EPS vs PDF

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by