<!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::RANSAC_Template 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> > <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 Page</span></a></li> <li><a href="pages.html"><span>Related 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 List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="inherits.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class 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_r_a_n_s_a_c___template.html">RANSAC_Template</a> </li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#pub-types">Public Types</a> | <a href="#pub-static-methods">Static Public Member Functions</a> </div> <div class="headertitle"> <div class="title">mrpt::math::RANSAC_Template 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::RANSAC_Template" --><!-- doxytag: inherits="mrpt::utils::CDebugOutputCapable" --><hr/><a name="details" id="details"></a><h2>Detailed Description</h2> <div class="textblock"><p>A generic RANSAC implementation with models as matrices. </p> <p>See <em><a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#a62896cd960346c4b965dac5d0128a963" title="An implementation of the RANSAC algorithm for robust fitting of models to data.">RANSAC_Template::execute</a></em> for more info on usage. </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classmrpt_1_1math_1_1_model_search.html" title="Model search implementations: RANSAC and genetic algorithm.">mrpt::math::ModelSearch</a>, a more versatile <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 anything else, not only matrices. </dd></dl> </div> <p><code>#include <<a class="el" href="ransac_8h_source.html">mrpt/math/ransac.h</a>></code></p> <div class="dynheader"> Inheritance diagram for mrpt::math::RANSAC_Template:</div> <div class="dyncontent"> <div class="center"><img src="classmrpt_1_1math_1_1_r_a_n_s_a_c___template__inherit__graph.png" border="0" usemap="#mrpt_1_1math_1_1_r_a_n_s_a_c___template_inherit__map" alt="Inheritance graph"/></div> <map name="mrpt_1_1math_1_1_r_a_n_s_a_c___template_inherit__map" id="mrpt_1_1math_1_1_r_a_n_s_a_c___template_inherit__map"> <area shape="rect" id="node2" href="classmrpt_1_1utils_1_1_c_debug_output_capable.html" title="This base class provides a common printf-like method to send debug information to std::cout..." alt="" coords="5,5,227,32"/></map> <center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div> <p><a href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template-members.html">List of all members.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="pub-types"></a> Public Types</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#af85b02741f477f76477550433af13ce8">TRansacFitFunctor</a> )(const <a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > &allData, const <a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">mrpt::vector_size_t</a> &useIndices, <a class="el" href="classstd_1_1vector.html">std::vector</a>< <a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > > &fitModels)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. <a href="#af85b02741f477f76477550433af13ce8"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#add16cb497853692c72ea7dc0422df803">TRansacDistanceFunctor</a> )(const <a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > &allData, const <a class="el" href="classstd_1_1vector.html">std::vector</a>< <a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > > &testModels, const NUMTYPE distanceThreshold, unsigned int &out_bestModelIndex, <a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">mrpt::vector_size_t</a> &out_inlierIndices)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. <a href="#add16cb497853692c72ea7dc0422df803"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef bool(* </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#a564dd5863ec457b2c53f7ea216a766cf">TRansacDegenerateFunctor</a> )(const <a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > &allData, const <a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">mrpt::vector_size_t</a> &useIndices)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. <a href="#a564dd5863ec457b2c53f7ea216a766cf"></a><br/></td></tr> <tr><td colspan="2"><h2><a name="pub-static-methods"></a> Static Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#a62896cd960346c4b965dac5d0128a963">execute</a> (const <a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > &data, <a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#af85b02741f477f76477550433af13ce8">TRansacFitFunctor</a> fit_func, <a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#add16cb497853692c72ea7dc0422df803">TRansacDistanceFunctor</a> dist_func, <a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#a564dd5863ec457b2c53f7ea216a766cf">TRansacDegenerateFunctor</a> degen_func, const double distanceThreshold, const unsigned int minimumSizeSamplesToFit, <a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">mrpt::vector_size_t</a> &out_best_inliers, <a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > &out_best_model, bool verbose=false, const double prob_good_sample=0.999, const size_t maxIter=2000)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">An implementation of the RANSAC algorithm for robust fitting of models to data. <a href="#a62896cd960346c4b965dac5d0128a963"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1utils_1_1_c_debug_output_capable.html#ab78281b5d70d6e295a8527a10fea66de">printf_debug</a> (const char *frmt,...)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Sends a formated text to "debugOut" if not NULL, or to cout otherwise. <a href="#ab78281b5d70d6e295a8527a10fea66de"></a><br/></td></tr> </table> <hr/><h2>Member Typedef Documentation</h2> <a class="anchor" id="a564dd5863ec457b2c53f7ea216a766cf"></a><!-- doxytag: member="mrpt::math::RANSAC_Template::TRansacDegenerateFunctor" ref="a564dd5863ec457b2c53f7ea216a766cf" args=")(const CMatrixTemplateNumeric< NUMTYPE > &allData, const mrpt::vector_size_t &useIndices)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef bool(* <a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#a564dd5863ec457b2c53f7ea216a766cf">mrpt::math::RANSAC_Template::TRansacDegenerateFunctor</a>)(const <a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > &allData, const <a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">mrpt::vector_size_t</a> &useIndices)</td> </tr> </table> </div> <div class="memdoc"> <p>The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. </p> <p>Definition at line <a class="el" href="ransac_8h_source.html#l00068">68</a> of file <a class="el" href="ransac_8h_source.html">ransac.h</a>.</p> </div> </div> <a class="anchor" id="add16cb497853692c72ea7dc0422df803"></a><!-- doxytag: member="mrpt::math::RANSAC_Template::TRansacDistanceFunctor" ref="add16cb497853692c72ea7dc0422df803" args=")(const CMatrixTemplateNumeric< NUMTYPE > &allData, const std::vector< CMatrixTemplateNumeric< NUMTYPE > > &testModels, const NUMTYPE distanceThreshold, unsigned int &out_bestModelIndex, mrpt::vector_size_t &out_inlierIndices)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef void(* <a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#add16cb497853692c72ea7dc0422df803">mrpt::math::RANSAC_Template::TRansacDistanceFunctor</a>)(const <a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > &allData, const <a class="el" href="classstd_1_1vector.html">std::vector</a>< <a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > > &testModels, const NUMTYPE distanceThreshold, unsigned int &out_bestModelIndex, <a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">mrpt::vector_size_t</a> &out_inlierIndices)</td> </tr> </table> </div> <div class="memdoc"> <p>The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. </p> <p>Definition at line <a class="el" href="ransac_8h_source.html#l00060">60</a> of file <a class="el" href="ransac_8h_source.html">ransac.h</a>.</p> </div> </div> <a class="anchor" id="af85b02741f477f76477550433af13ce8"></a><!-- doxytag: member="mrpt::math::RANSAC_Template::TRansacFitFunctor" ref="af85b02741f477f76477550433af13ce8" args=")(const CMatrixTemplateNumeric< NUMTYPE > &allData, const mrpt::vector_size_t &useIndices, std::vector< CMatrixTemplateNumeric< NUMTYPE > > &fitModels)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef void(* <a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#af85b02741f477f76477550433af13ce8">mrpt::math::RANSAC_Template::TRansacFitFunctor</a>)(const <a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > &allData, const <a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">mrpt::vector_size_t</a> &useIndices, <a class="el" href="classstd_1_1vector.html">std::vector</a>< <a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > > &fitModels)</td> </tr> </table> </div> <div class="memdoc"> <p>The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. </p> <p>Definition at line <a class="el" href="ransac_8h_source.html#l00054">54</a> of file <a class="el" href="ransac_8h_source.html">ransac.h</a>.</p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a62896cd960346c4b965dac5d0128a963"></a><!-- doxytag: member="mrpt::math::RANSAC_Template::execute" ref="a62896cd960346c4b965dac5d0128a963" args="(const CMatrixTemplateNumeric< NUMTYPE > &data, TRansacFitFunctor fit_func, TRansacDistanceFunctor dist_func, TRansacDegenerateFunctor degen_func, const double distanceThreshold, const unsigned int minimumSizeSamplesToFit, mrpt::vector_size_t &out_best_inliers, CMatrixTemplateNumeric< NUMTYPE > &out_best_model, bool verbose=false, const double prob_good_sample=0.999, const size_t maxIter=2000)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static bool mrpt::math::RANSAC_Template::execute </td> <td>(</td> <td class="paramtype">const <a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > & </td> <td class="paramname"><em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#af85b02741f477f76477550433af13ce8">TRansacFitFunctor</a> </td> <td class="paramname"><em>fit_func</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#add16cb497853692c72ea7dc0422df803">TRansacDistanceFunctor</a> </td> <td class="paramname"><em>dist_func</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classmrpt_1_1math_1_1_r_a_n_s_a_c___template.html#a564dd5863ec457b2c53f7ea216a766cf">TRansacDegenerateFunctor</a> </td> <td class="paramname"><em>degen_func</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const double </td> <td class="paramname"><em>distanceThreshold</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const unsigned int </td> <td class="paramname"><em>minimumSizeSamplesToFit</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="namespacemrpt.html#ad4d2b1efd37ed750302c76ebbcfc310d">mrpt::vector_size_t</a> & </td> <td class="paramname"><em>out_best_inliers</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classmrpt_1_1math_1_1_c_matrix_template_numeric.html">CMatrixTemplateNumeric</a>< NUMTYPE > & </td> <td class="paramname"><em>out_best_model</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"><em>verbose</em> = <code>false</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const double </td> <td class="paramname"><em>prob_good_sample</em> = <code>0.999</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const size_t </td> <td class="paramname"><em>maxIter</em> = <code>2000</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>An implementation of the RANSAC algorithm for robust fitting of models to data. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">data</td><td>A DxN matrix with all the observed data. D is the dimensionality of data points and N the number of points. </td></tr> <tr><td class="paramname"></td><td>This implementation is highly inspired on Peter Kovesi's MATLAB scripts (<a href="http://www.csse.uwa.edu.au/~pk">http://www.csse.uwa.edu.au/~pk</a>). </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>false if no good solution can be found, true on success. </dd></dl> </div> </div> <a class="anchor" id="ab78281b5d70d6e295a8527a10fea66de"></a><!-- doxytag: member="mrpt::math::RANSAC_Template::printf_debug" ref="ab78281b5d70d6e295a8527a10fea66de" args="(const char *frmt,...)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void mrpt::utils::CDebugOutputCapable::printf_debug </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"><em>frmt</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname"><em>...</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static, inherited]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Sends a formated text to "debugOut" if not NULL, or to cout otherwise. </p> <p>Referenced by <a class="el" href="_c_levenberg_marquardt_8h_source.html#l00098">mrpt::math::CLevenbergMarquardtTempl::execute()</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>