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

Contents of /eyes/build_als_eye_source.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Wed Apr 9 03:45:43 2014 UTC (4 years, 7 months ago) by hib
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
als is complete
1 # lines
2 # from build_jos_eye_source.pl
3 # read 1 files in the txt format
4 # 2. Distance of points
5 # 3. intensity of points
6
7 srand(1283191);
8 $width = 24016.0;
9 $height = 17920.0;
10 $swidth = 2048.;
11 $sheight = 1529.;
12
13 while (<>) {
14 $s=$_;
15 ($x,$y,$r,$g,$b) = split(/\|/,$s);
16 $avg = ($r+$g+$b)/3.0;
17 $avg = 256 - $avg;
18 if ($avg >250) { $d = 100.0 + ($avg-250);}
19 elsif ($avg > 180) {$d = 30.0 + ($avg-180) * 0.20;}
20 else {
21 $d = 3 + ($avg * 10.0 / 180.0);
22 }
23
24 $x = $x * $width / $swidth;
25 $y = $y * $height / $sheight;
26 # $d = $d + rand(70)/26000.; # slight variance in height
27 $dx = $d * abs($width/2 - $x) *2.0 / $width;
28 $dy = $d * abs($height/2 - $y) *2.0 / $height * $height / $width;
29 # $z = sqrt($d*$d + $dx*$dx + $dy*$dy);
30 $z = $d * 0.125; # fudge
31 $phase = sqrt($d*$d + $dx*$dx + $dy*$dy) / 4.72e-07 ;
32 $phasei = int($phase);
33 $phase2 = ($phase - $phasei) * 3.1415927 * 2.0;
34 # print "x $x y $y avg $avg d $d dx $dx dy $dy phase $phase phasei $phase phase2 $phase2\n";
35 # $phase = 0;
36 print "$x|$y|$z|1|4.72" . "e-07|$phase2\n";
37 }
38

  ViewVC Help
Powered by ViewVC 1.1.5