libcvautomation/libcvautomation_search_methods.html

152 lines
10 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>libcvautomation: Libcv Search Methods</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script src="http://www.mathjax.org/mathjax/MathJax.js"></script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">libcvautomation
&#160;<span id="projectnumber">2.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Libcv Search Methods </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>This page describes the methods libcv uses to search for a sub image in a root image. </p>
<h2><a class="anchor" id="tolerance"></a>
Tolerance Values</h2>
<p>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>
<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. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>The formula for calculating the sane tolerance is: \( T(x) = (10^{\frac{\log{INT\_MAX}}{\lambda}})^x \) where \( \lambda \) 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 class="warning"><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="libcvautomation_search_methods.html#SQDIFF">Squared Difference</a> and <a class="el" href="libcvautomation_search_methods.html#SQDIFF_NORMED">Squared Difference (Normalized)</a>, it is fairly loose search for <a class="el" href="libcvautomation_search_methods.html#CCORR">Cross Correlation</a>, <a class="el" href="libcvautomation_search_methods.html#CCORR_NORMED">Cross Correlation (Normalized)</a>, <a class="el" href="libcvautomation_search_methods.html#CCOEFF">Correlation Coefficient</a>, and <a class="el" href="libcvautomation_search_methods.html#CCOEFF_NORMED">Correlation Coefficient (Normalized)</a></dd></dl>
<h2><a class="anchor" id="SQDIFF"></a>
Squared Difference</h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #define CV_TM_SQDIFF 0 </span>
</pre></div><p> Squared Difference is the default search method used by <code>libcvautomation</code>, as well as <code>cva-match</code> and <code>cva-input</code>. </p>
<dl class="user"><dt><b>For this method, setting a low tolerance value results in a more strict match.</b></dt><dd></dd></dl>
<p>Formula: \(R(x,y) = \sum_{x&#39;,y&#39;} (T(x&#39;,y&#39;) - I(x + x&#39;, y+y&#39;))^2 \)</p>
<h2><a class="anchor" id="SQDIFF_NORMED"></a>
Squared Difference (Normalized)</h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #define CV_TM_SQDIFF_NORMED 1 </span>
</pre></div><p> This is a normalized version of the <a class="el" href="libcvautomation_search_methods.html#SQDIFF">Squared Difference</a> search method. </p>
<dl class="user"><dt><b>For this method, setting a low tolerance value results in a more strict match.</b></dt><dd></dd></dl>
<p>Formula: \( R(x,y) = \frac{\sum_{x&#39;,y&#39;}(T(x&#39;,y&#39;) - I(x + x&#39;, y + y&#39;))^2}{ \sqrt{\sum_{x&#39;,y&#39;}T(x&#39;,y&#39;)^2 \cdot \sum_{x&#39;,y&#39;}I(x + x&#39;, y + y&#39;)^2}} \)</p>
<h2><a class="anchor" id="CCORR"></a>
Cross Correlation</h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #define CV_TM_CCORR 2 </span>
</pre></div><p> This is the Cross Correlation search method. </p>
<dl class="user"><dt><b>For this method, setting a high tolerance value results in a more strict match.</b></dt><dd></dd></dl>
<p>Formula: \( R(x,y)= \sum _{x&#39;,y&#39;} (T(x&#39;,y&#39;) \cdot I(x+x&#39;,y+y&#39;)) \)</p>
<h2><a class="anchor" id="CCORR_NORMED"></a>
Cross Correlation (Normalized)</h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #define CV_TM_CCORR_NORMED 3 </span>
</pre></div><p> This is the normalized version of the <a class="el" href="libcvautomation_search_methods.html#CCORR">Cross Correlation</a> search method. </p>
<dl class="user"><dt><b>For this method, setting a high tolerance value results in a more strict match.</b></dt><dd></dd></dl>
<p>Formula: \( R(x,y)= \frac{\sum_{x&#39;,y&#39;} (T(x&#39;,y&#39;) \cdot I&#39;(x+x&#39;,y+y&#39;))}{\sqrt{\sum_{x&#39;,y&#39;}T(x&#39;,y&#39;)^2 \cdot \sum_{x&#39;,y&#39;} I(x+x&#39;,y+y&#39;)^2}} \)</p>
<h2><a class="anchor" id="CCOEFF"></a>
Correlation Coefficient</h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #define CV_TM_CCOEFF 4 </span>
</pre></div><p> This is the Correlation Coefficient search method. </p>
<dl class="user"><dt><b>For this method, setting a high tolerance value results in a more strict match.</b></dt><dd></dd></dl>
<p>Formula: \( R(x,y)= \sum _{x&#39;,y&#39;} (T&#39;(x&#39;,y&#39;) \cdot I(x+x&#39;,y+y&#39;)) \) where: \( \begin{array}{l} T&#39;(x&#39;,y&#39;)=T(x&#39;,y&#39;) - 1/(w \cdot h) \cdot \sum _{x&#39;&#39;,y&#39;&#39;} T(x&#39;&#39;,y&#39;&#39;) \\ I&#39;(x+x&#39;,y+y&#39;)=I(x+x&#39;,y+y&#39;) - 1/(w \cdot h) \cdot \sum _{x&#39;&#39;,y&#39;&#39;} I(x+x&#39;&#39;,y+y&#39;&#39;) \end{array} \)</p>
<h2><a class="anchor" id="CCOEFF_NORMED"></a>
Correlation Coefficient (Normalized)</h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #define CV_TM_CCOEFF_NORMED 5 </span>
</pre></div><p> This is the normalized version of the <a class="el" href="libcvautomation_search_methods.html#CCOEFF">Correlation Coefficient</a> search method. </p>
<dl class="user"><dt><b>For this method, setting a high tolerance value results in a more strict match.</b></dt><dd></dd></dl>
<p>Formula: \( R(x,y)= \frac{ \sum_{x&#39;,y&#39;} (T&#39;(x&#39;,y&#39;) \cdot I&#39;(x+x&#39;,y+y&#39;)) }{ \sqrt{\sum_{x&#39;,y&#39;}T&#39;(x&#39;,y&#39;)^2 \cdot \sum_{x&#39;,y&#39;} I&#39;(x+x&#39;,y+y&#39;)^2} } \) </p>
</div></div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Defines</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>
Generated on Thu Oct 11 2012 17:42:49 for libcvautomation by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
</body>
</html>