Random change to d3::scene::calc_depth_range() reference change constant.
[Ale.git] / scripts / transform
blobb34aa8dfa98386b2ca6cdebad0b8f06b3a49d977
1 #!/usr/bin/perl -w
4 # This script accepts as input a transformation file, applying the inverse
5 # of the specified projective transformation. This script can be used, e.g.,
6 # like this:
7 #
8 # $ ale --trans-save=a.t --projective 1.jpg 2.jpg 3.jpg a.jpg
9 # $ transform `grep -A1 2.jpg a.t | tail -1` < a.t > b.t
10 # $ ale --trans-load=b.t --projective 1.jpg 2.jpg 3.jpg c.jpg
13 if (defined $ARGV[0] && $ARGV[0] =~ /^P/) {
14 shift;
17 @ARGV == 10 or die "usage: $0 <projective-args>\n";
19 while (<STDIN>) {
21 $line = $_;
23 if ($line =~ /^V 2/) {
24 print "V 3\n";
25 $line = "P $ARGV[0] $ARGV[1] 0 0 0 $ARGV[1] $ARGV[0] $ARGV[1] $ARGV[0] 0\n";
28 if (!($line =~ /^P (.*)/)) {
29 print $line;
30 next;
33 @new_args = split / /, $1;
35 print "P " . $new_args[0] . " " . $new_args[1] . " ";
36 shift @new_args; shift @new_args;
38 while (@new_args > 0) {
39 $result = `echo @ARGV $new_args[0] $new_args[1] | ale --ptcalc 2> /dev/null | grep INVERSE`;
40 $result =~ /.*\((.*), (.*)\)/;
41 print $1 . " " . $2 . " ";
42 shift @new_args; shift @new_args;
45 print "\n";