libcvautomation/libcv_search_methods.html
2012-07-17 16:07:18 -04:00

59 lines
6.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>libcvautomation: Libcv Search Methods</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul></div>
<h1><a class="anchor" name="libcv_search_methods">Libcv Search Methods</a></h1>This page describes the methods libcv uses to search for a sub image in a root image. <h2><a class="anchor" name="tolerance">
Tolerance Values</a></h2>
Tolerance values are used to control how strict each of the following search methods are. Acceptable values are from <code>INT_MIN</code> to <code>INT_MAX</code>.<p>
Additionally, each of the reference programs - <code>cva-input</code> and <code>cva-match</code> - have a "sane tolerance" built in. This is accessed by the "-o" switch, and allows you to specify a tolerance on scale of 1-100, where 1 is incredibly strict, and 100 is incredibly loose. <dl compact><dt><b>Note:</b></dt><dd>The formula for calculating the sane tolerance is: <img class="formulaInl" alt="$ T(x) = (10^{\frac{\log{INT\_MAX}}{\lambda}})^x $" src="form_0.png"> where <img class="formulaInl" alt="$ \lambda $" src="form_1.png"> is the highest tolerance value (in our case, 100). Finally, we have to round down a little bit to ensure that we don't accidentally generate a value higher than <code>INT_MAX</code>. The formula used does mean that we will never be able to generate values lower than 0. </dd></dl>
<dl compact><dt><b>Warning:</b></dt><dd>The "sane-tolerance" option doesn't know which search method you are using - Thus while 1 is an incredibly strict search for <a class="el" href="libcv_search_methods.html#SQDIFF">Squared Difference</a> and <a class="el" href="libcv_search_methods.html#SQDIFF_NORMED">Squared Difference (Normalized)</a>, it is fairly loose search for <a class="el" href="libcv_search_methods.html#CCORR">Cross Correlation</a>, <a class="el" href="libcv_search_methods.html#CCORR_NORMED">Cross Correlation (Normalized)</a>, <a class="el" href="libcv_search_methods.html#CCOEFF">Correlation Coefficient</a>, and <a class="el" href="libcv_search_methods.html#CCOEFF_NORMED">Correlation Coefficient (Normalized)</a></dd></dl>
<h2><a class="anchor" name="SQDIFF">
Squared Difference</a></h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #define CV_TM_SQDIFF 0 </span>
</pre></div> Squared Difference is the default search method used by <code>libcvautomation</code>, as well as <code>cva-match</code> and <code>cva-input</code>. <dl compact><dt><b>For this method, setting a low tolerance value results in a more strict match.</b></dt><dd></dd></dl>
Formula: <img class="formulaInl" alt="$R(x,y) = \sum_{x',y'} (T(x',y') - I(x + x', y+y'))^2 $" src="form_2.png"><h2><a class="anchor" name="SQDIFF_NORMED">
Squared Difference (Normalized)</a></h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #define CV_TM_SQDIFF_NORMED 1 </span>
</pre></div> This is a normalized version of the <a class="el" href="libcv_search_methods.html#SQDIFF">Squared Difference</a> search method. <dl compact><dt><b>For this method, setting a low tolerance value results in a more strict match.</b></dt><dd></dd></dl>
Formula: <img class="formulaInl" alt="$ R(x,y) = \frac{\sum_{x',y'}(T(x',y') - I(x + x', y + y'))^2}{ \sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'}I(x + x', y + y')^2}} $" src="form_3.png"><h2><a class="anchor" name="CCORR">
Cross Correlation</a></h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #define CV_TM_CCORR 2 </span>
</pre></div> This is the Cross Correlation search method. <dl compact><dt><b>For this method, setting a high tolerance value results in a more strict match.</b></dt><dd></dd></dl>
Formula: <img class="formulaInl" alt="$ R(x,y)= \sum _{x',y'} (T(x',y') \cdot I(x+x',y+y')) $" src="form_4.png"><h2><a class="anchor" name="CCORR_NORMED">
Cross Correlation (Normalized)</a></h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #define CV_TM_CCORR_NORMED 3 </span>
</pre></div> This is the normalized version of the <a class="el" href="libcv_search_methods.html#CCORR">Cross Correlation</a> search method. <dl compact><dt><b>For this method, setting a high tolerance value results in a more strict match.</b></dt><dd></dd></dl>
Formula: <img class="formulaInl" alt="$ R(x,y)= \frac{\sum_{x',y'} (T(x',y') \cdot I'(x+x',y+y'))}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}} $" src="form_5.png"><h2><a class="anchor" name="CCOEFF">
Correlation Coefficient</a></h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #define CV_TM_CCOEFF 4 </span>
</pre></div> This is the Correlation Coefficient search method. <dl compact><dt><b>For this method, setting a high tolerance value results in a more strict match.</b></dt><dd></dd></dl>
Formula: <img class="formulaInl" alt="$ R(x,y)= \sum _{x',y'} (T'(x',y') \cdot I(x+x',y+y')) $" src="form_6.png"> where: <img class="formulaInl" alt="$ \begin{array}{l} T'(x',y')=T(x',y') - 1/(w \cdot h) \cdot \sum _{x'',y''} T(x'',y'') \\ I'(x+x',y+y')=I(x+x',y+y') - 1/(w \cdot h) \cdot \sum _{x'',y''} I(x+x'',y+y'') \end{array} $" src="form_7.png"><h2><a class="anchor" name="CCOEFF_NORMED">
Correlation Coefficient (Normalized)</a></h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #define CV_TM_CCOEFF_NORMED 5 </span>
</pre></div> This is the normalized version of the <a class="el" href="libcv_search_methods.html#CCOEFF">Correlation Coefficient</a> search method. <dl compact><dt><b>For this method, setting a high tolerance value results in a more strict match.</b></dt><dd></dd></dl>
Formula: <img class="formulaInl" alt="$ R(x,y)= \frac{ \sum_{x',y'} (T'(x',y') \cdot I'(x+x',y+y')) }{ \sqrt{\sum_{x',y'}T'(x',y')^2 \cdot \sum_{x',y'} I'(x+x',y+y')^2} } $" src="form_8.png"> <hr size="1"><address style="align: right;"><small>Generated on Tue Jul 17 12:19:00 2012 for libcvautomation by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>