Hello all,
this is my first post so please let me know in case I chose the wrong forum...
I am trying to write an application framework which communicated with the C900 chip on a EVM6500 in matlab. All basic functionalities are implemented and I will publish the code later this year on github in case any body is interested... However, I am still struggling with the most important part of sending data to the DLP.
The context of the application is like follows: By means of the DLP I project a certain pattern on a target. A camera records the pattern, which will be then compared to a reference pattern. A correction is calculated by matlab which then is fed to the DLP. This loop continues until a certain confidence bound has been reached.
The projected patterns are all 1bit patterns and the application is time critical. Thus in a further development step I will of course use Enhanced RLE for compression of the data being transmitted.
My question for now is: how can I generate the desired bitmap data for the 1bit image. My understanding is, that I have to pack the 1bit data in a 24bit stack. When trying to do this, I end up with the DLP showing the desired bitmap three times side by side while the remaining area of the DLP is just blank.
Does this point to a problem with the header information in the bitmap even though I rather suspect the data itself to not meet the required needs.
The matlab code I use for creating the data from a n*m matrix named BMP looks like follows:
function data = prepBMP(BMP) %prepBMP Adds a header to the matrix BMP % bitDepth = 1; % define bit depth. FIXME: make a parameter signature = ['53'; '70'; '6C'; '64']; % add required header imageWidth = dec2hex(typecast(uint16(size(BMP,2)),'uint8')); % set image width imageHeight = dec2hex(typecast(uint16(size(BMP,1)),'uint8')); % set image height numOfBytes = dec2hex(typecast(uint32(size(BMP,1)*size(BMP,2)*... bitDepth),'uint8')); % set number of bytes in the image backgroundColor = ['00'; '00'; '00'; '00']; % define background color compression = '00'; % no compression. FIXME: add compression header = [signature; imageWidth; imageHeight; numOfBytes; ... 'FF'; 'FF'; 'FF'; 'FF'; 'FF'; 'FF'; 'FF'; 'FF'; backgroundColor; ... '00'; compression; '01'; '00'; '00'; '00'; '00'; '00'; '00'; '00';... '00'; '00'; '00'; '00'; '00'; '00'; '00'; '00'; '00'; '00'; '00';... '00'; '00'; '00']; % combine full header BMP = BMP'; % transpose in order to meet the bitmap indexing requirements BMP3c = [BMP(:), zeros(size(BMP(:),1),2)]; % add two more colors in order to build the full 24 bit bitmap data = [header; dec2hex(BMP3c(:),2);]; % combine header and data data = dec2bin(hex2dec(data),8); % convert to binary form and return end
I guess the only thing I would need in order to understand the structure of the bitmap data would be a bitwise example representation of a 2 by 2 pixel bitmap with 1bit colordepth where the upper left and the lower right pixel is black while the other ones are white. Could anybody help me out with that?
Thank you very much in advance.
Best regards
Klaus Hueck