PDL-OpenCV

 view release on metacpan or  search on metacpan

GENERATED/PDL/OpenCV/Objdetect.pm  view on Meta::CPAN


Loads a classifier from a file.

=for example

 $obj = PDL::OpenCV::CascadeClassifier->new2($filename);

Parameters:

=over

=item filename

Name of the file from which the classifier is loaded.

=back


=cut
#line 183 "Objdetect.pm"



#line 274 "../genpp.pl"

=head2 empty

=for ref

Checks whether the classifier has been loaded.

=for example

 $res = $obj->empty;


=cut
#line 201 "Objdetect.pm"



#line 274 "../genpp.pl"

=head2 load

=for ref

Loads a classifier from a file.

=for example

 $res = $obj->load($filename);

Parameters:

=over

=item filename

Name of the file from which the classifier is loaded. The file may contain an old
    HAAR classifier trained by the haartraining application or a new cascade classifier trained by the
    traincascade application.

=back


=cut
#line 231 "Objdetect.pm"



#line 274 "../genpp.pl"

=head2 read

=for ref

Reads a classifier from a FileStorage node.

=for example

 $res = $obj->read($node);

@note The file may contain a new cascade classifier (trained traincascade application) only.

=cut
#line 250 "Objdetect.pm"



#line 958 "/home/osboxes/.perlbrew/libs/perl-5.32.0@normal/lib/perl5/x86_64-linux/PDL/PP.pm"



=head2 CascadeClassifier_detectMultiScale

=for sig

  Signature: ([phys] image(l2,c2,r2); indx [o,phys] objects(n3=4,n3d0); double [phys] scaleFactor(); int [phys] minNeighbors(); int [phys] flags(); indx [phys] minSize(n7); indx [phys] maxSize(n8); CascadeClassifierWrapper * self)

=for ref

Detects objects of different sizes in the input image. The detected objects are returned as a list
    of rectangles. NO BROADCASTING.

=for example

 $objects = $obj->detectMultiScale($image); # with defaults
 $objects = $obj->detectMultiScale($image,$scaleFactor,$minNeighbors,$flags,$minSize,$maxSize);

The function is parallelized with the TBB library.
@note
-   (Python) A face detection example using cascade classifiers can be found at
opencv_source_code/samples/python/facedetect.py

Parameters:

=over

=item image

Matrix of the type CV_8U containing an image where objects are detected.

=item objects

Vector of rectangles where each rectangle contains the detected object, the
    rectangles may be partially outside the original image.

=item scaleFactor

Parameter specifying how much the image size is reduced at each image scale.

=item minNeighbors

Parameter specifying how many neighbors each candidate rectangle should have
    to retain it.

=item flags

Parameter with the same meaning for an old cascade as in the function
    cvHaarDetectObjects. It is not used for a new cascade.

=item minSize

Minimum possible object size. Objects smaller than that are ignored.

=item maxSize

Maximum possible object size. Objects larger than that are ignored. If `maxSize == minSize` model is evaluated on single scale.

=back


=for bad

CascadeClassifier_detectMultiScale ignores the bad-value flag of the input ndarrays.
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.


=cut
#line 324 "Objdetect.pm"



#line 959 "/home/osboxes/.perlbrew/libs/perl-5.32.0@normal/lib/perl5/x86_64-linux/PDL/PP.pm"

sub PDL::OpenCV::CascadeClassifier::detectMultiScale {
  barf "Usage: PDL::OpenCV::CascadeClassifier::detectMultiScale(\$self,\$image,\$scaleFactor,\$minNeighbors,\$flags,\$minSize,\$maxSize)\n" if @_ < 2;
  my ($self,$image,$scaleFactor,$minNeighbors,$flags,$minSize,$maxSize) = @_;
  my ($objects);
  $objects = PDL->null if !defined $objects;
  $scaleFactor = 1.1 if !defined $scaleFactor;
  $minNeighbors = 3 if !defined $minNeighbors;
  $flags = 0 if !defined $flags;
  $minSize = empty(indx) if !defined $minSize;
  $maxSize = empty(indx) if !defined $maxSize;
  PDL::OpenCV::CascadeClassifier::_CascadeClassifier_detectMultiScale_int($image,$objects,$scaleFactor,$minNeighbors,$flags,$minSize,$maxSize,$self);
  !wantarray ? $objects : ($objects)
}
#line 343 "Objdetect.pm"



