---
name: "lqr_carver_bias_add_rgb"
section: "3"
platform: "linux"
package: "liblqr-1-0-dev"
version: "0.4.1-2"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/lqr_carver_bias_add_xy"
---

# lqr\_carver\_bias\_add\_rgb(3)

update an LqrCarver bias

Part of [lqr\_carver\_bias\_add\_xy(3)](/lqr_carver_bias_add_xy/3.md).

## NAME

lqr\_carver\_bias\_add\_xy, lqr\_carver\_bias\_add\_area, lqr\_carver\_bias\_add, lqr\_carver\_bias\_add\_rgb\_area, lqr\_carver\_bias\_add\_rgb - update an LqrCarver bias

## SYNOPSIS

```
#include <lqr.h>
```

**LqrRetVal lqr\_carver\_bias\_add\_xy(LqrCarver\*** *carver***, gdouble** *bias***, gint** *x***, gint** *y***);**

**LqrRetVal lqr\_carver\_bias\_add\_area(LqrCarver\*** *carver***, gdouble\*** *buffer***, gint** *bias\_factor***, gint** *width***, gint** *height***, gint** *x\_off***, gint** *y\_off***);**

**LqrRetVal lqr\_carver\_bias\_add(LqrCarver\*** *carver***, gdouble\*** *buffer***, gint** *bias\_factor***);**

**LqrRetVal lqr\_carver\_bias\_add\_rgb\_area(LqrCarver\*** *carver***, gdouble\*** *buffer***, gint** *bias\_factor***, gint** *channels***, gint** *width***, gint** *height***, gint** *x\_off***, gint** *y\_off***);**

**LqrRetVal lqr\_carver\_bias\_add\_rgb(LqrCarver\*** *carver***, gdouble\*** *buffer***, gint** *bias\_factor***, gint** *channels***);**

## FOREWORD

All the functions described in this page are used to add a bias to LqrCarver objects. A positive biased pixel will be more likely to be avoided by seams, and thus be preserved during rescaling, while a negative bias has the opposite effect.

All of these functions must be called before [**lqr\_carver\_resize**(3)](/lqr_carver_resize/3.md). If called multiple times, the biases added at each call will sum up.

## ADDING A BIAS PIXEL BY PIXEL

The function **lqr\_carver\_bias\_add\_xy** adds a bias to the *x*, *y* pixel of the image loaded into the LqrCarver object pointed to by *carver*

A typical value for *bias\_factor* would be 1000 (in absolute value).

## ADDING A BIAS FROM A BUFFER

The function **lqr\_carver\_bias\_add\_area** adds a bias to an area of the image loaded into the LqrCarver object pointed to by *carver*.

The parameter *buffer* must point to an array of **doubles** of size *width* \* *height*, ordered first by rows, then by columns.

The offset of the area relative to the image can be specified through *x\_off* and *y\_off*. The bias area can exceed the boundary of the image, and the offsets can be negative.

The parameter *bias\_factor* is an overall bias scale. A typical value when the buffer contents are of the order of 1 would be 1000 (in absolute value).

The function **lqr\_carver\_bias\_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.

## ADDING A BIAS FROM AN IMAGE

The functions **lqr\_carver\_bias\_add\_rgb\_area** and **lqr\_carver\_bias\_add\_rgb** are very similar to **lqr\_carver\_bias\_add\_area** and **lqr\_carver\_bias\_add**, except that they 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 bias 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\_bias\_add\_area**.

## RETURN VALUES

The return values follow the Liquid Rescale library signalling system.

## SEE ALSO

[**LqrRetVal**(3)](/LqrRetVal/3.md), [**lqr\_carver\_init**(3)](/lqr_carver_init/3.md), [**lqr\_carver\_rigmask\_add**(3)](/lqr_carver_rigmask_add/3.md)

## COPYRIGHT

Copyright © 2007-2009 Carlo Baldassi\
