/usr/share/doc/liblqr-1-0-dev/html/bias.html is in liblqr-1-0-dev 0.4.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Adding a bias</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Liquid Rescale library Manual"><link rel="up" href="api-manual.html" title="Chapter 2. LqR library API user manual"><link rel="prev" href="energy.html" title="Automatic feature detection"><link rel="next" href="rigmask.html" title="Adding a rigidity mask"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Adding a bias</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="energy.html">Prev</a> </td><th width="60%" align="center">Chapter 2. LqR library API user manual</th><td width="20%" align="right"> <a accesskey="n" href="rigmask.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="bias"></a>Adding a bias</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="bias.html#bias-foreword">Foreword</a></span></dt><dt><span class="sect2"><a href="bias.html#bias-xy">Adding a bias pixel by pixel</a></span></dt><dt><span class="sect2"><a href="bias.html#bias-float">Using an array of floating-point values</a></span></dt><dt><span class="sect2"><a href="bias.html#bias-rgb">Using another image</a></span></dt><dt><span class="sect2"><a href="bias.html#bias-areas">Operating on a specific area</a></span></dt></dl></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="bias-foreword"></a>Foreword</h3></div></div></div><p>
The automatic feature detection can be driven manually by adding a bias to the pixels of the image.
</p><p>
For example, it is possible to protect regions of the image by adding a positive bias to the
corresponding pixels. This will make the seams more unlikely to cross those regions, thus avoiding
distortion (but increasing distortion of the other regions).
</p><p>
It is also possible to make the seams more likely to cross some regions by adding a negative bias to
them. In this case, reducing the size of the image will tend to erase those regions, while
(possibly) keeping the rest of the image in a consistent state.
</p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>
The bias has to be added before the resizing takes place (but it can be added before
initialisation since version 0.4).
</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
In all of the bias-related functions, the bias is added on top of the existing one, so that all
of the functions can be called multiple times.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="bias-xy"></a>Adding a bias pixel by pixel</h3></div></div></div><p>
The function to use in order to add a bias to a given pixel is:
</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">LqrRetVal <b class="fsfunc">lqr_carver_bias_add_xy</b>(</code></td><td>LqrCarver* <var class="pdparam">carver</var>, </td></tr><tr><td> </td><td>gdouble <var class="pdparam">bias</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">x</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">y</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>
Typical values for the <em class="parameter"><code>bias</code></em> parameter would be between <code class="literal">100</code>
and <code class="literal">10000</code> in module.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="bias-float"></a>Using an array of floating-point values</h3></div></div></div><p>
It is possible to use a whole array of floating points at once through this function:
</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">LqrRetVal <b class="fsfunc">lqr_carver_bias_add</b>(</code></td><td>LqrCarver* <var class="pdparam">carver</var>, </td></tr><tr><td> </td><td>gdouble* <var class="pdparam">buffer</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">bias_factor</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>
</p><p>
Here, <em class="parameter"><code>buffer</code></em> is an array contining the bias values, and it is assumed to have
the same size as the image loaded in <em class="parameter"><code>carver</code></em>, while
<em class="parameter"><code>bias_factor</code></em> is an overall bias factor, which can be used to affect the global
bias level: if the elements of <em class="parameter"><code>buffer</code></em> are of order 1, a standard choice for
the bias_factor would be between <code class="literal">100</code> and <code class="literal">10000</code> (in module).
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
This function, and all the following, will not swallow the buffer (to the contrary of what
happens e.g. when creating a new <code class="classname">LqrCarver</code> object and allowing the default behaviour),
therefore the buffer must be freed by the user afterwards.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="bias-rgb"></a>Using another image</h3></div></div></div><p>
The bias can also be read from an 8-bit rgb buffer. This buffer has to be in the same format as the
one used in the 8-bit LqrCarver constructor (but may have a different number of colours per
channel). The function is:
</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">LqrRetVal <b class="fsfunc">lqr_carver_bias_add_rgb</b>(</code></td><td>LqrCarver* <var class="pdparam">carver</var>, </td></tr><tr><td> </td><td>guchar* <var class="pdparam">buffer</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">bias_factor</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">channels</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>
</p><p>
As in the previous case, <em class="parameter"><code>buffer</code></em> is assumed to hold and image of the same size
as the one in the <em class="parameter"><code>carver</code></em>.
</p><p>
The <em class="parameter"><code>buffer</code></em> contents will be transformed into floating-points by averaging the
colour components and multiplying the result by the alpha channel (transparency) value.
</p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>
The existence of an alpha channel is inferred from the <em class="parameter"><code>channels</code></em> value: if
this is 1 or 3, no alpha channel is assumed, if it is 2 or 4 or greater, it is assumed that the
last channel holds the alpha value. If this is not what you want, you should resort to one of
the previous methods.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="bias-areas"></a>Operating on a specific area</h3></div></div></div><p>
The two previously described functions operate on the whole <code class="classname">LqrCarver</code> image. It is also possible
to access specific image regions in a similar way; for the floating point case use:
</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">LqrRetVal <b class="fsfunc">lqr_carver_bias_add_area</b>(</code></td><td>LqrCarver* <var class="pdparam">carver</var>, </td></tr><tr><td> </td><td>gdouble* <var class="pdparam">buffer</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">bias_factor</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">width</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">height</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">x_off</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">y_off</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>
while for the rgb image case use:
</p><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">LqrRetVal <b class="fsfunc">lqr_carver_bias_add_rgb_area</b>(</code></td><td>LqrCarver* <var class="pdparam">carver</var>, </td></tr><tr><td> </td><td>guchar* <var class="pdparam">buffer</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">bias_factor</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">channels</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">width</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">height</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">x_off</var>, </td></tr><tr><td> </td><td>gint <var class="pdparam">y_off</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>
</p><p>
In both functions, <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> are used to specify the size of the area of interest,
while <em class="parameter"><code>x_off</code></em> and <em class="parameter"><code>y_off</code></em> specify its offset. For the
rest, both functions work in the same way as their global couterpart.
</p><p>
The provided buffers have to be of size <code class="literal"><em class="parameter"><code>width</code></em> * <em class="parameter"><code>height</code></em></code> (or
<code class="literal"><em class="parameter"><code>width</code></em> * <em class="parameter"><code>height</code></em> * <em class="parameter"><code>channels</code></em></code> for the rgb case) but the specified
areas need not to be strictly included inside the <code class="classname">LqrCarver</code> image area: only the parts which
overlap with it will be used. For example, the offsets can also be negative.
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="energy.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="api-manual.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="rigmask.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Automatic feature detection </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Adding a rigidity mask</td></tr></table></div></body></html>
|