From: Steinar H. Gunderson Date: Thu, 25 Jul 2013 20:00:19 +0000 (+0200) Subject: Add a Perl script to convert the output of find-pairwise-distance to a PGM file for... X-Git-Url: https://git.sesse.net/?p=gifmaker;a=commitdiff_plain;h=HEAD Add a Perl script to convert the output of find-pairwise-distance to a PGM file for visualization. --- diff --git a/pairwise-to-pgm.pl b/pairwise-to-pgm.pl new file mode 100644 index 0000000..3e11fc8 --- /dev/null +++ b/pairwise-to-pgm.pl @@ -0,0 +1,17 @@ +#! /usr/bin/perl +use strict; +use warnings; +use POSIX; + +my $width = 599; +my $height = 599; +my $max = 7263081; + +print "P5\n$width $height\n255\n"; +while (<>) { + /(\d+) (\d+) (\d+)/ or die; + my ($i, $j, $z) = ($1, $2, $3); + $z = log($z + 1.0) / log($max + 1.0); + $z = pow($z, 20); + print chr(int(255.0 * $z)); +}