lqr_carver_set_side_switch_frequency(3) set LqrCarver object side switch frequency


#include <lqr.h>

void lqr_carver_set_side_switch_frequency(LqrCarver* carver, guint switch_frequency);


When the function lqr_carver_resize(3) is invoked, it computes a relevance value for each pixel in the image, then chooses the optimal seam to carve based on such relvance values. However, in the case two seams are equivalent (which may happen when large portions of the image have the same colour, for example), the algorithm always chooses the seams from one side.

In order to overcome this effect, an option is given to automatically switch the favoured side during rescaling, at the cost of a slightly worse performance.

The function lqr_carver_set_side_switch_frequency sets the side switch frequency to switch_frequency for the LqrCarver object pointed to by carver. This will have the effect that, for each rescale operation, the favoured side will be switched switch_frequency times (or as much times as the number of pixels to rescale).

The default value for newly created LqrCarver objects is 0.

As for the final result, a very small value (e.g. 1 to 4) will normally suffice to balance the left and right side of the image (or the top and the boddom sides for vertical rescalings), without noticeable computational costs. However, in order to obtain a smoother behaviour for the visibiliy map, i.e. for the intermediate steps, higher values may be required.


Copyright © 2007-2009 Carlo Baldassi