examing the .byr file

This forum is used for discussing hardware, software, and technical details of the AVRcam embedded system.

examing the .byr file

Postby Ringo » Tue Aug 15, 2006 12:19 pm

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
Ringo
 
Posts: 19
Joined: Thu Jun 23, 2005 9:48 am

Postby Bud » Tue Aug 22, 2006 8:59 pm

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
Bud
 
Posts: 9
Joined: Sun Dec 12, 2004 5:37 pm

Postby Ringo » Wed Aug 23, 2006 7:54 am

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
Ringo
 
Posts: 19
Joined: Thu Jun 23, 2005 9:48 am


Return to AVRcam Embedded System

Who is online

Users browsing this forum: No registered users and 14 guests

cron