|
On Oct 24, 7:17=A0am, "mut" <mutant...@gmail.com> wrote:
> hi all:
>
> i have some bmp files with 32 bit depth. i load then with imread:
> ui8Img =3D imread(strImgFName, 'bmp');
>
> size(ui8Img)
> ans =3D
> =A0 =A0 =A0 =A0 786 =A0 =A0 =A0 =A01180 =A0 =A0 =A0 =A0 =A0 3
>
> now i want to find the location for a specific color:
> ui8FindColor =3D uint8([ 0 255 255]);
>
> the problem starts here.... =A0
> the problem is the need to load all 32bits from the bmp file so i can dis=
criminate, for instance, from uint8([ 0 255 255 0]) to uint8([ 0 255 255 11=
1])
>
> if i load the image on to xnview, i can see with the color picker tool th=
at 25:32 bits are different .
>
> the file info is
> stcImgInfo =3D imfinfo(strImgFName);
> stcImgInfo.FormatVersion
> ans =3D
> =A0 =A0 =A0 =A0Version 3 (Microsoft Windows 3.x)
>
> stcImgInfo.BitDepth
> ans =3D 32
>
> stcImgInfo.ColorType
> ans =A0=3D =A0'truecolor'
>
> stcImgInfo.FormatSignature
> ans =3D ''BM' =A0 (i don't know what BM stands for)
>
> i have already read the doc imread and it says that imread supports 32bit=
files but it adds 1 byte padding. i don't quite understand what this means=
. does imread neglects 25:32 bits????
>
> can anyone help me on how to load the 32bits per pixel from a bmp file???=
=A0
>
> help and comments are appreciated
>
> thx in advance
>
> mut
--------------------------------------------
mut:
If you have a file that is storing data in the last byte, then it's
not a standard BMP file. Here's what the standard says:
"The bitmap has a maximum of 2^32 colors. If the Compression field of
the bitmap is set to BI_RGB, the Palette field does not contain any
entries. Each dword in the bitmap array represents the relative
intensities of blue, green, and red, respectively, for a pixel. The
high byte in each dword is not used."
Reference: http://www.wotsit.org/list.asp?al=3DB
To find locations of a particular color (in the first 3 bytes because
the last byte is always supposed to be zero), then you can extract out
each color plane, compare it to the value for that particular plane
that you are wanting to find (this will create a logical image for
each color plane), then AND together the 3 resultant comparison
logical images. Just 1 line of code, or up to 7 if you want to be
easier to read and more explicit and clear.
Regards,
ImageAnalyst
|