From: Matt on
Hi -- I have a 2D array of ones and zeros and would like to write it as a binary bitmap. Seems simple, but I can't figure out how. What am I missing? Thanks.
From: ImageAnalyst on
On Jan 28, 9:59 pm, "Matt " <m...(a)email.com> wrote:
> Hi -- I have a 2D array of ones and zeros and would like to write it as a binary bitmap. Seems simple, but I can't figure out how. What am I missing? Thanks.
---------------------------------------------------------------------------------------------------
Matt:
You're missing the Image Processing Toolbox. In that toolbox is the
imwrite() function, which can write BMP format images in a variety of
bit depths.

BMP — Windows Bitmap
Supported Bitdepths No Compression RLE Compression Output Class Notes
1-bit x – logical
4-bit x x uint8
8-bit x x uint8
16-bit x – uint8 1 sample/pixel
24-bit x – uint8 3 samples/pixel
32-bit x – uint8 3 samples/pixel
(1 byte padding)
From: Matt on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <0e5b2491-45b2-45d6-a684-5ec8771179ad(a)k19g2000yqc.googlegroups.com>...
> On Jan 28, 9:59 pm, "Matt " <m...(a)email.com> wrote:
> > Hi -- I have a 2D array of ones and zeros and would like to write it as a binary bitmap. Seems simple, but I can't figure out how. What am I missing? Thanks.
> ---------------------------------------------------------------------------------------------------
> Matt:
> You're missing the Image Processing Toolbox. In that toolbox is the
> imwrite() function, which can write BMP format images in a variety of
> bit depths.

Thanks for the reply -- I have the IPT, but when I just imwrite(M), where M is my matrix, the operation takes a very long time (~1 min for a 2000x1600 image). I suspect there is a better option?
From: Matt on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <0e5b2491-45b2-45d6-a684-5ec8771179ad(a)k19g2000yqc.googlegroups.com>...
> ---------------------------------------------------------------------------------------------------
> Matt:
> You're missing the Image Processing Toolbox. In that toolbox is the
> imwrite() function, which can write BMP format images in a variety of
> bit depths.

Another thing -- when I use this method and open the resulting BMP in IrfanView, I just get a black image.
From: ImageAnalyst on
What is the data type? What does it say when you use the "whos"
command? It needs to be an integer not a floating point array. A
small image like that should write out in just a few seconds, not a
minute, if it were uint8. Probably your array is a double. Scale it
to 0-255 and cast it to uint8 and see if that works.
 |  Next  |  Last
Pages: 1 2 3
Prev: smooth3
Next: Lowpass Butterworth Filter