Page 1 of 1

examing the .byr file

PostPosted: Tue Aug 15, 2006 12:19 pm
by Ringo
If I open a .byr file with a hex editor, what is the format of the file? I see in frameMgr.c that a header byte is sent and line numbers are sent, but I don't think they are stored in the byr file. I have a file that was captured with a red filter on the camera. The file looks like:
ff 00 10 00 ff 00 00 10 ff 00 10 00 ff
is that R G B G R G B G .... ? or is there other stuff in there as well?
Thanks
Ringo

PostPosted: Tue Aug 22, 2006 8:59 pm
by Bud
Hi Ringo,
The format of the byr file can be found in the avr/swing/JCapturePanel.java file. The format consists of a 4 byte color. The 4 bytes represent the Alpha Component, Red, Green, and Blue values of a color. The first four bytes in the file represents the pixel at x = 0, y = 0 in the image. The next four bytes represent the pixel at x = 0, y = 1 in the image. The image is 144 pixels high by 176 pixels wide. The following code segment is the Java code that creates the byr file:

Code: Select all
      ByteBuffer[] buffers = new ByteBuffer[bayerImage.getWidth()];

      for(int x = 0; x < buffers.length; x++) {
         buffers[x] = ByteBuffer.allocate(bayerImage.getHeight() * 4);
         for(int y = 0; y < bayerImage.getHeight(); y++) {
            buffers[x].putInt(bayerImage.getRGB(x, y));
         }
         buffers[x].flip();
      }


To parse the byr file, I took advantage of how the Java New IO package reads files:

Code: Select all
      ByteBuffer[] buffers = new ByteBuffer[bayerImage.getWidth()];

      for(int x = 0; x < buffers.length; x++) {
         buffers[x] = ByteBuffer.allocate(bayerImage.getHeight() * 4);
      }

      inChannel.read(buffers);



If you have any more questions please let me know.

-- Bud

PostPosted: Wed Aug 23, 2006 7:54 am
by Ringo
I have never touched JAVA, so I did not even try to look at that source code. What is the Alpha Channel? Do you have a link that explains it? I guess the answer I need though is that the byr file is not what the camera spits out, it has been manipulated and then saved. Is there a way to save the direct output of the camera during a frame dump?
Thanks
Ringo