2
0
mirror of https://github.com/boostorg/gil.git synced 2026-02-01 08:32:10 +00:00
Files
gil/develop/doc/html/reference/hough__parameter_8hpp_source.html
github-actions[bot] f0749a83f8 deploy: 6da59cc335
2021-03-10 08:18:25 +00:00

142 lines
17 KiB
HTML

<!-- HTML header for doxygen 1.8.13-->
<!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"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Generic Image Library: hough_parameter.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-boost.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="boost-header">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary="header">
<tr>
<td valign="top" width="300">
<h3><a href="../index.html"><img alt="Boost GIL" src="../_static/gil.png" border="0"></a></h3>
</td>
<td ><h1 align="center"><a href="../index.html"></a></h1></td>
<td></td>
</tr>
</table>
</div>
<hr/>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_1878a3f4746a95c6aad317458cc7ef80.html">boost</a></li><li class="navelem"><a class="el" href="dir_df4750f408086f9b9c1b5ee4251365ff.html">gil</a></li><li class="navelem"><a class="el" href="dir_29d7d1879aced8e7726ea9a11f3c7333.html">image_processing</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">hough_parameter.hpp</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">// Boost.GIL (Generic Image Library) - tests</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment">// Copyright 2020 Olzhas Zhumabek &lt;anonymous.from.applecity@gmail.com&gt;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment">// Use, modification and distribution are subject to the Boost Software License,</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment">// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment">// http://www.boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="preprocessor">#ifndef BOOST_GIL_IMAGE_PROCESSING_HOUGH_PARAMETER_HPP</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="preprocessor">#define BOOST_GIL_IMAGE_PROCESSING_HOUGH_PARAMETER_HPP</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160; </div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="preprocessor">#include &lt;boost/gil/point.hpp&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="preprocessor">#include &lt;cmath&gt;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="preprocessor">#include &lt;cstddef&gt;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160; </div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="keyword">namespace </span>boost</div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;{</div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="keyword">namespace </span>gil</div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;{</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="structboost_1_1gil_1_1hough__parameter.html"> 26</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structboost_1_1gil_1_1hough__parameter.html">hough_parameter</a></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;{</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; T start_point;</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; T step_size;</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; std::size_t step_count;</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; </div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="group___hough_transform.html#ga2453e44ea538fce4da49b1a09e63299d"> 38</a></span>&#160; <span class="keyword">static</span> <a class="code" href="structboost_1_1gil_1_1hough__parameter.html">hough_parameter&lt;T&gt;</a> <a class="code" href="group___hough_transform.html#ga2453e44ea538fce4da49b1a09e63299d">from_step_count</a>(T start_point, T neighborhood,</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; std::size_t half_step_count)</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; {</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; T step_size = neighborhood / half_step_count;</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; std::size_t step_count = half_step_count * 2 + 1;</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; <span class="comment">// explicitly fill out members, as aggregate init will error out with narrowing</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; <a class="code" href="structboost_1_1gil_1_1hough__parameter.html">hough_parameter&lt;T&gt;</a> parameter;</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; parameter.start_point = start_point - neighborhood;</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; parameter.step_size = step_size;</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; parameter.step_count = step_count;</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; <span class="keywordflow">return</span> parameter;</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; }</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; </div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="group___hough_transform.html#ga611735fba984082c97a3f0c122b709d7"> 57</a></span>&#160; <span class="keyword">static</span> <a class="code" href="structboost_1_1gil_1_1hough__parameter.html">hough_parameter&lt;T&gt;</a> <a class="code" href="group___hough_transform.html#ga611735fba984082c97a3f0c122b709d7">from_step_size</a>(T start_point, T neighborhood, T step_size)</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; {</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; std::size_t step_count =</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; 2 * <span class="keyword">static_cast&lt;</span>std::size_t<span class="keyword">&gt;</span>(std::floor(neighborhood / step_size)) + 1;</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; <span class="comment">// do not use step_size - neighborhood, as step_size might not allow</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; <span class="comment">// landing exactly on that value when starting from start_point</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; <span class="comment">// also use parentheses on step_count / 2 because flooring is exactly</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; <span class="comment">// what we want</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; </div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <span class="comment">// explicitly fill out members, as aggregate init will error out with narrowing</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; <a class="code" href="structboost_1_1gil_1_1hough__parameter.html">hough_parameter&lt;T&gt;</a> parameter;</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; parameter.start_point = start_point - step_size * (step_count / 2);</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; parameter.step_size = step_size;</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; parameter.step_count = step_count;</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; <span class="keywordflow">return</span> parameter;</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; }</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;};</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; </div>
<div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="group___hough_transform.html#gaf9c1e143c7c33128efa823f6c193663c"> 85</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="group___hough_transform.html#gaf9c1e143c7c33128efa823f6c193663c">minimum_angle_step</a>(<a class="code" href="classboost_1_1gil_1_1point.html">point_t</a> dimensions)</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160;{</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; <span class="keyword">auto</span> longer_dimension = dimensions.x &gt; dimensions.y ? dimensions.x : dimensions.y;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; <span class="keywordflow">return</span> std::atan2(1, longer_dimension);</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160;}</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; </div>
<div class="line"><a name="l00101"></a><span class="lineno"><a class="line" href="group___hough_transform.html#gaf54301aeb8d2a2811db3e1b454bdd99e"> 101</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="structboost_1_1gil_1_1hough__parameter.html">hough_parameter&lt;double&gt;</a> <a class="code" href="group___hough_transform.html#gaf54301aeb8d2a2811db3e1b454bdd99e">make_theta_parameter</a>(<span class="keywordtype">double</span> approx_angle, <span class="keywordtype">double</span> neighborhood,</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; <a class="code" href="classboost_1_1gil_1_1point.html">point_t</a> dimensions)</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160;{</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; <span class="keyword">auto</span> angle_step = <a class="code" href="group___hough_transform.html#gaf9c1e143c7c33128efa823f6c193663c">minimum_angle_step</a>(dimensions);</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; </div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; <span class="comment">// std::size_t step_count =</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; <span class="comment">// 2 * static_cast&lt;std::size_t&gt;(std::floor(neighborhood / angle_step)) + 1;</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; <span class="comment">// return {approx_angle - angle_step * (step_count / 2), angle_step, step_count};</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; <span class="keywordflow">return</span> <a class="code" href="group___hough_transform.html#ga611735fba984082c97a3f0c122b709d7">hough_parameter&lt;double&gt;::from_step_size</a>(approx_angle, neighborhood, angle_step);</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;}</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;}} <span class="comment">// namespace boost::gil</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="agroup___hough_transform_html_ga2453e44ea538fce4da49b1a09e63299d"><div class="ttname"><a href="group___hough_transform.html#ga2453e44ea538fce4da49b1a09e63299d">boost::gil::hough_parameter::from_step_count</a></div><div class="ttdeci">static hough_parameter&lt; T &gt; from_step_count(T start_point, T neighborhood, std::size_t half_step_count)</div><div class="ttdoc">Create Hough parameter from value neighborhood and step count.</div><div class="ttdef"><b>Definition:</b> hough_parameter.hpp:38</div></div>
<div class="ttc" id="agroup___hough_transform_html_gaf9c1e143c7c33128efa823f6c193663c"><div class="ttname"><a href="group___hough_transform.html#gaf9c1e143c7c33128efa823f6c193663c">boost::gil::minimum_angle_step</a></div><div class="ttdeci">double minimum_angle_step(point_t dimensions)</div><div class="ttdoc">Calculate minimum angle which would be observable if walked on a circle.</div><div class="ttdef"><b>Definition:</b> hough_parameter.hpp:85</div></div>
<div class="ttc" id="agroup___hough_transform_html_gaf54301aeb8d2a2811db3e1b454bdd99e"><div class="ttname"><a href="group___hough_transform.html#gaf54301aeb8d2a2811db3e1b454bdd99e">boost::gil::make_theta_parameter</a></div><div class="ttdeci">hough_parameter&lt; double &gt; make_theta_parameter(double approx_angle, double neighborhood, point_t dimensions)</div><div class="ttdoc">Create a Hough transform parameter with optimal angle step.</div><div class="ttdef"><b>Definition:</b> hough_parameter.hpp:101</div></div>
<div class="ttc" id="astructboost_1_1gil_1_1hough__parameter_html"><div class="ttname"><a href="structboost_1_1gil_1_1hough__parameter.html">boost::gil::hough_parameter</a></div><div class="ttdoc">A type to encapsulate Hough transform parameter range.</div><div class="ttdef"><b>Definition:</b> hough_parameter.hpp:26</div></div>
<div class="ttc" id="agroup___hough_transform_html_ga611735fba984082c97a3f0c122b709d7"><div class="ttname"><a href="group___hough_transform.html#ga611735fba984082c97a3f0c122b709d7">boost::gil::hough_parameter::from_step_size</a></div><div class="ttdeci">static hough_parameter&lt; T &gt; from_step_size(T start_point, T neighborhood, T step_size)</div><div class="ttdoc">Create Hough parameter from value neighborhood and step size.</div><div class="ttdef"><b>Definition:</b> hough_parameter.hpp:57</div></div>
<div class="ttc" id="aclassboost_1_1gil_1_1point_html"><div class="ttname"><a href="classboost_1_1gil_1_1point.html">boost::gil::point&lt; std::ptrdiff_t &gt;</a></div></div>
<!-- HTML footer for doxygen 1.8.13-->
<!-- start footer part -->
<hr class="footer"/>
<address class="footer">
<small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">doxygen</a> 1.8.17
</small>
</address>
</body>
</html>