| Image-ObjectDetect documentation | Contained in the Image-ObjectDetect distribution. |
Image::ObjectDetect - detects objects from picture(using opencv)
use Image::ObjectDetect;
my $cascade = 'haarcascade_frontalface_alt2.xml';
my $file = 'picture.jpg';
my $detector = Image::ObjectDetect->new($cascade);
@faces = $detector->detect($file);
for my $face (@faces) {
print $face->{x}, "\n";
print $face->{y}, "\n";
print $face->{width}, "\n";
print $face->{height}, "\n";
}
# or just like this
my @faces = detect_objects($cascade, $file);
Image::ObjectDetect is a simple module to detect objects from picture using opencv.
It is available at: http://sourceforge.net/projects/opencvlibrary/
Returns an instance of this module.
Detects objects from picture.
Detects objects from picture.
detect_objects
Jiro Nishiguchi <jiro@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Image-ObjectDetect documentation | Contained in the Image-ObjectDetect distribution. |
package Image::ObjectDetect; use strict; use warnings; use vars qw($VERSION @ISA @EXPORT); BEGIN { $VERSION = '0.12'; if ($] > 5.006) { require XSLoader; XSLoader::load(__PACKAGE__, $VERSION); } else { require DynaLoader; @ISA = qw(DynaLoader); __PACKAGE__->bootstrap; } require Exporter; push @ISA, 'Exporter'; @EXPORT = qw(detect_objects); } sub detect { my ($self, $file) = @_; my $ret = $self->xs_detect($file); wantarray ? @$ret : $ret; } sub detect_objects { __PACKAGE__->new($_[0])->detect($_[1]); } 1; __END__