LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I convert a image such as ".bmp" to array

I want convert ".bmp" image file to array in Labwindows. How can I do that??
0 Kudos
Message 1 of 5
(3,492 Views)
Call GetBitmapFromFile then call AllocBitmapData to allocate buffers for the data (or you can call GetBitmapInfo and allocate them manually). Finally, call GetBitmapData. That will get you a color table and an array of indexes into it.

Regards,
Ryan K.
0 Kudos
Message 2 of 5
(3,492 Views)
I have tried to use the method which you said.

But the converting result is so strange.

I want to convert bmp image to 8bit array .

Can I receive some example??
0 Kudos
Message 3 of 5
(3,492 Views)
Hi,

There are different resolutions in a bitmap file, depending on the resolution is how you decode the information.

Here is an example that opens 24-bit images and calculates a histogram of each channel color (red, green, blue). You can use this example to read the data; there is an array with the data for each color.

I hope this helps.

Juan Carlos
N.I.
0 Kudos
Message 4 of 5
(3,492 Views)
The values of the array for an 8 bit pixmap are going to be indexes into the color table (which will contain 24 bit RGB colors). You can't process the values in the array directly (there is no 8-bit greyscale option). I'm not in front of a computer with CVI right now (travelling), but I think this example might show what you are looking for:
http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3F0E356A4E034080020E74861&p_node=DZ52148&p_source=External

Regards,
Ryan K.
0 Kudos
Message 5 of 5
(3,492 Views)