image() and imread() displays lower quality image

34 vues (au cours des 30 derniers jours)
sgreess
sgreess le 16 Jan 2019
Modifié(e) : sgreess le 17 Jan 2019
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 commentaires
Walter Roberson
Walter Roberson le 16 Jan 2019
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 le 17 Jan 2019
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!

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 16 Jan 2019
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 commentaire
sgreess
sgreess le 16 Jan 2019
Modifié(e) : sgreess le 17 Jan 2019
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

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by