Cv
view release on metacpan or search on metacpan
sample/demhist.pl view on Meta::CPAN
my $contrast = 100;
Cv->NamedWindow("image");
Cv->CreateTrackbar("brightness", "image", $brightness, 200, \&update_brightcont);
Cv->CreateTrackbar("contrast", "image", $contrast, 200, \&update_brightcont);
Cv->NamedWindow("histogram");
&update_brightcont;
Cv->WaitKey;
# brightness/contrast callback function
sub update_brightcont {
my $brightness = $brightness - 100;
my $contrast = $contrast - 100;
# The algorithm is by Werner D. Streidt
# (http://visca.com/ffactory/archives/5-99/msg00021.html)
my ($a, $b);
if ($contrast > 0) {
my $delta = 127 * $contrast / 100;
$a = 255 / (255 - $delta*2);
$b = $a * ($brightness - $delta);
sample/motempl.pl view on Meta::CPAN
# temporary images
my $mhi; # MHI
my $orient; # orientation
my $mask; # valid orientation mask
my $segmask; # motion segmentation map
my $storage; # temporary storage
# parameters:
# img - input video frame
# dst - resultant motion picture
sub update_mhi {
my ($img, $dst) = @_;
unless ($start) {
$start = gettimeofday;
}
my $timestamp = gettimeofday - $start; # get current time in seconds
my $size = cvSize($img->width, $img->height); # get current frame size
my $gray = $img->CvtColor(CV_BGR2GRAY); # convert frame to grayscale
unless ($lastgray) {
$lastgray = $gray;
( run in 0.260 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )