=head1 NAME

puzzle_set_max_width, puzzle_set_max_height, puzzle_set_lambdas, puzzle_set_p_ratio, puzzle_set_noise_cutoff, puzzle_set_contrast_barrier_for_cropping, puzzle_set_max_cropping_ratio, puzzle_set_autocrop - set tunables for libpuzzle functions

=head1 SYNOPSIS

#include <puzzle.h>

int puzzle_set_max_width(PuzzleContext *I<context>, unsigned int I<width>);

int puzzle_set_max_height(PuzzleContext *I<context>, unsigned int I<height>);

int puzzle_set_lambdas(PuzzleContext *I<context>, unsigned int I<lambdas>);

int puzzle_set_p_ratio(PuzzleContext *I<context>, double I<p_ratio>);

int puzzle_set_noise_cutoff(PuzzleContext *I<context>, double I<noise_cutoff>);

int puzzle_set_contrast_barrier_for_cropping(PuzzleContext *I<context>, double I<barrier>);

int puzzle_set_max_cropping_ratio(PuzzleContext *I<context>, double I<ratio>);

int puzzle_set_autocrop(PuzzleContext *I<context>, int I<enable>);

=head1 DESCRIPTION

While default values have been chosen to be ok for most people, the B<puzzle_set_*()> functions are knobs to fit the algorithm to your set of data and to your applications.

=head1 LAMBDAS

By default, pictures are divided in 9 x 9 blocks.

I<9> is the I<lambdas> value, and it can be changed with B<puzzle_set_lambdas()>.

For large databases, for complex images, for images with a lot of text or for sets of near-similar images, it might be better to raise that value to I<11> or even I<13>.

However, raising that value obviously means that vectors will require more storage space.

The I<lambdas> value should remain the same in order to get comparable vectors. So if you pick I<11> (for instance), you should always use that value for all pictures you will compute a digest for B<puzzle_set_p_ratio()>.

The average intensity of each block is based upon a small centered zone.

The I<"p ratio"> determines the size of that zone. The default is 2.0, and that ratio mimics the behavior that is described in the reference algorithm.

For very specific cases (complex images) or if you get too many false positives, as an alternative to increasing lambdas, you can try to lower that value, for instance to I<1.5>.

The lowest acceptable value is I<1.0>.

=head1 MAXIMUM SIZES

In order to avoid CPU starvation, pictures won't be processed if their width or height is larger than 3000 pixels.

These limits are rather large, but if you ever need to change them, the B<puzzle_set_max_width()> and B<puzzle_set_max_height()> are available.

=head1 NOISE CUTOFF

The noise cutoff defaults to 2. If you raise that value, more zones with little difference of intensity will be considered as similar.

Unless you have very specialized sets of pictures, you probably don't want to change this.

=head1 AUTOCROP

By default, featureless borders of the original image are ignored. The size of each border depends on the sum of absolute values of differences between adjacent pixels, relative to the total sum.

That feature can be disabled with B<puzzle_set_autocrop(0)>, any other value will enable it.

B<puzzle_set_contrast_barrier_for_cropping()> changes the tolerance. The default value is 5. Less shaves less, more shaves more.

B<puzzle_set_max_cropping_ratio()> : this is a safe-guard against unwanted excessive auto-cropping.

The default (0.25) means that no more than 25% of the total width (or height) will ever be shaved.

=head1 RETURN VALUE

Functions return I<0> on success, and I<-1> if something went wrong.

=head1 AUTHORS

Frank DENIS libpuzzle at pureftpd dot org

=head1 SEE ALSO

L<libpuzzle(3)>, L<puzzle-diff(8)>

=cut
