Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 4bc66056a634db26a1f4d0845dc41ca6 > files > 4342

mrpt-doc-0.9.5-0.1.20110925svn2670.fc16.i686.rpm

<!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>mrpt::math::ModelSearch Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<div align="left"><a href="http://www.mrpt.org/">Main MRPT website</a> &gt; <b>C++ reference</b> </div>
<div align="right">
<a href="index.html"><img border="0" src="mrpt_logo.png" alt="MRPT logo"></a>
</div>
<!-- Generated by Doxygen 1.7.5 -->
<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><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><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">
          <div class="left">
            <form id="FSearchBox" action="search.php" method="get">
              <img id="MSearchSelect" src="search/mag.png" alt=""/>
              <input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S" 
                     onfocus="searchBox.OnSearchFieldFocus(true)" 
                     onblur="searchBox.OnSearchFieldFocus(false)"/>
            </form>
          </div><div class="right"></div>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="namespacemrpt.html">mrpt</a>      </li>
      <li class="navelem"><a class="el" href="namespacemrpt_1_1math.html">math</a>      </li>
      <li class="navelem"><a class="el" href="classmrpt_1_1math_1_1_model_search.html">ModelSearch</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-methods">Private Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">mrpt::math::ModelSearch Class Reference<div class="ingroups"><a class="el" href="group__ransac__grp.html">RANSAC and other model fitting algorithms</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="mrpt::math::ModelSearch" --><hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Model search implementations: RANSAC and genetic algorithm. </p>
<p>The type <em>TModelFit</em> is a user-supplied struct/class that implements this interface:</p>
<ul>
<li>Types:<ul>
<li><em>Real</em> : The numeric type to use (typ: double, float)</li>
<li><em>Model</em> : The type of the model to be fitted (for example: A matrix, a <a class="el" href="structmrpt_1_1math_1_1_t_line2_d.html" title="2D line without bounds, represented by its equation .">TLine2D</a>, a TPlane3D, ...)</li>
</ul>
</li>
<li>Methods:<ul>
<li>size_t getSampleCount() const : return the number of samples. This should not change during a model search.</li>
<li>bool fitModel( const vector_size_t&amp; useIndices, Model&amp; model ) const : This function fits a model to the data selected by the indices. The return value indicates the success, hence false means a degenerate case, where no model was found.</li>
<li>Real testSample( size_t index, const Model&amp; model ) const : return some value that indicates how well a sample fits to the model. This way the thresholding is moved to the searching procedure and the model just tells how good a sample is.</li>
</ul>
</li>
</ul>
<p>There are two methods provided in this class to fit a model:</p>
<ul>
<li><em>ransacSingleModel</em> (RANSAC): Just like <a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html" title="A generic RANSAC implementation with models as matrices.">mrpt::math::RANSAC_Template</a></li>
</ul>
<ul>
<li><em>geneticSingleModel</em> (Genetic): Provides a mixture of a genetic and the ransac algorithm. Instead of selecting a set of data in each iteration, it takes more (ex. 10) and order these model using some fitness function: the average error of the inliers scaled by the number of outliers (This fitness might require some fine tuning). Than the (ex 10) new kernel for the next iteration is created as follows:<ul>
<li>Take the best kernels (as for the original ransac)</li>
<li>Select two kernels ( with a higher probability for the better models) and let the new kernel be a subset of the two original kernels ( additionally to leave the local minimums an additional random seed might appear - mutation)</li>
<li>Generate some new random samples.</li>
</ul>
</li>
</ul>
<p>For an example of usage, see "samples/model_search_test/" </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html" title="A generic RANSAC implementation with models as matrices.">mrpt::math::RANSAC_Template</a>, another <a class="el" href="group__ransac__grp.html#ga6ef19b76f2cbad65eba7f701a610bff5" title="The default instance of RANSAC, for double type.">RANSAC</a> implementation where models can be matrices only.</dd></dl>
<dl class="author"><dt><b>Author:</b></dt><dd>Zoltar Gaal </dd></dl>
</div>
<p><code>#include &lt;<a class="el" href="model__search_8h_source.html">mrpt/math/model_search.h</a>&gt;</code></p>

