mirror of
https://github.com/boostorg/gil.git
synced 2026-01-19 16:22:14 +00:00
114 lines
6.3 KiB
HTML
114 lines
6.3 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/html; charset=utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<title>Create a histogram - Boost.GIL documentation</title>
|
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
|
<link rel="stylesheet" href="../_static/style.css" type="text/css" />
|
|
<script type="text/javascript">
|
|
var DOCUMENTATION_OPTIONS = {
|
|
URL_ROOT: '../',
|
|
VERSION: '',
|
|
COLLAPSE_MODINDEX: false,
|
|
FILE_SUFFIX: '.html'
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="../_static/documentation_options.js"></script>
|
|
<script type="text/javascript" src="../_static/doctools.js"></script>
|
|
<script type="text/javascript" src="../_static/sphinx_highlight.js"></script>
|
|
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
|
<script src="../_static/searchtools.js"></script>
|
|
<script src="../_static/language_data.js"></script>
|
|
<link rel="index" title="Index" href="../genindex.html" />
|
|
<link rel="search" title="Search" href="../search.html" />
|
|
<link rel="top" title="Boost.GIL documentation" href="../index.html" />
|
|
<link rel="up" title="Histogram" href="index.html" />
|
|
<link rel="next" title="Fill histogram" href="fill.html" />
|
|
<link rel="prev" title="Overview" href="overview.html" />
|
|
</head>
|
|
<body>
|
|
<div class="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="C++ Boost" src="../../_static/gil.png" border="0"></a></h3>
|
|
</td>
|
|
<td >
|
|
<h1 align="center"><a href="../index.html"></a></h1>
|
|
</td>
|
|
<td>
|
|
<div id="searchbox" style="display: none">
|
|
<form class="search" action="../search.html" method="get">
|
|
<input type="text" name="q" size="18" />
|
|
<input type="submit" value="Search" />
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
<input type="hidden" name="area" value="default" />
|
|
</form>
|
|
</div>
|
|
<script type="text/javascript">$('#searchbox').show(0);</script>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<hr/>
|
|
<div class="content">
|
|
<div class="navbar" style="text-align:right;">
|
|
|
|
|
|
<a class="prev" title="Overview" href="overview.html"><img src="../_static/prev.png" alt="prev"/></a>
|
|
<a class="up" title="Histogram" href="index.html"><img src="../_static/up.png" alt="up"/></a>
|
|
<a class="next" title="Fill histogram" href="fill.html"><img src="../_static/next.png" alt="next"/></a>
|
|
|
|
</div>
|
|
|
|
<section id="create-a-histogram">
|
|
<span id="create-histogram"></span><h1>Create a histogram<a class="headerlink" href="#create-a-histogram" title="Link to this heading">¶</a></h1>
|
|
<p><strong>Method 1</strong> - Using the histogram constructor</p>
|
|
<p>Syntax:</p>
|
|
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="n">histogram</span><span class="o"><</span><span class="n">Type1</span><span class="p">,</span><span class="w"> </span><span class="n">Type2</span><span class="p">,</span><span class="w"> </span><span class="n">Type3</span><span class="p">,...</span><span class="w"> </span><span class="n">TypeN</span><span class="o">></span>
|
|
</pre></div>
|
|
</div>
|
|
<p><code class="docutils literal notranslate"><span class="pre">Type1</span></code> .. <code class="docutils literal notranslate"><span class="pre">TypeN</span></code> correspond to the axis type of the N axes in the histogram</p>
|
|
<p>Example: If we want a 3D histogram of Axis1 of type <code class="docutils literal notranslate"><span class="pre">int</span></code>, Axis2 of type <code class="docutils literal notranslate"><span class="pre">float</span></code> and Axis3 of type <code class="docutils literal notranslate"><span class="pre">std::string</span></code>
|
|
we would do it this way:</p>
|
|
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="n">histogram</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span><span class="w"> </span><span class="kt">float</span><span class="p">,</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></span><span class="w"> </span><span class="n">h</span><span class="p">;</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>And done.</p>
|
|
<p><strong>Method 2</strong> (TODO) - Using make_histogram()</p>
|
|
<p>There is an alternative to create the histogram directly from
|
|
a GIL image view.</p>
|
|
<p>This should be the preferred over method-1 when creating
|
|
histogram with GIL images, since it creates a histogram with axes configured
|
|
to match the GIL image.</p>
|
|
<p>Also it is easier than method-1.</p>
|
|
<p>Syntax:</p>
|
|
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="k">auto</span><span class="w"> </span><span class="n">h</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">make_histogram</span><span class="p">(</span><span class="n">view</span><span class="p">(</span><span class="n">image</span><span class="p">));</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>where <code class="docutils literal notranslate"><span class="pre">image</span></code> could be a <code class="docutils literal notranslate"><span class="pre">gray8_image_t</span></code>/<code class="docutils literal notranslate"><span class="pre">rgb8_image_t</span></code> object read from source.</p>
|
|
</section>
|
|
|
|
|
|
<div class="navbar" style="text-align:right;">
|
|
|
|
|
|
<a class="prev" title="Overview" href="overview.html"><img src="../_static/prev.png" alt="prev"/></a>
|
|
<a class="up" title="Histogram" href="index.html"><img src="../_static/up.png" alt="up"/></a>
|
|
<a class="next" title="Fill histogram" href="fill.html"><img src="../_static/next.png" alt="next"/></a>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="footer" role="contentinfo">
|
|
Last updated on 2025-12-11 07:12:45.
|
|
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 7.2.6.
|
|
</div>
|
|
</body>
|
|
</html> |