Changed status of falsecolor to 4 (finished).
#!/usr/bin/perl
#
# Compute foveal histogram for picture set
#
# This is a re-write of Greg's phisto.csh with no functionality
# added or removed.
#
# Axel, Oct 2010
use strict;
use warnings;
use File::Temp qw/ tempdir /;
my $td = tempdir( CLEANUP => 1 );
if ($#ARGV < 0) {
# Input is from STDIN: Capture to file
open(FH, ">$td/stdin.rad");
while (<>) {
print FH;
}
close FH;
# Pretend stdin.rad was passed as a filename
@ARGV = ("$td/stdin.rad");
}
my $tf = "$td/phisto.dat";
open(FH, ">$tf") or
die("$0: Unable to write to temporary file $tf\n");
close(FH);
foreach (@ARGV) {
system("pfilt -1 -x 128 -y 128 -p 1 $_ |pvalue -o -h -H -d -b >> $tf") == 0
or die("$0: Error running pfilt|pvalue on file $_\n");
}
# Get log10 of upper and lower image luminance
my $Lmin = `total -l $tf | rcalc -e 'L=\$1*179;\$1=if(L-1e-7,log10(L)-.01,-7)'`;
chomp($Lmin);
my $Lmax = `total -u $tf | rcalc -e '\$1=log10(\$1*179)+.01'`;
chomp($Lmax);
# Output to STDOUT histogram data of log10(luminance)
my $cmd = "rcalc -e 'L=\$1*179;cond=L-1e-7;\$1=log10(L)' $tf";
$cmd .= " |histo $Lmin $Lmax 100";
system("$cmd");
#EOF