octave-maintainers
[Top][All Lists]
Advanced

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

imread (repost)


From: Thomas L. Scofield
Subject: imread (repost)
Date: Mon, 4 Aug 2008 21:57:48 -0400


I posted this several days ago.  Perhaps the subject line "imread/imwrite and other issues" was too all-encompassing.

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.)

Thomas L. Scofield
--------------------------------------------------------
Associate Professor
Department of Mathematics and Statistics
Calvin College
--------------------------------------------------------


reply via email to

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