Image::Photo - Functions for sampling simple Photographic images
Photographic lens correction.
An extension of the Image::RGBA suitable for sampling photographic images
Provided is optional radial luminance correction - Suitable for sampling photographs where there is a known light falloff from the centre of the image to the edges.
Also radial lens distortion can be corrected at the same time.
You can start by creating an Image::Magick object:
my $input = new Image::Magick; $input->Read ('input.jpg');
Use an Image::Magick object as the basis of an Image::Photo object:
my $rgba = new Image::Photo (sample => 'linear', radlum => 0, image => $input, a => 0.0, b => -0.2, c => 0.0);
The parameters 'sample', 'radlum', 'a', 'b' and 'c' are quality settings (see descriptions below).
Now you can retrieve a string representing the RGBA pixel values of any point in the original image:
$values = $rgba->Pixel (20.2354, 839.6556);
Additionally, you can write RGBA pixel values directly to an image by appending the values that need to be written:
$rgba->Pixel (22, 845, $values);
Note that locations for writing need to be integer values.
'a', 'b' and 'c' parameters relate to lens correction of images. For an explanation, see:
The default values are all '0', which equates to no lens correction.
In addition, the mathematical distortion can be queried directly using the Correct method:
($p, $q) = $self->Correct ($m, $n)
The 'radlum' value can be used to fix radial luminance variation in the source image. Typically a photograph will be brighter in the centre than at the edges - A small positive number, eg. '10', will try to correct for this.
The number represents the difference in luminance between the centre and the nearest edge, the units assume a range of 256 between black and white.
The default is '0', no radial luminance correction.
Radial luminance correction is loosely based on that provided by the Panorama Tools Correct plugin, with a couple of variations that should make it more suitable for batch processing images.
Copyright (c) 2002 Bruno Postle <firstname.lastname@example.org>. All Rights Reserved. This module is Free Software. It may be used, redistributed and/or modified under the same terms as Perl itself.