octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: imread (repost)


From: Søren Hauberg
Subject: Re: imread (repost)
Date: Tue, 05 Aug 2008 06:53:26 +0200

man, 04 08 2008 kl. 21:57 -0400, skrev Thomas L. Scofield

> At least some png image files (BMP and PSD files as well, I believe)
> use 4 channels: red, green, blue and alpha.  For those files, imread
> returns an array A satisfying size (A, 3) = 4..  (Would it do so as
> well for files using CMYK color space?)  As such, the matrix A in
> which the image is stored cannot be sent off to imshow without
> limiting its 3rd coordinate, as in imshow (A(:, :, 1:3)).  The changes
> John Eaton made to imread.m as I submitted it were quite necessary,
> but in the process code I had included for limiting this 3rd
> coordinate in imread before ever returning the image was lost.  Should
> it be reinstated?  Or, should imshow be modified to handle the
> occasional image like these png files?  I don't mind making the
> changes, but lean towards altering imshow instead of imread if this
> doesn't result in an unacceptable incompatability with Matlab.
> Interestingly, when I read this same kind of png into Matlab, it
> returns a 2D matrix, not 3 like in Octave and, subsequently, it
> displays the image as grayscale when it was really a color image (the
> Octave call imshow(A(:, :, 1:3)) gets the color right).  (Perhaps that
> is remedied in Matlab with optional arguments to imread.)

The matlab version of imread supports an extra output argument that
contains the alpha channel of an image. I don't think it is trivial (nor
a good idea) to change imshow to make it possible to show images with an
alpha channel. I mean, what should be to visual result when showing an
image that s 100% transparent? I'd stick with showing RGB only.

Søren
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]