<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Description</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="imagick.stripimage.html">Imagick::stripImage</a></div> <div class="next" style="text-align: right; float: right;"><a href="imagick.swirlimage.html">Imagick::swirlImage</a></div> <div class="up"><a href="class.imagick.html">Imagick</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="imagick.subimagematch" class="refentry"> <div class="refnamediv"> <h1 class="refname">Imagick::subImageMatch</h1> <p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">Imagick::subImageMatch</span> — <span class="dc-title">Description</span></p> </div> <div class="refsect1 description" id="refsect1-imagick.subimagematch-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type"><a href="class.imagick.html" class="type Imagick">Imagick</a></span> <span class="methodname"><strong>Imagick::subImageMatch</strong></span> ( <span class="methodparam"><span class="type"><a href="class.imagick.html" class="type Imagick">Imagick</a></span> <code class="parameter">$Imagick</code></span> [, <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$offset</code></span> [, <span class="methodparam"><span class="type">float</span> <code class="parameter reference">&$similarity</code></span> ]] )</div> <p class="para rdfs-comment"> Searches for a subimage in the current image and 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. You can also pass in the optional parameters bestMatch and similarity. After calling the function similarity will be set to the 'score' of the similarity between the subimage and the matching position in the larger image, bestMatch will contain an associative array with elements x, y, width, height that describe the matching region. </p> </div> <div class="refsect1 parameters" id="refsect1-imagick.subimagematch-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <code class="parameter">Imagick</code></dt> <dd> <p class="para"> </p> </dd> <dt> <code class="parameter">offset</code></dt> <dd> <p class="para"> </p> </dd> <dt> <code class="parameter">similarity</code></dt> <dd> <p class="para"> A new image that displays the amount of similarity at each pixel. </p> </dd> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-imagick.subimagematch-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> </p> </div> <div class="refsect1 examples" id="refsect1-imagick.subimagematch-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-4042"> <p><strong>Example #1 <span class="function"><strong>Imagick::subImageMatch()</strong></span></strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">subImageMatch</span><span style="color: #007700">(</span><span style="color: #0000BB">$imagePath</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">$imagick </span><span style="color: #007700">= new \</span><span style="color: #0000BB">Imagick</span><span style="color: #007700">(</span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #0000BB">$imagePath</span><span style="color: #007700">));<br /> </span><span style="color: #0000BB">$imagick2 </span><span style="color: #007700">= clone </span><span style="color: #0000BB">$imagick</span><span style="color: #007700">;<br /> </span><span style="color: #0000BB">$imagick2</span><span style="color: #007700">-></span><span style="color: #0000BB">cropimage</span><span style="color: #007700">(</span><span style="color: #0000BB">40</span><span style="color: #007700">, </span><span style="color: #0000BB">40</span><span style="color: #007700">, </span><span style="color: #0000BB">250</span><span style="color: #007700">, </span><span style="color: #0000BB">110</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$imagick2</span><span style="color: #007700">-></span><span style="color: #0000BB">vignetteimage</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">);<br /><br /> </span><span style="color: #0000BB">$similarity </span><span style="color: #007700">= </span><span style="color: #0000BB">null</span><span style="color: #007700">;<br /> </span><span style="color: #0000BB">$bestMatch </span><span style="color: #007700">= </span><span style="color: #0000BB">null</span><span style="color: #007700">;<br /> </span><span style="color: #0000BB">$comparison </span><span style="color: #007700">= </span><span style="color: #0000BB">$imagick</span><span style="color: #007700">-></span><span style="color: #0000BB">subImageMatch</span><span style="color: #007700">(</span><span style="color: #0000BB">$imagick2</span><span style="color: #007700">, </span><span style="color: #0000BB">$bestMatch</span><span style="color: #007700">, </span><span style="color: #0000BB">$similarity</span><span style="color: #007700">);<br /><br /> </span><span style="color: #0000BB">$comparison</span><span style="color: #007700">-></span><span style="color: #0000BB">setImageFormat</span><span style="color: #007700">(</span><span style="color: #DD0000">'png'</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Content-Type: image/png"</span><span style="color: #007700">);<br /> echo </span><span style="color: #0000BB">$imagick</span><span style="color: #007700">-></span><span style="color: #0000BB">getImageBlob</span><span style="color: #007700">();<br />}<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="imagick.stripimage.html">Imagick::stripImage</a></div> <div class="next" style="text-align: right; float: right;"><a href="imagick.swirlimage.html">Imagick::swirlImage</a></div> <div class="up"><a href="class.imagick.html">Imagick</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>