1 .\" Title: \fBlqr_carver_set_energy_function\fR
2 .\" Author: Carlo Baldassi
3 .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
5 .\" Manual: LqR library API reference
6 .\" Source: LqR library 0.4.0 API (3:0:3)
8 .TH "\FBLQR_CARVER_SET_ENERGY_FUNCT" "3" "4 Maj 2009" "LqR library 0.4.0 API (3:0:3)" "LqR library API reference"
9 .\" disable hyphenation
11 .\" disable justification (adjust text to left margin only)
14 lqr_carver_bias_set_energy_function \- set a custom energy function for a LqrCarver object
23 .BI "LqrRetVal lqr_carver_set_energy_function(LqrCarver*\ " "carver" ", LqrEnergyFunc\ " "en_func" ", gint\ " "radius" ", LqrEnergyReaderType\ " "reader_type" ", gpointer\ " "extra_data" ");"
27 \fBlqr_carver_set_energy_function\fR
28 assigns the energy function
34 (see below for more details on custom functions definitions)\&.
38 determines the size of the square region which affects the computation around each pixel (the side of the square will be
44 sets the reader type used when reading the image, and therefore it determines what quantity will be passed on to the function
46 (see below for more details on reader types)\&.
50 is a (void) pointer which can be used to pass on additional values to the function
52 .SH "CUSTOM FUNCTIONS DEFINITION"
57 LqrEnergyFunc, whose prototype is defined by:
61 typedef gfloat (*LqrEnergyFunc) (gint x, gint y, gint img_width, gint img_height, LqrReadingWindow * rwindow, gpointer extra_data);
66 Such a function is expected to compute the energy at pixel
69 based on the knowledge of the current image size (obtained from
72 \fIheight\fR) and the content of the image in a square around that pixel, which is passed through the
76 In most cases, the parameters
82 would only be used to determine whether the region under consideration is at the image boundary or not\&.
86 content must be read using the function
87 \fBlqr_rwindow_read\fR(3)\&.
91 \fBLqrEnergyReaderType\fR
92 is an enum which can take these values (also noted is the number of channels of the corresponging reading window):
96 brightness (1 channel)
111 read the normalised image channels as they are (as many channels as the image has)
113 These readouts always return values beetween
118 Note that these readouts may have special meanings depending on the image type:
121 \h'-04'\(bu\h'+03'for
128 readout will yield the same result as
133 \h'-04'\(bu\h'+03'for
137 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\&.
141 \h'-04'\(bu\h'+03'for
146 \fIcannot be used\fR: it will always return
153 The return value follows the Liquid Rescale library signalling system\&.
157 \fBlqr_carver_set_energy_function_builtin\fR(3), \fBlqr_carver_get_energy\fR(3), \fBlqr_rwindow_read\fR(3), \fBlqr_rwindow_get_read_t\fR(3), \fBlqr_rwindow_get_radius\fR(3), \fBlqr_rwindow_get_channels\fR(3)
159 Copyright \(co 2007-2009 Carlo Baldassi