R Gow
MATLAB can handle ten bit images. According to the documentation for
IMREAD, it can read in PGM files with up to 16 bits of resolution.
MATLAB does not have a 10 bit data type, so it must store your data as a
UINT16.
-Dave Tarkowski
Thanks for the info, so do you know exactly what operation MATLAB
does to store the 10 bit image as 16 bit unsigned integer?
Thanks,
Ryan
Dave Tarkowski wrote:
>
>
> On Fri, 9 Jul 2004 06:48:57 -0400, R Gow wrote:
"R Gow" <r.d...@no.spam.ed.ac.uk> writes:
> Dave,
>
> Thanks for the info, so do you know exactly what operation MATLAB
> does to store the 10 bit image as 16 bit unsigned integer?
>
> Thanks,
>
> Ryan
>
The least-significant 10 bits of the MATLAB uint16 value are exactly the
original 10 bits.
--
Steve Eddins
Development Manager, Image Processing Group
The MathWorks, Inc.
Thanks but does that mean that bits > 10 are simply set to zero to
basically store the 1024 codes from original image in 65536 codes, or
is the data scaled to fill the new range?
Thank again,
R Gow
Steve Eddins wrote:
>
>
>> Dave Tarkowski wrote:
>> >
>> >
>> > On Fri, 9 Jul 2004 06:48:57 -0400, R Gow wrote:
> Steve,
>
> Thanks but does that mean that bits > 10 are simply set to zero
yes
> Thanks but does that mean that bits > 10 are simply set to zero
> to basically store the 1024 codes from original image in 65536
> codes, or is the data scaled to fill the new range?
When writing 10 bit PGM images, bits 11-16 are set to zero, if I
remember correctly, and if MATLAB is still using the code I wrote.
On read, those bits are simply ignored.
The PGM specs don't allow binary images with more than 8 bits, but
some applications still write 16 bit PGM images, so I added
support for binary images with bitdepth > 8 by request from
someone missing support for 16 bit PGM images. I have never seen
or heard of 10 bit binary PGM images, although the code should
handle them correctly (I hope).
Peter
--
Everyone has a blind spot in each eye. I also have a deaf spot
in each ear. If you stand at a certain place, I can't hear you.
...and if MATLAB is still using the code I wrote...
they do, peter, they do:
function [X, map] = readpnm(filename)
%READPNM Read image data from a
%PPM/PGM/PBM file.
% SNIP
% Author: Peter J. Acklam
% E-mail: pjac...@online.no
% Copyright 2001-2002 The MathWorks, Inc.
% $Revision: 1.1.6.2 $ $Date: 2004/02/01 22:04:51 $
us
> Peter J. Acklam:
>
> <SNIP 10-bit pgm problem
>
> ...and if MATLAB is still using the code I wrote...
>
> they do, peter, they do:
Evidently so. :-)