This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LightCommander

Other Parts Discussed in Thread: DLPC200

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?

    Regards,

    Fritz

     

  • Hi Fritz,

    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.)


    Regards,

    Sanjeev

     

  • Hi Sanjeev,

    I suspect that my conversion is wrong. My source is a *.bmp image. How can I convert this to a' LigthCommander format'?

    Regards,

    Fritz

  • Hi Fritz,

    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

    Read 8 bytes: 0x00 0xFF 0x00 0xFF 0xFF 0x00 0x00 0xFF

    Translated bye:  1-0-0-1-1-0-1-0 (the order is reversed because MSB at the last) = 0x9A

     

    STEP 4) The file size after conversion reduced to 786432/8 = 98304 bytes or 96KB.
    STEP 5) Now, the newly generated binary file can be directly used  in DLP_Img_DownloadBitplanePatternToExtMem API to download to the external memory for display.
    Let me know if you are still facing issues or not clear on the above.

     

    Regards,

    Sanjeev

     

  • 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

     

    Regards,

    Sanjeev

     

  • 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!

  • Sanjeev,

    Sorry to dig up this old thread... I hope this will be a simple question though -- When I use DLP_Img_DownloadBitplanePatternToExtMem to load a sequence of patterns into the memory, how will they be ordered? For example, if I call DLP_Img_DownloadBitplanePatternToExtMem 8 times, will the patterns be automatically indexed 0-7?

    In that regard, should I use destroyBitPlanes to clean up the memory before I upload my patterns?

    Thanks,


    Regards, Bing

  • I read some old posts. It seems that bpnum0b is the index?

    Thanks.
  • Hello Bing,

    bpnum0b - yes it is bitplane index in the memory

    destroyBitPlanes - this operation is done in the PC side, the old LightCommander control software GUI has option to select the images and upload, the images uploaded in the GUI are basically in bmp file format, which later decoded and converted into the proper image format for sending to the hardware, so one of the utility of function in the decode bmp file and ordering is destroyBitPlanes which basically clears out images or clears out memory allocated on the PC for storing decoded bmp image files.

    Regards,
    Sanjeev

  • Sanjeev,

    Thanks a lot! I have a couple more questions which maybe a bit off topic from this thread, so if you feel like moving to a different thread please feel free to do so...

    These are mainly with regard to how to speed up downloading patterns to lightcommander box, I am in the same boat as several other folks posted on this topic -- I have many thousands patterns to cycle through within a short period time and can't store them in the memory.

    First option was to split up patterns into different blocks -- updating block 2 while lightcommander is cycling through patterns in block 1... But in this mode, I assume the USB link will be occupied by downloading (slow process) till it is finished?

    Second option is to use DVI. I wonder if you had experience with feeding binary patterns in structure light mode? If so, could you please lay out some detail how you did it from logistic perspective:

    - What I did was to generate an uncompressived AVi file in matlab, packing the patterns in R 0-7, G 0-7, B 0-7 order, will that work?

    - Did you set up lightcommander as second display and play the video via windows media player? Does the video frame rate needs to be 60Hz? I assume the lightcommander will automatically assign equal exposure time to each binary bit plane?

    - Another aspect of my set up is for the lightcommander to generate an external trigger to trigger data acquisition. Using DVI input, were you still able to generate triggers associated with each pattern/bitplane? 

    Thanks again

  • Hi Bing,

    First option was to split up patterns into different blocks -- updating block 2 while lightcommander is cycling through patterns in block 1... But in this mode, I assume the USB link will be occupied by downloading (slow process) till it is finished?

    [Sanjeev] Although USB link is busy downloading the content, it will not affect the current display as defined in the Pattern Order display LUT, example, say there are two lots 0, N and N+1 to M, so while DLPC200 busy displaying pattern from N+1 to M lot, you can download the contents for patterns in 0 to N. The only problem is that you have to really manage the display time and download times. The real bottleneck here is the USB download time. 

    Second option is to use DVI. I wonder if you had experience with feeding binary patterns in structure light mode? If so, could you please lay out some detail how you did it from logistic perspective:

    - What I did was to generate an uncompressived AVi file in matlab, packing the patterns in R 0-7, G 0-7, B 0-7 order, will that work?

    [Sanjeev] Certainly it would work, the key is your video playback or frame rate exactly matches to the what is being set in the DLPC200, the configuration allows loading and displayed patterns with incoming source rate from 6Hz to 60Hz. 

    - Did you set up lightcommander as second display and play the video via windows media player? Does the video frame rate needs to be 60Hz? I assume the lightcommander will automatically assign equal exposure time to each binary bit plane?

    [Sanjeev] We haven't directly used video output from the video player, but as long as you are ensuring the video o/p from the PC is 60Hz frame rate it should just work fine. Yes, LightCommander would assign equal exposure time for each binary bit plane. Another caution, disable all the auto brightness, contrast, gamma etc settings in the video graphics card; you may think PC is writing data correctly but DLPC200 not displaying properly, the video settings adjustments many times modify the actual pixel data getting into the LightCommander.

    - Another aspect of my set up is for the lightcommander to generate an external trigger to trigger data acquisition. Using DVI input, were you still able to generate triggers associated with each pattern/bitplane? 

    [Sanjeev] Yes, you will get 24 trigger out pulses per every frame write. 

    Let us know if anything we can help you.

    Regards,
    Sanjeev

  • Sanjeev, thanks again for your help! I am going to try USB link for now. just because it is comparatively easier to implement.

    I suspect I will have to use DVI later on, but it is just a bit different to debug...