in reply to Re: Re: capturing raw video with v4l
in thread capturing raw video with v4l
Pass the code $nfr and the returned value can be written to file in place of $nfr.sub convert_to_rgb { my $bgr = shift; my $bgrLen = length($bgr); #Unpacking the BGR data gives use easy access to individual bytes. my @bgrArray = unpack("C$bgrLen",$bgr); my @rgbArray; my $ct=0; while ($ct < $bgrLen) { $rgbArray[$ct] = $bgrArray[$ct+2]; $rgbArray[$ct+1] = $bgrArray[$ct+1]; $rgbArray[$ct+2] = $bgrArray[$ct]; $ct+=3; } #Pack the data to match the input format. my $rgb = pack("C$bgrLen",@rgbArray); return $rgb; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: capturing raw video with v4l
by zentara (Cardinal) on Feb 18, 2004 at 16:15 UTC |