[cpia] Capture problems.

David Irvine co2cool@yahoo.com
09 Jan 2002 02:08:25 +0000


Hello.

I'm currently writing an application which captures  a still image from
a cpia camera, I'm using the zoom cam usb model.

Its a perl script and the core of the image grabbing is as follows:


 use Video::Capture::V4l;
 use PDL;
 use PDL::IO::Pnm;

 my $grab = new Video::Capture::V4l "/dev/video1"
     or die "Unable to open video device: $!";  

#connects to the video device 

        my $frame = $grab->capture(0, 640, 480); #attempts to capture a
frame
        $grab->sync(0); #waits until the frame has been captured
 my $img = zeroes byte, 3, 640, 480; #create an image object
    ${$img->get_dataref} = $fr; $img->upd_data(); #insert the raw data
to the image
    $img = $img->slice("2:0,:,-1:0"); #rotate the bytes in the image
from bgr to rgb
    wpnm $img, 'frame.ppm', 'PPM', 1; #write the file to disk

Now the code executes properly but when i look at the file, in the gimp
(or any other viewer) it is basically snow. A number of webcam software
programs also do this. Do i need to set something on  the camera before
this will work properly?

Any advice appreciated


David