Cv
view release on metacpan or search on metacpan
my $capture = Cv->CaptureFromCAM(0);
while (my $frame = $capture->QueryFrame) {
$frame->Flip(\0, 1)->ShowImage;
my $c = Cv->WaitKey(100);
last if $c >= 0;
}
=head1 DESCRIPTION
C<Cv> is the Perl interface to the OpenCV computer vision library that
originally developed by Intel. I'm making this module to use the
computer vision more easily like a slogan of perl I<"Easy things
should be easy, hard things should be possible.">
The features are as follows.
=cut
package Cv;
use 5.008008;
use strict;
use warnings;
use Carp;
use Scalar::Util;
use warnings::register;
our $VERSION = '0.29';
use Cv::Constant qw(:all);
require XSLoader;
XSLoader::load('Cv', $VERSION);
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = grep /^(IPL|CV|cv)/, (keys %Cv::);
our %EXPORT_TAGS = (
'all' => \@EXPORT_OK,
'std' => \@EXPORT_OK,
);
our @EXPORT = ( );
our %IMPORT;
our %O;
our %M;
BEGIN {
$IMPORT{$_} = 1 for qw(Histogram More Seq);
$IMPORT{$_} = 0 for qw(Qt BGCodeBookModel Subdiv2D);
$O{$_} = 1 for qw(boxhappy);
}
use Getopt::Long;
sub import {
my $self = shift;
local @ARGV = @_;
my %opt = (
(map { lc($_).'!' => \$IMPORT{$_} } keys %IMPORT),
(map { lc($_).'!' => \$O{$_} } keys %O),
);
unless (GetOptions(%opt)) {
die << "----";
Usage: use Cv @{[ map { "-".($IMPORT{$_}?"no":"").lc($_) } sort keys %IMPORT ]}
----
;
}
if (@ARGV) {
my @argv = ();
for (@ARGV) {
if (/^:no(\w+)$/) {
$IMPORT{lc $1} = 0;
} else {
push(@argv, $_);
}
}
@ARGV = @argv;
}
for (grep { $IMPORT{$_} } keys %IMPORT) {
eval "use Cv::$_";
die "can't use Cv::$_; $@" if $@;
}
push(@ARGV, ":std") unless @ARGV;
$self->export_to_level(1, $self, @ARGV);
}
sub DESTROY { }
sub CV_MAJOR_VERSION () { ${[ &CV_VERSION ]}[0] }
sub CV_MINOR_VERSION () { ${[ &CV_VERSION ]}[1] }
sub CV_SUBMINOR_VERSION () { ${[ &CV_VERSION ]}[2] }
{ *Version = *version = sub { shift; goto &cvVersion } }
=over 4
=item *
C<Cv> was made along the online reference manual of C in the OpenCV
documentation. For details, please refer to the
http://opencv.willowgarage.com/.
=item *
You can use C<CreateSomething()> as a constructors.
my $img = Cv->CreateImage([ 320, 240 ], IPL_DEPTH_8U, 3);
my $mat = Cv->CreateMat([ 240, 320 ], CV_8UC3);
=item *
You can also use C<new> as a constructor. C<Cv::Image-E<gt>new> is
C<Cv-E<gt>CreateImage()>, C<Cv::Mat-E<gt>new> is
C<Cv-E<gt>CreateMat()>. In the calling parameters, there are some
difference in CreateImage() and CreateMat(). But there are no
difference in C<Cv::Something-E<gt>new>. This is because we create
( run in 1.192 second using v1.01-cache-2.11-cpan-e93a5daba3e )