AI-NeuralNet-BackProp
view release on metacpan or search on metacpan
BackProp.pm view on Meta::CPAN
120612071208120912101211121212131214121512161217121812191220122112221223122412251226# Loads and decompresses a PCX-format 320x200, 8-bit image file and returns
# two arrays, first is a 64000-byte long array, each element contains a palette
# index, and the second array is a 255-byte long array, each element is a hash
# ref with the keys 'red', 'green', and 'blue', each key contains the respective color
# component for that color index in the palette.
sub
load_pcx {
shift
if
(
substr
(
$_
[0],0,4) eq
'AI::'
);
# open the file
open
(FILE,
"$_[0]"
);
binmode
(FILE);
my
$tmp
;
my
@image
;
my
@palette
;
my
$data
;
# Read header
read
(FILE,
$tmp
,128);
# load the data and decompress into buffer
( run in 0.226 second using v1.01-cache-2.11-cpan-0f795438458 )