Leser: 19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use GD;
# create a new image
$im = new GD::Image(1024,768);
$bildin= "img/CH_IR039/05100100.039";
$bildout= "img/CH_IR039/05100100.png";
$bildin2= "img/CH_IR108/05100100.108";
$bildout2= "img/CH_IR108/05100100.png";
$befehl = "convert ".$bildin." ".$bildout;
system($befehl);
$befehl2 = "convert ".$bildin2." ".$bildout2;
system($befehl2);
$myImage = GD::Image->newFromPng($bildout);
$myImage2 = GD::Image->newFromPng($bildout2);
$k=0;
for ($x=0 ; $x<=1023; $x++) {
for ($y=0 ; $y<=767; $y++)
{
$index = $myImage->getPixel($x,$y);
$index2 = $myImage2->getPixel($x,$y);
($Image1,$dummy1,$dummy1) = $myImage->rgb($index); #Achtung evt. $red[]
($Image2,$dummy1,$dummy1) = $myImage2->rgb($index2);
$color = $Image1-$Image2;
$im->setPixel($x,$y,$color);
$k++;
}
}
open(PICTURE, ">picture.png") or die("Cannot open file for writing");
binmode PICTURE;
print PICTURE $im->png;
close PICTURE;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
use strict; use warnings; use PDL; use PDL::IO::Pic; my ($img0) = PDL->rpic('image0.png') or die "Couldn't read image: $!"; my ($img1) = PDL->rpic('image1.png') or die "Couldn't read image: $!"; my $diff = $img1 - $img0; $diff->wpic('diff.png') or die "Couldn't write image: $!";