#line 960 "/home/osboxes/.perlbrew/libs/perl-5.32.0@normal/lib/perl5/x86_64-linux/PDL/PP.pm"
#line 348 "Objdetect.pm"



#line 958 "/home/osboxes/.perlbrew/libs/perl-5.32.0@normal/lib/perl5/x86_64-linux/PDL/PP.pm"



=head2 CascadeClassifier_detectMultiScale2

=for sig

  Signature: ([phys] image(l2,c2,r2); indx [o,phys] objects(n3=4,n3d0); int [o,phys] numDetections(n4d0); double [phys] scaleFactor(); int [phys] minNeighbors(); int [phys] flags(); indx [phys] minSize(n8); indx [phys] maxSize(n9); CascadeClassifierW...

=for ref

 NO BROADCASTING.

=for example

 ($objects,$numDetections) = $obj->detectMultiScale2($image); # with defaults
 ($objects,$numDetections) = $obj->detectMultiScale2($image,$scaleFactor,$minNeighbors,$flags,$minSize,$maxSize);

@overload

Parameters:

=over

=item image

Matrix of the type CV_8U containing an image where objects are detected.

=item objects

Vector of rectangles where each rectangle contains the detected object, the
    rectangles may be partially outside the original image.

=item numDetections

Vector of detection numbers for the corresponding objects. An object's number
    of detections is the number of neighboring positively classified rectangles that were joined
    together to form the object.

=item scaleFactor

Parameter specifying how much the image size is reduced at each image scale.

=item minNeighbors

Parameter specifying how many neighbors each candidate rectangle should have
    to retain it.

=item flags

Parameter with the same meaning for an old cascade as in the function
    cvHaarDetectObjects. It is not used for a new cascade.

=item minSize

Minimum possible object size. Objects smaller than that are ignored.

=item maxSize

Maximum possible object size. Objects larger than that are ignored. If `maxSize == minSize` model is evaluated on single scale.

=back


=for bad

CascadeClassifier_detectMultiScale2 ignores the bad-value flag of the input ndarrays.
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.


=cut
#line 424 "Objdetect.pm"



#line 959 "/home/osboxes/.perlbrew/libs/perl-5.32.0@normal/lib/perl5/x86_64-linux/PDL/PP.pm"

sub PDL::OpenCV::CascadeClassifier::detectMultiScale2 {
  barf "Usage: PDL::OpenCV::CascadeClassifier::detectMultiScale2(\$self,\$image,\$scaleFactor,\$minNeighbors,\$flags,\$minSize,\$maxSize)\n" if @_ < 2;
  my ($self,$image,$scaleFactor,$minNeighbors,$flags,$minSize,$maxSize) = @_;
  my ($objects,$numDetections);
  $objects = PDL->null if !defined $objects;
  $numDetections = PDL->null if !defined $numDetections;
  $scaleFactor = 1.1 if !defined $scaleFactor;
  $minNeighbors = 3 if !defined $minNeighbors;
  $flags = 0 if !defined $flags;
  $minSize = empty(indx) if !defined $minSize;
  $maxSize = empty(indx) if !defined $maxSize;
  PDL::OpenCV::CascadeClassifier::_CascadeClassifier_detectMultiScale2_int($image,$objects,$numDetections,$scaleFactor,$minNeighbors,$flags,$minSize,$maxSize,$self);
  !wantarray ? $numDetections : ($objects,$numDetections)
}
#line 444 "Objdetect.pm"



#line 960 "/home/osboxes/.perlbrew/libs/perl-5.32.0@normal/lib/perl5/x86_64-linux/PDL/PP.pm"
#line 449 "Objdetect.pm"



#line 958 "/home/osboxes/.perlbrew/libs/perl-5.32.0@normal/lib/perl5/x86_64-linux/PDL/PP.pm"



=head2 CascadeClassifier_detectMultiScale3

=for sig

  Signature: ([phys] image(l2,c2,r2); indx [o,phys] objects(n3=4,n3d0); int [o,phys] rejectLevels(n4d0); double [o,phys] levelWeights(n5d0); double [phys] scaleFactor(); int [phys] minNeighbors(); int [phys] flags(); indx [phys] minSize(n9); indx [ph...

=for ref

GENERATED/PDL/OpenCV/Objdetect.pm  view on Meta::CPAN


=for example

 $res = $obj->getOriginalWindowSize;


=for bad

CascadeClassifier_getOriginalWindowSize ignores the bad-value flag of the input ndarrays.
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.


=cut
#line 566 "Objdetect.pm"



#line 959 "/home/osboxes/.perlbrew/libs/perl-5.32.0@normal/lib/perl5/x86_64-linux/PDL/PP.pm"

sub PDL::OpenCV::CascadeClassifier::getOriginalWindowSize {
  barf "Usage: PDL::OpenCV::CascadeClassifier::getOriginalWindowSize(\$self)\n" if @_ < 1;
  my ($self) = @_;
  my ($res);
  $res = PDL->null if !defined $res;
  PDL::OpenCV::CascadeClassifier::_CascadeClassifier_getOriginalWindowSize_int($res,$self);
  !wantarray ? $res : ($res)
}
#line 580 "Objdetect.pm"



#line 960 "/home/osboxes/.perlbrew/libs/perl-5.32.0@normal/lib/perl5/x86_64-linux/PDL/PP.pm"
#line 585 "Objdetect.pm"



#line 274 "../genpp.pl"

=head2 getFeatureType

=for ref

=for example

 $res = $obj->getFeatureType;


=cut
#line 601 "Objdetect.pm"



#line 274 "../genpp.pl"

=head2 convert

=for ref

=for example

 $res = PDL::OpenCV::CascadeClassifier::convert($oldcascade,$newcascade);


=cut
#line 617 "Objdetect.pm"



#line 394 "../genpp.pl"

=head1 METHODS for PDL::OpenCV::HOGDescriptor


=for ref

Implementation of HOG (Histogram of Oriented Gradients) descriptor and object detector.

the HOG descriptor algorithm introduced by Navneet Dalal and Bill Triggs @cite Dalal2005 .
useful links:
https://hal.inria.fr/inria-00548512/document/
https://en.wikipedia.org/wiki/Histogram_of_oriented_gradients
https://software.intel.com/en-us/ipp-dev-reference-histogram-of-oriented-gradients-hog-descriptor
http://www.learnopencv.com/histogram-of-oriented-gradients
http://www.learnopencv.com/handwritten-digits-classification-an-opencv-c-python-tutorial


=cut

@PDL::OpenCV::HOGDescriptor::ISA = qw();
#line 642 "Objdetect.pm"



#line 274 "../genpp.pl"

=head2 new

=for ref

Creates the HOG descriptor and detector with default params.

=for example

 $obj = PDL::OpenCV::HOGDescriptor->new;

aqual to HOGDescriptor(Size(64,128), Size(16,16), Size(8,8), Size(8,8), 9 )

=cut
#line 661 "Objdetect.pm"



#line 958 "/home/osboxes/.perlbrew/libs/perl-5.32.0@normal/lib/perl5/x86_64-linux/PDL/PP.pm"



=head2 HOGDescriptor_new2

=for sig

  Signature: (indx [phys] _winSize(n2=2); indx [phys] _blockSize(n3=2); indx [phys] _blockStride(n4=2); indx [phys] _cellSize(n5=2); int [phys] _nbins(); int [phys] _derivAperture(); double [phys] _winSigma(); int [phys] _histogramNormType(); double ...



( run in 1.175 second using v1.01-cache-2.11-cpan-39bf76dae61 )