imread (repost)

Thomas L. Scofield scofield at calvin.edu
Mon Aug 4 20:57:48 CDT 2008


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080804/fe6255ff/attachment.html 


More information about the Octave-maintainers mailing list