capture bufffer structure

From: Reto Aebersold <aeber1_at_hti.bfh.ch>
Date: Mon 11 Apr 2005 - 19:06:16 CEST
Message-ID: <425AAE88.1080702@hti.bfh.ch>

Hi all,

I try to make a simple DMA transfer. I'm able to setup the camera and
grab a frame, but I don't know how to read correctly the RGB pixel
values from the capture buffer. How is the buffer organized? If I try to
write the image to a ppm file, I see the captured picture 4 times and
with incorrect colors.
How should I write the data correctly to the file? Below the code to
store the image to a file and my DMA setup.

Thanks a lot,
aeby

//DMA setup
int format = FORMAT_SVGA_NONCOMPRESSED_1;
int mode = MODE_800x600_RGB;
int frameRate = FRAMERATE_15;
dc1394_dma_setup_capture( raw1394Handle, cameraNodes[0], channel,
format, mode, speed, frameRate, 8, 1, device, &dc1394Camera );

// Write to file
fprintf(imagefile,"P6\n%u %u\n# %s\n255\n", dc1394Camera.frame_width,
dc1394Camera.frame_height, "Test image" );
for ( int i = 0; i < dc1394Camera.frame_height*dc1394Camera.frame_width;
i++) {
            unsigned char val = dc1394Camera.capture_buffer[i] >> 16;
            fwrite(&val, 1, 1, imagefile );
            val = dc1394Camera.capture_buffer[i] >> 8;
            fwrite(&val, 1, 1, imagefile );
            val = dc1394Camera.capture_buffer[i];
            fwrite(&val, 1, 1, imagefile );
}

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
mailing list Linux1394-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux1394-user
Received on Mon Apr 11 19:06:50 2005

This archive was generated by hypermail 2.1.8 : Mon 02 May 2005 - 09:16:53 CEST