Added subImageSearch.

This commit is contained in:
dirk
2014-02-01 10:31:32 +00:00
parent c17edf220b
commit c20fa63e4b
5 changed files with 52 additions and 5 deletions
+18 -5
View File
@@ -203,8 +203,8 @@ const Magick::Geometry& Magick::Geometry::operator=(
y = 0;
size_t
height=0,
width=0;
height_val=0,
width_val=0;
// If argument does not start with digit, presume that it is a
// page-size specification that needs to be converted to an
@@ -221,7 +221,7 @@ const Magick::Geometry& Magick::Geometry::operator=(
}
}
flags=GetGeometry(geom,&x,&y,&width,&height);
flags=GetGeometry(geom,&x,&y,&width_val,&height_val);
if (flags == NoValue)
{
@@ -233,13 +233,13 @@ const Magick::Geometry& Magick::Geometry::operator=(
if ((flags & WidthValue) != 0)
{
_width=width;
_width=width_val;
isValid(true);
}
if ((flags & HeightValue) != 0)
{
_height=height;
_height=height_val;
isValid(true);
}
@@ -363,6 +363,19 @@ Magick::Geometry::Geometry(const MagickCore::RectangleInfo &rectangle_)
{
}
const Magick::Geometry& Magick::Geometry::operator=(
const MagickCore::RectangleInfo &rectangle_)
{
_width=static_cast<size_t>(rectangle_.width),
_height=static_cast<size_t>(rectangle_.height),
_xOff=static_cast<ssize_t>(rectangle_.x),
_yOff=static_cast<ssize_t>(rectangle_.y),
_xNegative=rectangle_.x < 0 ? true : false,
_yNegative=rectangle_.y < 0 ? true : false,
_isValid=true;
return(*this);
}
Magick::Geometry::operator MagickCore::RectangleInfo() const
{
RectangleInfo rectangle;
+22
View File
@@ -4194,6 +4194,28 @@ void Magick::Image::strip(void)
ThrowPPException;
}
Magick::Image Magick::Image::subImageSearch(const Image &reference_,
const MetricType metric_,Geometry *offset_,double *similarityMetric_,
const double similarityThreshold)
{
MagickCore::Image
*newImage;
RectangleInfo
offset;
GetPPException;
newImage=SimilarityImage(image(),reference_.constImage(),metric_,
similarityThreshold,&offset,similarityMetric_,&exceptionInfo);
ThrowPPException;
if (offset_ != (Geometry *) NULL)
*offset_=offset;
if (newImage == (MagickCore::Image *) NULL)
return(Magick::Image());
else
return(Magick::Image(newImage));
}
void Magick::Image::swirl(const double degrees_)
{
MagickCore::Image
+3
View File
@@ -125,6 +125,9 @@ namespace Magick
// Construct from RectangleInfo
Geometry(const MagickCore::RectangleInfo &rectangle_);
// Set via RectangleInfo
const Geometry& operator=(const MagickCore::RectangleInfo &rectangle_);
// Return an ImageMagick RectangleInfo struct
operator MagickCore::RectangleInfo() const;
+8
View File
@@ -1244,6 +1244,14 @@ namespace Magick
// Strip strips an image of all profiles and comments.
void strip(void);
// Search for the specified image at EVERY possible location in this image.
// This is slow! very very slow.. It returns a similarity image such that
// an exact match location is completely white and if none of the pixels
// match, black, otherwise some gray level in-between.
Image subImageSearch(const Image &reference_,const MetricType metric_,
Geometry *offset_,double *similarityMetric_,
const double similarityThreshold=(-1.0));
// Swirl image (image pixels are rotated by degrees)
void swirl(const double degrees_);
+1
View File
@@ -1319,6 +1319,7 @@ namespace Magick
using MagickCore::ShearImage;
using MagickCore::SigmoidalContrastImage;
using MagickCore::SignatureImage;
using MagickCore::SimilarityImage;
using MagickCore::SolarizeImage;
using MagickCore::SparseColorImage;
using MagickCore::SpliceImage;