lqr_carver_rigmask_add_area, lqr_carver_rigmask_add, lqr_carver_rigmask_add_rgb_area, lqr_carver_rigmask_add_rgb — update an LqrCarver
rigidity mask
#include <lqr.h>
LqrRetVal lqr_carver_rigmask_add_area( | LqrCarver* carver, |
gdouble* buffer, | |
gint width, | |
gint height, | |
gint x_off, | |
gint y_off) ; |
LqrRetVal lqr_carver_rigmask_add( | LqrCarver* carver, |
gdouble* buffer) ; |
LqrRetVal lqr_carver_rigmask_add_area( | LqrCarver* carver, |
gdouble* buffer, | |
gint channels, | |
gint width, | |
gint height, | |
gint x_off, | |
gint y_off) ; |
LqrRetVal lqr_carver_rigmask_add_rgb( | LqrCarver* carver, |
gdouble* buffer, | |
gint channels) ; |
The function lqr_carver_rigmask_add_area
adds a rigidity mask to an
area of the image loaded in the LqrCarver
object pointed to by
carver
. Adding a positive rigidity to an area
will give a bias towards straighter seams (in the transversal direction with respect to the
rescaling direction), if they happen to cross that area.
This function must be called after lqr_carver_init
and before lqr_carver_resize
.
The parameter buffer
must point to an array of doubles
of size
,
ordered first by rows, then by columns.
width
* height
The offset of the area relative to the image are specified through
x_off
and y_off
.
The rigidity mask area can exceed the boundary of the image, and the offsets can be negative.
The values in the given buffer
are scaled by the overall
rigidity
value set when calling the function
lqr_carver_init
.
Note that using no rigidity masks at all is equivalent to use a rigidity mask over the whole
image with all the values set to 1.0
, but, when first adding a rigidity
mask to a LqrCarver
object, all the pixels outside the affected area will have their
rigidity set to zero; therefore, the function
lqr_carver_rigmask_add_area
actually affects the whole image, despite its name.
The function lqr_carver_rigmask_add
can be used when the area
to add is of the same size of the image loaded in the LqrCarver
object and the
offsets are 0
.
The functions lqr_carver_rigmask_add_rgb_area
and
lqr_carver_rigmask_add_rgb
are very similar to
lqr_carver_rigmask_add_area
and
lqr_carver_rigmask_add
, but use 8-bit multi-channel
images as inputs.
The number of channels in the image is passed via the parameter
channels
. The last channel is assumed to be the alpha
(opacity) channel if channels
is equal to 2
or greater than 3
(if this is not the case, use the previous
functions).
The rigidity value is computed from the average of the colour channels, multiplied by the
value of the alpha channel if present. For example, in RGBA images a white,
nontransparent pixel is equivalent to a value of 1.0
when using
a buffer in lqr_carver_rigmask_add_area
.