Dennis K. Paulsen > Image-SubImageFind-0.03 > Image::SubImageFind

Download:
Image-SubImageFind-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.03   Source  

NAME ^

Image::SubImageFind - Perl extension for locating a sub-image within an image

SYNOPSIS ^

  use Image::SubImageFind qw/FindSubImage/;

  #  First parameter is the larger image file (HayStack)
  #  Second parameter is the sub-image file to locate within the larger image (Needle)
  my ($x, $y) = FindSubImage("./haystackfile.png", "./needlefile.jpg");
  if ($x > 0 || $y > 0) {
      print "Found sub-image at: $x X $y\n";
  } else {
      print "Could not find sub-image.\n";
  }

  #  Alternatively, you can use the emerging object oriented syntax.
  my $finder = new Image::SubImageFind("./haystackfile.png", "./needlefile.png");
  my ($x, $y) = $finder->GetCoordinates();
  print "$x X $yn";

  #  Another example; which may allow for more flexibility.
  my $finder = new Image::SubImageFind("./haystackfile.png");
  my ($x, $y) = $finder->GetCoordinates("./needlefile.png");
  print "$x X $yn";

  #  You can also specify an alternate comparison method.  The default is DWVB; which
  #  uses an adaptive filter for the correct localization of subimages.  
  #
  #  Another is called GPC; which is just a generic pixel compare, but also supports a
  #  delta threshold (using GetMaxDelta and SetMaxDelta).
  use Image::SubImageFind qw/:CONST/;

  my $finder = new Image::SubImageFind("./haystackfile.png", "./needlefile.png", CM_DWVB);
  # OR
  my $finder = new Image::SubImageFind("./haystackfile.png", "./needlefile.png", CM_GPC);
  # $finder->GetMaxDelta();
  # $finder->SetMaxDelta([DeltaValue]);   # 0 or greater, where 0 means no pixel difference

DESCRIPTION ^

Perl module to aide in locating a sub-image within an image.

EXPORT

None by default.

SEE ALSO ^

One of the underlying algorithms and originating code by Dr. Werner Van Belle (http://werner.yellowcouch.org/Papers/subimg/index.html)

AUTHOR ^

Dennis K. Paulsen, <ctrondlp@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2010-2011 by Dennis K. Paulsen

Other portions are copyright their respective owners.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

syntax highlighting: