⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.74
Server IP:
104.21.16.1
Server:
Linux vmi2315822.contaboserver.net 5.15.0-134-generic #145-Ubuntu SMP Wed Feb 12 20:08:39 UTC 2025 x86_64
Server Software:
LiteSpeed
PHP Version:
8.3.21
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
liblqr-1-0-dev
/
html
/
View File Name :
ref-lqr-carver-set-energy-function.html
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>lqr_carver_set_energy_function</title><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="The Liquid Rescale library Manual"><link rel="up" href="ref-energy.html" title="Energy"><link rel="prev" href="ref-lqr-carver-set-energy-function-builtin.html" title="lqr_carver_set_energy_function_builtin"><link rel="next" href="ref-lqr-carver-get-energy.html" title="lqr_carver_get_energy"></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"><code class="function">lqr_carver_set_energy_function</code></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref-lqr-carver-set-energy-function-builtin.html">Prev</a>�</td><th width="60%" align="center">Energy</th><td width="20%" align="right">�<a accesskey="n" href="ref-lqr-carver-get-energy.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="ref-lqr-carver-set-energy-function"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>lqr_carver_bias_set_energy_function — set a custom energy function for a <code class="classname">LqrCarver</code> object</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <lqr.h></pre><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_set_energy_function</b>(</code></td><td>LqrCarver* <var class="pdparam">carver</var>, </td></tr><tr><td>�</td><td>LqrEnergyFunc <var class="pdparam">en_func</var>, </td></tr><tr><td>�</td><td>gint <var class="pdparam">radius</var>, </td></tr><tr><td>�</td><td>LqrEnergyReaderType <var class="pdparam">reader_type</var>, </td></tr><tr><td>�</td><td>gpointer <var class="pdparam">extra_data</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">�</div></div></div><div class="refsect1"><a name="idm4323"></a><h2>Description</h2><p> The function <code class="function">lqr_carver_set_energy_function</code> assigns the energy function <em class="parameter"><code>en_func</code></em> to the <code class="classname">LqrCarver</code> object pointed to by <em class="parameter"><code>carver</code></em> (see below for more details on custom functions definitions). </p><p> The parameter <em class="parameter"><code>radius</code></em> determines the size of the square region which affects the computation around each pixel (the side of the square will be <code class="literal">2 * <em class="parameter"><code>radius</code></em> + 1</code> pixels long). </p><p> The parameter <em class="parameter"><code>reader_type</code></em> sets the reader type used when reading the image, and therefore it determines what quantity will be passed on to the function <em class="parameter"><code>en_func</code></em> (see below for more details on reader types). </p><p> The parameter <em class="parameter"><code>extra_data</code></em> is a (void) pointer which can be used to pass on additional values to the function <em class="parameter"><code>ef_func</code></em>. </p></div><div class="refsect1"><a name="idm4340"></a><h2>Custom functions definition</h2><p> The function <em class="parameter"><code>en_func</code></em> must be of type <code class="classname">LqrEnergyFunc</code>, whose prototype is defined by: </p><pre class="programlisting"> typedef gfloat (*LqrEnergyFunc) (gint x, gint y, gint img_width, gint img_height, LqrReadingWindow * rwindow, gpointer extra_data); </pre><p> Such a function is expected to compute the energy at pixel <em class="parameter"><code>x</code></em>, <em class="parameter"><code>y</code></em> based on the knowledge of the current image size (obtained from <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em>) and the content of the image in a square around that pixel, which is passed through the <em class="parameter"><code>rwindow</code></em> reading window. </p><p> In most cases, the parameters <em class="parameter"><code>x</code></em>, <em class="parameter"><code>y</code></em>, <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> would only be used to determine whether the region under consideration is at the image boundary or not. </p><p> The <em class="parameter"><code>rwindow</code></em> content must be read using the function <a class="xref" href="ref-lqr-rwindow-read.html" title="lqr_rwindow_read"><span class="refentrytitle"><code class="function">lqr_rwindow_read</code></span>(3)</a>. </p></div><div class="refsect1"><a name="idm4359"></a><h2>Reader types</h2><p> The <span class="type"><code class="literal">LqrEnergyReaderType</code></span> is an enum which can take these values (also noted is the number of channels of the corresponging reading window): </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">LQR_ER_BRIGHTNESS</code></span></dt><dd><p> brightness (1 channel) </p></dd><dt><span class="term"><code class="literal">LQR_ER_BRIGHTNESS</code></span></dt><dd><p> luma (1 channel) </p></dd><dt><span class="term"><code class="literal">LQR_ER_RGBA</code></span></dt><dd><p> RGBA (4 channels) </p></dd><dt><span class="term"><code class="literal">LQR_ER_CUSTOM</code></span></dt><dd><p> read the normalised image channels as they are (as many channels as the image has) </p></dd></dl></div><p> These readouts always return values beetween <code class="literal">0</code> and <code class="literal">1</code>. </p><p> Note that these readouts may have special meanings depending on the image type: </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p> for <code class="literal">LQR_GREY_IMAGE</code>, <code class="literal">LQR_GREYA_IMAGE</code> and <code class="literal">LQR_CUSTOM_IMAGE</code> images, the <code class="literal">LQR_ER_LUMA</code> readout will yield the same result as <code class="literal">LQR_ER_BRIGHTNESS</code> </p></li><li class="listitem"><p> for <code class="literal">LQR_CUSTOM_IMAGE</code> images, the <code class="literal">LQR_ER_BRIGHTNESS</code> readout will return the average pixel value (additive, i.e. if a black channel is present the channel values will be inverted and multiplied by the black channel inverse), multiplied by the alpha channel value. </p></li><li class="listitem"><p> for <code class="literal">LQR_CUSTOM_IMAGE</code> images, the <code class="literal">LQR_ER_RGBA</code> readout <span class="emphasis"><em>cannot be used</em></span>: it will always return <code class="literal">0</code> </p></li></ul></div><p> </p></div><div class="refsect1"><a name="idm4406"></a><h2>Return value</h2><p> The return value follows the Liquid Rescale library signalling system. </p></div><div class="refsect1"><a name="idm4409"></a><h2>See also</h2><p> <span class="simplelist"><a class="xref" href="ref-lqr-carver-set-energy-function-builtin.html" title="lqr_carver_set_energy_function_builtin"><span class="refentrytitle"><code class="function">lqr_carver_set_energy_function_builtin</code></span>(3)</a>, <a class="xref" href="ref-lqr-carver-get-energy.html" title="lqr_carver_get_energy"><span class="refentrytitle"><code class="function">lqr_carver_get_energy</code></span>(3)</a>, <a class="xref" href="ref-lqr-rwindow-read.html" title="lqr_rwindow_read"><span class="refentrytitle"><code class="function">lqr_rwindow_read</code></span>(3)</a>, <a class="xref" href="ref-lqr-rwindow-get-read-t.html" title="lqr_rwindow_get_read_t"><span class="refentrytitle"><code class="function">lqr_rwindow_get_read_t</code></span>(3)</a>, <a class="xref" href="ref-lqr-rwindow-get-radius.html" title="lqr_rwindow_get_radius"><span class="refentrytitle"><code class="function">lqr_rwindow_get_radius</code></span>(3)</a>, <a class="xref" href="ref-lqr-rwindow-get-channels.html" title="lqr_rwindow_get_channels"><span class="refentrytitle"><code class="function">lqr_rwindow_get_channels</code></span>(3)</a></span> </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ref-lqr-carver-set-energy-function-builtin.html">Prev</a>�</td><td width="20%" align="center"><a accesskey="u" href="ref-energy.html">Up</a></td><td width="40%" align="right">�<a accesskey="n" href="ref-lqr-carver-get-energy.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><code class="function">lqr_carver_set_energy_function_builtin</code>�</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">�<code class="function">lqr_carver_get_energy</code></td></tr></table></div></body></html>