We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Pulling a 16bit pixel value from a camera
Page Index Toggle Pages: 1
Pulling a 16bit pixel value from a camera (Read 310 times)
Pulling a 16bit pixel value from a camera
Mar 5th, 2009, 11:40am
 
Hi

Lucky me got my hands on a BumbleBee stereo camera from Point Grey.

Quote from the tech manual:
"The Bumblebee2 can be configured to output images from both sensors at the same time as pixel (byte)
interleaved stereo pairs using Format_7. Pixel interleaved images use a raw 16bit/pixel format, where the
first byte is from the left camera and the second from the right. "

In C I would pull the data into a char and shift it to split the two pictures from each other. But using the Capture class to get the feed from the camera changes the rules a bit. Also it seems a char in processing is not just a dec value but more a character value.

Ok so I tried this:
void draw()
{
 if (lCam.available()) {
   lCam.read();
   lCam.loadPixels();
   rFrame = new PImage(640, 480, RGB);
   lFrame = new PImage(640, 480, RGB);
   rFrame.loadPixels();
   lFrame.loadPixels();    
   
   for(int i = 0; i < lCam.pixels.length; i++)
   {
     int fs = lCam.pixels[i] >> 16;
     int lc = fs & 0x0000FFFF;
     lFrame.pixels[i] = lc;
     int sf = lCam.pixels[i] << 16;
     int rc = sf >> 16;
     rFrame.pixels[i] = rc;      
   }
   rFrame.updatePixels();
   lFrame.updatePixels();    
   image(lFrame, 0, 0);
   image(rFrame, 640, 0);
 }
}

Which gives me an Andy Warhol looking effect, displaying to equal pictures, but with the colors being fragments from the original picture.
The color type, which is returned from the pixels[i] I can not quite get my head around.
If I only just display the feed coming from the camera I get the image from the left camera. I think the data from both pictures is there, but it gets lost in conversions(translation..) done inside the Capture class.

Hope someone can shed a little light on this:)
Cheers
Page Index Toggle Pages: 1