/[opencvs]/eyes/workeyes.pl
ViewVC logotype

Contents of /eyes/workeyes.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (show annotations)
Thu Mar 6 06:43:51 2014 UTC (4 years, 9 months ago) by hib
Branch: MAIN
CVS Tags: HEAD
Changes since 1.15: +14 -5 lines
File MIME type: text/plain
Got qi working and released.
1 #$val=1080;
2
3 # for larissa:
4 #$val=2160;
5 #$simple = 1;
6 # for stephaine
7 #$val=4028;
8 #$simple=1;
9 #$val=1980;
10 # end for larissa
11
12 # for ben flag
13 $val= 600;
14 $simple=0;
15
16 # for the girls at 52 inches 720 dpi
17 #$val = 780;
18 #$val=1080;
19 #$simple=0;
20
21 # just for a quickie demo
22 #$val=100;
23 #$simple=1;
24
25
26 # for moot 60 inches 720 dpi
27 #$val = 1350;
28 #$simple=0;
29
30 #$val = 198;
31 #$simple=1;
32
33 $valxval = $val . "x" . $val;
34
35
36 # new! - use when eliminating duplicates - labels the first 6 of the filename
37 # and the xy coordinates
38 $label_me = 0;
39
40 $lpart = "";
41 if ($simple==1) { # no moire pattern
42
43 while (<>) {
44 ($x,$y,$fname,$width,$height,$cl,
45 $cr,$cg,$cb,$strength,$radius,$rtarget,$gtarget,$btarg,$tcolor) = split(/\|/);
46 $diff = $width - $height;
47 $name = $x . "_" . $y . ".png";
48 if ($label_me) {
49 my $d = $fname;
50 $d =~ s,./i/,,g;
51 $d =~ s,./,,g;
52 $d =~ s,.jpg,,g;
53 $d = substr($d,0,6);
54 $lpart = "-background black -fill cyan -pointsize 12 " .
55 "-draw \"text 0,13 '$d'\"" .
56 " -fill white -draw \"text 0,$val '$x|$y'\"";
57 }
58
59 print "convert xc:\\#" . $rtarget . " -resize $valxval m/g$name\n";
60 if ($diff >0) {
61 $dover2 = int($diff/2);
62 if ($diff/2 == int($diff/2)) {
63 print "convert $fname -bordercolor \\#" . $cl . " -border 0x" . ($dover2) . " m/f$name\n";
64 }
65 else {
66 print "convert $fname -bordercolor \\#" . $cl . " -border 0x" . ($dover2) . " m/a$name\n";
67 print "convert m/a$name -bordercolor \\#" . $cl . " -extent $width" . "x" . "$width m/f$name\n";
68 }
69 }
70 elsif ($diff < 0) {
71 $diff = -$diff;
72 $dover2 = int($diff/2);
73 if ($diff/2 == int($diff/2)) {
74 print "convert $fname -bordercolor \\#" . $cl . " -border " . ($dover2) . "x0 m/f$name\n";
75 }
76 else {
77 print "convert $fname -bordercolor \\#" . $cl . " -border " . ($dover2) . "x0 m/a$name\n";
78 print "convert m/a$name -bordercolor \\#" . $cl . " -extent $height" . "x" . "$height m/f$name\n";
79 }
80 }
81 else {
82 print "convert $fname m/f$name\n";
83 }
84 print "convert m/f$name -resize $valxval $lpart m/g$name\n";
85 print "rm m/[a-f]$name\n";
86 }
87
88 }
89
90
91 else { # moire pattern
92
93 # 72 inches 720 dpi
94 #$dpi = 720;
95 #$xsize = 155520;
96 #$ysize = 51840;
97 #$xsize = 190080;
98
99
100 #$dpi = 1440;
101 #$ysize = 63360;
102
103 # 720 dpi 52 inches eyeskelly
104 #$dpi = 720;
105 #$xsize = 112320;
106 #$ysize = 37440;
107
108 # 720 dpi 60 inches by something eyesmoot
109 #$dpi = 720;
110 #$xsize = 43200;
111 #$ysize = 33750;
112
113
114 $dpi = 300;
115 $xsize = 4200;
116 $ysize = 3000;
117
118 $random = 28; # 28 for kelly and viktoria
119 # $maxrate = 31; for kelly - 40 for Viktoria
120
121 $maxrate = 50; # for jenni
122 #$maxrate = 40; - for viktoria
123 #$maxrate = 31;
124
125 #./build_diffa eye_source.txt $random $xsize $ysize $dpi $dpi 5000 6000 5000 6000 $cr $cg $cb $maxrate >b.txt
126
127 while (<>) {
128 ($x,$y,$fname,$width,$height,$cl,
129 $cr,$cg,$cb,$strength,$radius,$rtarget,$gtarget,$btarg,$tcolor) = split(/\|/);
130 $diff = $width - $height;
131 $name = $x . "_" . $y . ".png";
132
133 $xoff = $x * $val;
134 $yoff = $y * $val;
135
136
137 print "convert xc:\\#" . $rtarget . " -resize $valxval m/g$name\n";
138 if ($diff <0) {
139
140 $diff = -$diff;
141 $nw = int($width * $val / $height);
142 print "convert $fname -resize $nw" . "x" . "$val m/b$name\n";
143 $diff = $val - $nw;
144 $dover2 = int($diff/2.);
145
146 $fx = $xoff;
147 $fy = $yoff;
148 $tx = $xoff + $dover2;
149 $ty = $yoff + $val;
150 print "build_diffa eye_source.txt $random $xsize $ysize $dpi $dpi $fx $tx $fy $ty $cr $cg $cb $maxrate >m/a$name.txt\n";
151
152 $dover2 = $diff - $dover2;
153
154 $fx = $xoff+$val-$dover2;
155 $fy = $yoff;
156 $tx = $xoff + $val;
157 $ty = $yoff + $val;
158 print "build_diffa eye_source.txt $random $xsize $ysize $dpi $dpi $fx $tx $fy $ty $cr $cg $cb $maxrate >m/c$name.txt\n";
159
160 print "convert m/a$name.txt m/b$name m/c$name.txt +append m/g$name\n";
161 }
162 elsif ($diff > 0) {
163 $nh = int($height * $val / $width);
164 print "convert $fname -resize $val" . "x" . "$nh m/b$name\n";
165 $diff = $val - $nh;
166 $dover2 = int($diff/2);
167
168 $fx = $xoff;
169 $fy = $yoff;
170 $tx = $xoff + $val;
171 $ty = $yoff + $dover2;
172 print "build_diffa eye_source.txt $random $xsize $ysize $dpi $dpi $fx $tx $fy $ty $cr $cg $cb $maxrate >m/a$name.txt\n";
173
174 $dover2 = $diff - $dover2;
175
176 $fx = $xoff;
177 $fy = $yoff+$val - $dover2;
178 $tx = $xoff + $val;
179 $ty = $yoff + $val;
180 print "build_diffa eye_source.txt $random $xsize $ysize $dpi $dpi $fx $tx $fy $ty $cr $cg $cb $maxrate >m/c$name.txt\n";
181
182 print "convert m/a$name.txt m/b$name m/c$name.txt -append m/g$name\n";
183 }
184 else {
185 print "convert $fname -resize $valxval m/g$name\n";
186 }
187 print "rm m/[a-f]$name*\n";
188 }
189
190 }

  ViewVC Help
Powered by ViewVC 1.1.5