zentara has asked for the wisdom of the Perl Monks concerning the following question:
Now for the perl question. The code below seems to capture raw frames, can anyone point me in the right direction on how to save them as pnm or jpg? The doc in the VideoCapture module are not too clear to me.
#!/usr/bin/perl use Video::Capture::V4l; sub print_picture { my $c=shift; print "Picture Settings: "; print "brightness ",$c->brightness; print ", hue ",$c->hue; print ", colour ",$c->colour; print ", contrast ",$c->contrast; print ", whiteness ",$c->whiteness; print ", depth ",$c->depth; print ", palette ",$c->palette; print "\n"; } $grab = new Video::Capture::V4l or die "Unable to open Videodevice: $!"; print_picture $grab->picture; $|=1; my $frame=0; my $fr=$grab->capture ($frame, 640, 480); my $count=0; for(1..2) { my $nfr = $grab->capture (1-$frame, 640, 480); $grab->sync($frame) or die "unable to sync"; # save $fr now, as it contains the raw BGR data open (JP,">z$count.raw") or die $!; print JP $nfr; close JP; print "."; $count++; $frame = 1-$frame; $fr = $nfr; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: capturing raw video with v4l
by Mr. Muskrat (Canon) on Jul 03, 2003 at 16:13 UTC | |
by zentara (Cardinal) on Jul 04, 2003 at 21:00 UTC | |
by BobbyVector (Monk) on Feb 18, 2004 at 16:08 UTC | |
by zentara (Cardinal) on Feb 18, 2004 at 16:15 UTC |