How can i convert a *.bmp image to *.dbi? Is there an external tool or a SW example available?
Thaks for any help,
Fritz
Hi Fritz,
Welcome to DLP&MEMS forum.
The DLP LightCommander(TM) Control GUI has inbuilt functionality of generating .dbi out of .bmp file. There is NO external tool available for the same. Can you let me know what exactly you are trying to do with this utility?
FYI, there is another API available for which you don't need to convert the .bmp to .dbi file to download it to external memory the API name is "DLP_Img_DownloadBitplanePatternToExtMem" please see the API documentation for more details.
Regards,
Sanjeev
Hi Sanjeev,
Thank you for the answer.
I try to send images to the LightCommander. The images are in the *.raw format. My development environment is Visual Studio C#. The LightCommander API is working.
Is there an example available?
You have mentioned that the LightCommander API is working. Now, I am not clear on the API example you are looking.. Can you be more clear on this?
For the API DLP_Img_DownloadBitplanePatternToExtMem API the documentation is already provided; copying the same below
For this API to be used, the input image data must first be formatted properly, which involves 2 steps:
1. Split out each bit plane individually
2. pack 8 pixels into each byte (e.g. pixel#0 maps to LSB, pixel#1 maps to LSB+1, etc.)
I suspect that my conversion is wrong. My source is a *.bmp image. How can I convert this to a' LigthCommander format'?
You can follow below method to get it in LightCommander format. This explanation is applicable for DLP_Img_DownloadBitplanePatternToExtMem API . Care must be taken that the file BMP size is 1024*768 pixels.
You could use any freely available tools (For example IrfanView) to convert the BMP file to RAW 1bpp gray scale format; which I think this you are doing already. So, after the conversion the generated RAW file size becomes 1024*768 = 786432 bytes. To make sure the file conversion is successful you can open it in any binary hex editor see there will be only 0xFF or 0x00 entries. As you can see here in the RAW file a pixel is represented as a byte but for LightCommander it expects a byte to contain the information of 8 pixels. For this you can write small script or program to do the following:
STEP 1) Open the RAW file
STEP 2) Read 8 bytes at a time from the beginning till end.
STEP 3) Now these 8 bytes should be converted into 1byte i.e., every 1byte (of 8bytes) translates into 1bit of a byte. For this order to be followed will be LSB byte (of 8byte) map to LSbit of a byte. That is you must understand when 8bytes are read from the file the MSB byte is at the start or at the end of the 8 byte array (see explanation CASE 1 and CASE2 below)
How to decide the whether bit is '1' or '0'? It is simple, if the byte = 0xFF the bit = '1' and if byte = 0x00 the bit = '0'.
For example - Let us assume the read 8 bytes string to be "0x00 0xFF 0x00 0xFF 0xFF 0x00 0x00 0xFF"
CASE 1: If the MSB byte is the "first" in the array of 8 bytes
Read 8 bytes: 0x00 0xFF 0x00 0xFF 0xFF 0x00 0x00 0xFF
Translated bye: 0-1-0-1-1-0-0-1 = 0x59
CASE 2: If the MSB byte is the "last" in the array of 8 bytes
Translated bye: 1-0-0-1-1-0-1-0 (the order is reversed because MSB at the last) = 0x9A
Is this only for 1bpp images? I would like to project 8bpp images...would this API accompany that?
If so, how would I do it?
Thank you,
Yuma
Hi Yuma,
The API helps you to download individual 1bpp image.
If you want to download 8bpp image you will need to call the API 8 times. Before that you would require to split 8bpp image into 8 1bpp images.
Splitting procedure for 8bpp image -
1) As 8bpp means 8bits to represent a pixel; copy ALL pixel's bit0 to into 1 file similarly repeat the procedure for bi1,bit2,...,bit7.
2) At the end of the exercise you will have 8 individual files.
3) For each file as explained above pack them into bytes. Each file size would reduce to 1/8 from it's previous size.
4) Call the API repeatedly 8 times to download into external memory. Make sure the call order is maintained. bit0-file, bit1-file,....,bit7-file
Dear Fritz,
did you succeed in doing this?
If so, could you please provide me some code? I'm really in a struggle to put this to work with LabVIEW...
Any help would be greatly appreciated.
Thank you very much in advance!