LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display 1-bit Depth BMP file in LabVIEW

Solved!
Go to solution

I'm trying to read a 1-bit depth BMP file into LabVIEW, but using the 2D Picture Control it keeps on coming out black.  It opens fine in Paint/PhotoImpact applications and I can see the image as a boolean array (1-bit pixmap) using the code below - so how can I display the actual BMP image using LabVIEW?  NOTE: The attached ZIP file contains the offending BMP image - not allowed to attach BMP files directly - thtat's odd?

 

Display 1-bit BMP image.png

 

Display 1-bit BMP images.png

0 Kudos
Message 1 of 8
(5,747 Views)
Solution
Accepted by ChrisReed

Your colors are not RGB, but 32 bit. White is defined as xFF000000 instead of x000000 and black is defined as 0xFFFFFFFF instead of 0xFFFFFF.

 

If you rewrite to colormap correctly, the image looks OK, see attached modification (LabVIEW 2010). I don't know enough about all this to decide if it is a bug or not.

 

 

Download All
Message 2 of 8
(5,743 Views)

Top marks Altenbach - and so quick - you are a Knight of the 1st Order - thanks

Chris

0 Kudos
Message 3 of 8
(5,733 Views)

Here's a more generic solution, simply ignoring the upper octet.

 

 

Download All
0 Kudos
Message 4 of 8
(5,730 Views)

@altenbach wrote:

Your colors are not RGB, but 32 bit. White is defined as xFF000000 instead of x000000 and black is defined as 0xFFFFFFFF instead of 0xFFFFFF.

I don't know enough about all this to decide if it is a bug or not.

 

 


It is tricky since the fourth byte of the RGBQUAD struct is supposed to be 0.  Two places to assign blame here IMO, the program which generated this file should not have written 0xFF into that byte and LV should not put any value into that byte except for 0x00. 

 

If I were NI, I would change the Read BMP Header Info.vi to put a 0x00 into that spot instead of whatever happens to be read since it is such a simple change.  In the meantime use the workaround.  Next I would probably take a look at the program used to generate this particular BMP file since it seems to be straying from the specification.

Message 5 of 8
(5,696 Views)

Hi Darin,

The image was generated from the Brother SDK for creating labels on their range of Brother P-Touch Printers.

 

I will send them a gentle reminder that perhaps they should check their Export Image Method - thanks.

 

Chris

0 Kudos
Message 6 of 8
(5,686 Views)

Hey, I have a project, in which your program seem to be part of it, but the problem is that i want take a picture from a camera, and process it to a 1-bit matrix, in which white would represent light/low contrast colors and black dark/high contrast colors. I hope u can help me soon, any ideas are welcomed. 

0 Kudos
Message 7 of 8
(5,595 Views)

steinbergsteiger@gmail.com wrote:

Hey, I have a project, in which your program seem to be part of it, but the problem is that i want take a picture from a camera, and process it to a 1-bit matrix, in which white would represent light/low contrast colors and black dark/high contrast colors. I hope u can help me soon, any ideas are welcomed. 


This is a long thread already marked as solved. Which "program" is part of your project? Be more specific!

 

I think you should start a new thread with your new question.

0 Kudos
Message 8 of 8
(5,593 Views)