Is this another bug in imread(), or is this just a forum problem?

2 visualizaciones (últimos 30 días)
DGM
DGM el 11 de Abr. de 2022
Comentada: DGM el 24 de En. de 2023
I've been finding that imread() will no longer correctly process images with alpha content when I try to use it in forum posts.
Attached is a simple test image consisting of a flat purple field, and an object shape defined strictly by alpha alone.
When I run the following test in the forum editor (R2022a), I get this garbage:
A = imread('icon.png');
[B,~,alph] = imread('icon.png');
montage({A B alph},'size',[1 3])
I shouldn't have to say that's wrong. This is what R2019b shows. The second and third images are the color and alpha content as described. The first image is the composed image that imread() frustratingly (but expectedly) returns when the short syntax is used.
So imread() appears to no longer be able to handle images with alpha. It behaves like the short syntax is being used, returning a composed image and an empty array for alpha.
I'm calling on people with newer versions than I have. Is this another new bug in the R2022a version of imread(), or is this just something that's broken only on the forum editor for some reason? The attached image and code snippet should suffice for a test.
  3 comentarios
Steve Eddins
Steve Eddins el 24 de En. de 2023
This problem has now been fixed in MATLAB Answers.
A = imread('icon.png');
[B,~,alph] = imread('icon.png');
montage({A B alph},'size',[1 3])
DGM
DGM el 24 de En. de 2023
Thank you for the attention on the matter. This will definitely simplify making examples on the forum.

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 11 de Abr. de 2022
Running the code in the Answers editor gives you first image you posted, without the black head. If you run it in desktop MATLAB 2022a you get the second image with the white head.
[B,~,alph] = imread('icon.png');
whos alph
Name Size Bytes Class Attributes alph 0x0 0 double
If I run the same code it in the Desktop I get
Name Size Bytes Class Attributes
alph 160x160 25600 uint8
I don't know why there is a difference.
  3 comentarios
Image Analyst
Image Analyst el 11 de Abr. de 2022
I've let the developer know, but the forum definitely does not have all the full capability of desktop MATLAB particularly when it comes to display things or interacting with the display or image. For example, the impixelinfo function, as simple as that is, doesn't work if called from the Answers editor.
DGM
DGM el 11 de Abr. de 2022
Editada: DGM el 11 de Abr. de 2022
Thanks for getting some attention on this. I kind of expect some of the graphics tools to be nonfunctional, especially things that require interaction. That said, I don't see why imread() would behave differently, especially in such particular ways.

Iniciar sesión para comentar.

Más respuestas (1)

Steve Eddins
Steve Eddins el 12 de Abr. de 2022
I can reproduce the problem in MATLAB Answers. The problem does not occur in MATLAB Online or in the desktop version.
I'll let the MATLAB Answers team know.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by