Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

lqr_carver_bias_set_energy_function(3) [debian man page]

LQR_CARVER_SET_ENERGY_FUNCT(3)				     LqR library API reference				    LQR_CARVER_SET_ENERGY_FUNCT(3)

NAME
lqr_carver_bias_set_energy_function - set a custom energy function for a LqrCarver object SYNOPSIS
#include <lqr.h> LqrRetVal lqr_carver_set_energy_function(LqrCarver* carver, LqrEnergyFunc en_func, gint radius, LqrEnergyReaderType reader_type, gpointer extra_data); DESCRIPTION
The function lqr_carver_set_energy_function assigns the energy function en_func to the LqrCarver object pointed to by carver (see below for more details on custom functions definitions). The parameter radius determines the size of the square region which affects the computation around each pixel (the side of the square will be 2 * radius + 1 pixels long). The parameter reader_type sets the reader type used when reading the image, and therefore it determines what quantity will be passed on to the function en_func (see below for more details on reader types). The parameter extra_data is a (void) pointer which can be used to pass on additional values to the function ef_func. CUSTOM FUNCTIONS DEFINITION
The function en_func must be of type LqrEnergyFunc, whose prototype is defined by: typedef gfloat (*LqrEnergyFunc) (gint x, gint y, gint img_width, gint img_height, LqrReadingWindow * rwindow, gpointer extra_data); Such a function is expected to compute the energy at pixel x, y based on the knowledge of the current image size (obtained from width and height) and the content of the image in a square around that pixel, which is passed through the rwindow reading window. In most cases, the parameters x, y, width and height would only be used to determine whether the region under consideration is at the image boundary or not. The rwindow content must be read using the function lqr_rwindow_read(3). READER TYPES
The LqrEnergyReaderType is an enum which can take these values (also noted is the number of channels of the corresponging reading window): LQR_ER_BRIGHTNESS brightness (1 channel) LQR_ER_BRIGHTNESS luma (1 channel) LQR_ER_RGBA RGBA (4 channels) LQR_ER_CUSTOM read the normalised image channels as they are (as many channels as the image has) These readouts always return values beetween 0 and 1. Note that these readouts may have special meanings depending on the image type: o for LQR_GREY_IMAGE, LQR_GREYA_IMAGE and LQR_CUSTOM_IMAGE images, the LQR_ER_LUMA readout will yield the same result as LQR_ER_BRIGHTNESS o for LQR_CUSTOM_IMAGE images, the LQR_ER_BRIGHTNESS 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. o for LQR_CUSTOM_IMAGE images, the LQR_ER_RGBA readout cannot be used: it will always return 0 RETURN VALUE
The return value follows the Liquid Rescale library signalling system. SEE ALSO
lqr_carver_set_energy_function_builtin(3), lqr_carver_get_energy(3), lqr_rwindow_read(3), lqr_rwindow_get_read_t(3), lqr_rwindow_get_radius(3), lqr_rwindow_get_channels(3) COPYRIGHT
Copyright (C) 2007-2009 Carlo Baldassi LqR library 0.4.1 API (3:1:3) 10 Maj 2009 LQR_CARVER_SET_ENERGY_FUNCT(3)

Check Out this Related Man Page

LQR_CARVER_GET_ENERGY(3)				     LqR library API reference					  LQR_CARVER_GET_ENERGY(3)

NAME
lqr_carver_get_energy, lqr_carver_get_true_energy, lqr_carver_get_energy_image - get the energy map for a LqrCarver object SYNOPSIS
#include <lqr.h> LqrRetVal lqr_carver_get_energy(LqrCarver* carver, gfloat * buffer, gint orientation); SYNOPSIS
#include <lqr.h> LqrRetVal lqr_carver_get_true_energy(LqrCarver* carver, gfloat * buffer, gint orientation); SYNOPSIS
#include <lqr.h> LqrRetVal lqr_carver_get_energy(LqrCarver* carver, void * buffer, gint orientation, LqrColDepth col_depth, LqrImageType image_type); DESCRIPTION
The function lqr_carver_get_energy writes the energy map of the LqrCarver object pointed to by carver to the given buffer, in a format suitable for plotting: all values are in the range between 0 and 1, and the true values are mapped nonlinearly and stretched on this whole range, so that the differences between the middle values are enhanced with respect to very high or very low values. The orientation parameter must be either 0 to get the energy map used for horizontal scalings, or 1 to get the map for vertical scalings. The buffer must be allocated by the user before calling this function, and its size must be at least width * height, where width and height are the current width and height of the carver. The energy values are ordered by row first, then by column. The outcome will include the effect of the bias added to the carver, if any. This function can be called over non-initialised LqrCarver objects, e.g. to provide previews on the effect of different energy functions, but it can also be invoked at any later time. Note, however, that in this latter case the carver could be flattened if necessary, therefore the function invocation is potentially destructive of the internal visibiliy map. The function lqr_carvet_get_true_energy is identical to the previous one, but the resulting buffer will contain the true energy, not scaled nor shifted. The function lqr_carver_get_energy_image is very similar to the function lqr_carveR_get_energy, but it can be used to fill directly an image buffer of the format specified through the additional parameters col_depth and image_type (see LqrColDepth(3) and LqrImageType(3)). The buffer must be passed as void*, but it must point to a memory area with sufficient allocated space for the chosen image type and colour depth. The image type cannot be LQR_CUSTOM_IMAGE. For any choice of the parameters describing the image, the resulting buffer will hold a greyscale image, ranging from black (lowest energy) to white (highest energy). The opacity (alpha) will be set to 1, if present. All the information will be stored in the black channel in LQR_CMYK_IMAGE and LQR_CMYKA_IMAGE image types. RETURN VALUES
The return values follow the Liquid Rescale library signalling system. The function lqr_carver_get_energy_image will return an error if image_type is LQR_CUSTOM_IMAGE. SEE ALSO
lqr_carver_set_energy_function_builtin(3), lqr_carver_set_energy_function(3), lqr_carver_bias_add(3) COPYRIGHT
Copyright (C) 2007-2009 Carlo Baldassi LqR library 0.4.1 API (3:1:3) 10 Maj 2009 LQR_CARVER_GET_ENERGY(3)
Man Page