NAME

Image::Temperature - Taking temperature of images

SYNOPSIS

use Image::Temperature qw/temperature threshold coefficient/;

print temperature($image);

print threshold;

print coefficient(0.3, 0.59, 0.11);

DESCRIPTION

Yes, the TEMPERATURE. Temperature of an image means an invariant measure for the image, and temperature remains steady in spite of transposition, rotation or scaling. It is (may be/might be/not be) quite interesting to estimate the temperature of your given image.

The temperature of a given image is calculated with this formula: T = 1/log(E/(E-1)). E stands for the expected number of intersection points of the image's curves and a random straight line; T is the absolute temperature. (Surely, don't ask me how we derive this. Refer to this article yourself: The Planck constant of a curve by Michel Mendès France.)

An image is composed of various colorful curves. However, before taking the temperature, the colored image needs to be converted to grayscale. The default conversion formula is 0.3*R + 0.59*G + 0.11*B. If the result is greater than or equal to 127, then the point is considered to be part of the image's curves; otherwise, the background. As to the same image, the lower the threshold, the higher the temperature. Of course, interface is also provided for you to modify the threshold and the coefficients of the conversion formula.

INTERFACE

temperature

Taking the temperature of an image. The parameter can be a GD object or an image file.

print temperature('my_self-portrait');  # an easy number

print temperature($GD_OBJECT);

threshold

Setting the threshold for a point to be considered of the curve.

threshold($value);

If $value is not given, it returns the current threshold.

coeffient

Setting the cofficients of the conversion formula.

coefficient($R, $G, $B);

It returns the current setting if nothing is given.

COPYRIGHT

xern <xern@cpan.org>

This module is free software; you can redistribute it or modify it under the same terms as Perl itself.