<p><a href="classmrpt_1_1math_1_1_model_search-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structmrpt_1_1math_1_1_model_search_1_1_t_species.html">TSpecies</a></td></tr>
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memTemplParams" colspan="2">template&lt;typename TModelFit &gt; </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classmrpt_1_1math_1_1_model_search.html#aa4de9616da8e038ffa32a92959780488">ransacSingleModel</a> (const TModelFit &amp;p_state, size_t p_kernelSize, const typename TModelFit::Real &amp;p_fitnessThreshold, typename TModelFit::Model &amp;p_bestModel, <a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">vector_size_t</a> &amp;p_inliers)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Run the ransac algorithm searching for a single model.  <a href="#aa4de9616da8e038ffa32a92959780488"></a><br/></td></tr>
<tr><td class="memTemplParams" colspan="2">template&lt;typename TModelFit &gt; </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classmrpt_1_1math_1_1_model_search.html#a56cf13ab97fef4a0e57660fb7cbd54c4">geneticSingleModel</a> (const TModelFit &amp;p_state, size_t p_kernelSize, const typename TModelFit::Real &amp;p_fitnessThreshold, size_t p_populationSize, size_t p_maxIteration, typename TModelFit::Model &amp;p_bestModel, <a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">vector_size_t</a> &amp;p_inliers)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Run a generic programming version of ransac searching for a single model.  <a href="#a56cf13ab97fef4a0e57660fb7cbd54c4"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1math_1_1_model_search.html#a0fecc75e49307a584d0f2e21ce679414">pickRandomIndex</a> (size_t p_size, size_t p_pick, <a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">vector_size_t</a> &amp;p_ind)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Select random (unique) indices from the 0..p_size sequence.  <a href="#a0fecc75e49307a584d0f2e21ce679414"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1math_1_1_model_search.html#a3a3bc7f0f13c6992915b6a8cf86ee6af">pickRandomIndex</a> (<a class="el" href="classstd_1_1set.html">std::set</a>&lt; size_t &gt; p_set, size_t p_pick, <a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">vector_size_t</a> &amp;p_ind)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Select random (unique) indices from the set.  <a href="#a3a3bc7f0f13c6992915b6a8cf86ee6af"></a><br/></td></tr>
</table>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a56cf13ab97fef4a0e57660fb7cbd54c4"></a><!-- doxytag: member="mrpt::math::ModelSearch::geneticSingleModel" ref="a56cf13ab97fef4a0e57660fb7cbd54c4" args="(const TModelFit &amp;p_state, size_t p_kernelSize, const typename TModelFit::Real &amp;p_fitnessThreshold, size_t p_populationSize, size_t p_maxIteration, typename TModelFit::Model &amp;p_bestModel, vector_size_t &amp;p_inliers)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename TModelFit &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool mrpt::math::ModelSearch::geneticSingleModel </td>
          <td>(</td>
          <td class="paramtype">const TModelFit &amp;&#160;</td>
          <td class="paramname"><em>p_state</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>p_kernelSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const typename TModelFit::Real &amp;&#160;</td>
          <td class="paramname"><em>p_fitnessThreshold</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>p_populationSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>p_maxIteration</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">typename TModelFit::Model &amp;&#160;</td>
          <td class="paramname"><em>p_bestModel</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">vector_size_t</a> &amp;&#160;</td>
          <td class="paramname"><em>p_inliers</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Run a generic programming version of ransac searching for a single model. </p>

<p>Definition at line <a class="el" href="model__search__impl_8h_source.html#l00107">107</a> of file <a class="el" href="model__search__impl_8h_source.html">model_search_impl.h</a>.</p>

<p>References <a class="el" href="classmrpt_1_1math_1_1_model_search.html#a0fecc75e49307a584d0f2e21ce679414">pickRandomIndex()</a>, and <a class="el" href="mrpt__macros_8h_source.html#l00282">ASSERT_</a>.</p>

</div>
</div>
<a class="anchor" id="a0fecc75e49307a584d0f2e21ce679414"></a><!-- doxytag: member="mrpt::math::ModelSearch::pickRandomIndex" ref="a0fecc75e49307a584d0f2e21ce679414" args="(size_t p_size, size_t p_pick, vector_size_t &amp;p_ind)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mrpt::math::ModelSearch::pickRandomIndex </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>p_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>p_pick</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">vector_size_t</a> &amp;&#160;</td>
          <td class="paramname"><em>p_ind</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Select random (unique) indices from the 0..p_size sequence. </p>

<p>Referenced by <a class="el" href="model__search__impl_8h_source.html#l00044">ransacSingleModel()</a>, and <a class="el" href="model__search__impl_8h_source.html#l00107">geneticSingleModel()</a>.</p>

</div>
</div>
<a class="anchor" id="a3a3bc7f0f13c6992915b6a8cf86ee6af"></a><!-- doxytag: member="mrpt::math::ModelSearch::pickRandomIndex" ref="a3a3bc7f0f13c6992915b6a8cf86ee6af" args="(std::set&lt; size_t &gt; p_set, size_t p_pick, vector_size_t &amp;p_ind)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void mrpt::math::ModelSearch::pickRandomIndex </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classstd_1_1set.html">std::set</a>&lt; size_t &gt;&#160;</td>
          <td class="paramname"><em>p_set</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>p_pick</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">vector_size_t</a> &amp;&#160;</td>
          <td class="paramname"><em>p_ind</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Select random (unique) indices from the set. </p>
<p>The set is destroyed during pick </p>

</div>
</div>
<a class="anchor" id="aa4de9616da8e038ffa32a92959780488"></a><!-- doxytag: member="mrpt::math::ModelSearch::ransacSingleModel" ref="aa4de9616da8e038ffa32a92959780488" args="(const TModelFit &amp;p_state, size_t p_kernelSize, const typename TModelFit::Real &amp;p_fitnessThreshold, typename TModelFit::Model &amp;p_bestModel, vector_size_t &amp;p_inliers)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename TModelFit &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool mrpt::math::ModelSearch::ransacSingleModel </td>
          <td>(</td>
          <td class="paramtype">const TModelFit &amp;&#160;</td>
          <td class="paramname"><em>p_state</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>p_kernelSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const typename TModelFit::Real &amp;&#160;</td>
          <td class="paramname"><em>p_fitnessThreshold</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">typename TModelFit::Model &amp;&#160;</td>
          <td class="paramname"><em>p_bestModel</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">vector_size_t</a> &amp;&#160;</td>
          <td class="paramname"><em>p_inliers</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Run the ransac algorithm searching for a single model. </p>

<p>Definition at line <a class="el" href="model__search__impl_8h_source.html#l00044">44</a> of file <a class="el" href="model__search__impl_8h_source.html">model_search_impl.h</a>.</p>

<p>References <a class="el" href="classmrpt_1_1math_1_1_model_search.html#a0fecc75e49307a584d0f2e21ce679414">pickRandomIndex()</a>, and <a class="el" href="mrpt__macros_8h_source.html#l00282">ASSERT_</a>.</p>

</div>
</div>
</div>
<br><hr><br> <table border="0" width="100%"> <tr> <td> Page generated by <a href="http://www.doxygen.org" target="_blank">Doxygen 1.7.5</a> for MRPT 0.9.5 SVN: at Sun Sep 25 17:20:18 UTC 2011</td><td></td> <td width="100"> </td> <td width="150">  </td></tr> </table>  </body></html>