annotate demo/Test1.mxml @ 631:510220effb14

corrections demandees par reviewer
author Yoshua Bengio <bengioy@iro.umontreal.ca>
date Sat, 19 Mar 2011 22:44:53 -0400
parents 269c39f55134
children
rev   line source
540
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
1 <?xml version="1.0" encoding="utf-8"?>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
2
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
3 <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
4 <mx:Image x="432" y="394" width="300" height="300" id="img" autoLoad="true" scaleContent="true"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
5 <mx:Image x="116" y="197" width="200" height="200" id="imdraw"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
6 <mx:HSlider x="503" y="150" id="rot" minimum="-180" maximum="180" value="0" liveDragging="true" change="changeImage()"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
7 <mx:HSlider x="503" y="120" minimum="-2" maximum="2" value="1" liveDragging="true" id="scalex" change="changeImage()"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
8 <mx:HSlider x="687" y="120" minimum="-2" maximum="2" value="1" liveDragging="true" id="scaley" change="changeImage()"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
9 <mx:HSlider x="503" y="90" minimum="-10" maximum="10" value="0" liveDragging="true" id="transx" change="changeImage()"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
10 <mx:HSlider x="683" y="90" minimum="-10" maximum="10" value="0" liveDragging="true" id="transy" change="changeImage()"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
11 <mx:HSlider x="503" y="178" id="skew" liveDragging="true" minimum="-1" maximum="1" change="changeImage()" value="0"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
12 <mx:Label x="839" y="414" text="X" id="lab0" width="43" height="36" fontSize="12" fontWeight="bold" textAlign="left" color="#0B333C" fontFamily="Verdana"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
13 <mx:Button x="128" y="405" label="Erase" click="can2.graphics.clear();changeDrawing();changeImage()"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
14 <mx:Label x="371" y="90" text="Translation"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
15 <mx:Label x="839" y="285" text="Restrict to:"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
16 <mx:Label x="371" y="116" text="Scale"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
17 <mx:Label x="371" y="148" text="Rotation"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
18 <mx:Label x="371" y="175" text="Skew"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
19 <mx:Label x="371" y="206" text="Salt &amp; Pepper Noise" width="134" height="20"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
20 <mx:HSlider x="503" y="208" id="spnoise" liveDragging="true" minimum="0" maximum="1" change="changeImage()" value="0"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
21 <mx:Label x="371" y="232" text="Gaussian Noise" width="108" height="20"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
22 <mx:HSlider x="503" y="234" id="gnoise" liveDragging="true" minimum="0" maximum="1" change="changeImage()" value="0"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
23 <mx:Label x="118" y="175" text="Draw here:" fontSize="10" fontWeight="bold"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
24 <mx:Label x="371" y="64" text="Transforms:" fontSize="10" fontWeight="bold"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
25 <mx:Label x="433" y="368" text="Resulting image:" fontSize="10" fontWeight="bold"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
26 <mx:Label x="835" y="236" text="Classifier:" fontSize="10" fontWeight="bold"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
27
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
28 <mx:Script>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
29 <![CDATA[
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
30 import mx.effects.Blur;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
31 import flash.utils.*;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
32 import flash.display.*;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
33 import flash.geom.*;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
34 private var can2:Sprite = new Sprite()
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
35
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
36 import cmodule.mlp_conv.CLibInit;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
37
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
38 [Embed(source="mlp_w1", mimeType="application/octet-stream")] private static var mlp_w1:Class;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
39 [Embed(source="mlp_b1", mimeType="application/octet-stream")] private static var mlp_b1:Class;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
40 [Embed(source="mlp_w2", mimeType="application/octet-stream")] private static var mlp_w2:Class;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
41 [Embed(source="mlp_b2", mimeType="application/octet-stream")] private static var mlp_b2:Class;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
42
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
43 [Embed(source="sda_w1", mimeType="application/octet-stream")] private static var sda_w1:Class;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
44 [Embed(source="sda_b1", mimeType="application/octet-stream")] private static var sda_b1:Class;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
45 [Embed(source="sda_w2", mimeType="application/octet-stream")] private static var sda_w2:Class;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
46 [Embed(source="sda_b2", mimeType="application/octet-stream")] private static var sda_b2:Class;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
47 [Embed(source="sda_w3", mimeType="application/octet-stream")] private static var sda_w3:Class;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
48 [Embed(source="sda_b3", mimeType="application/octet-stream")] private static var sda_b3:Class;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
49 [Embed(source="sda_w4", mimeType="application/octet-stream")] private static var sda_w4:Class;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
50 [Embed(source="sda_b4", mimeType="application/octet-stream")] private static var sda_b4:Class;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
51
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
52 private var loader:CLibInit;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
53 private var lib:Object;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
54
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
55 private var carac:String = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
56
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
57 private function init():void{
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
58 var mlp_w1_data:ByteArray = new mlp_w1();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
59 var mlp_b1_data:ByteArray = new mlp_b1();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
60 var mlp_w2_data:ByteArray = new mlp_w2();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
61 var mlp_b2_data:ByteArray = new mlp_b2();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
62
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
63 var sda_w1_data:ByteArray = new sda_w1();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
64 var sda_b1_data:ByteArray = new sda_b1();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
65 var sda_w2_data:ByteArray = new sda_w2();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
66 var sda_b2_data:ByteArray = new sda_b2();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
67 var sda_w3_data:ByteArray = new sda_w3();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
68 var sda_b3_data:ByteArray = new sda_b3();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
69 var sda_w4_data:ByteArray = new sda_w4();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
70 var sda_b4_data:ByteArray = new sda_b4();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
71
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
72 mlp_w1_data.endian = Endian.LITTLE_ENDIAN;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
73 mlp_b1_data.endian = Endian.LITTLE_ENDIAN;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
74 mlp_w2_data.endian = Endian.LITTLE_ENDIAN;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
75 mlp_b2_data.endian = Endian.LITTLE_ENDIAN;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
76
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
77 sda_w1_data.endian = Endian.LITTLE_ENDIAN;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
78 sda_b1_data.endian = Endian.LITTLE_ENDIAN;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
79 sda_w2_data.endian = Endian.LITTLE_ENDIAN;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
80 sda_b2_data.endian = Endian.LITTLE_ENDIAN;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
81 sda_w3_data.endian = Endian.LITTLE_ENDIAN;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
82 sda_b3_data.endian = Endian.LITTLE_ENDIAN;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
83 sda_w4_data.endian = Endian.LITTLE_ENDIAN;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
84 sda_b4_data.endian = Endian.LITTLE_ENDIAN;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
85
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
86 mlp_w1_data.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
87 mlp_b1_data.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
88 mlp_w2_data.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
89 mlp_b2_data.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
90
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
91 sda_w1_data.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
92 sda_b1_data.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
93 sda_w2_data.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
94 sda_b2_data.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
95 sda_w3_data.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
96 sda_b3_data.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
97 sda_w4_data.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
98 sda_b4_data.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
99
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
100 loader = new CLibInit;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
101 lib = loader.init();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
102 lib.initparam(mlp_w1_data, mlp_b1_data, mlp_w2_data, mlp_b2_data, sda_w1_data, sda_b1_data, sda_w2_data, sda_b2_data, sda_w3_data, sda_b3_data, sda_w4_data, sda_b4_data);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
103 lib.choosemodel(0);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
104
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
105 changeDrawing();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
106 changeImage();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
107
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
108 imdraw.addEventListener(MouseEvent.MOUSE_DOWN, begin_drawing);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
109 //imdraw.addEventListener(MouseEvent.ROLL_OUT, stop_drawing);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
110 imdraw.addEventListener(MouseEvent.MOUSE_UP, stop_drawing);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
111
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
112 calc_pred();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
113 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
114
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
115 private function calc_done(out:Array):void {
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
116 var i:uint, s:Number = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
117 if (!ch_dig.selected) for(i=0; i<10; i++) out[i] = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
118 if (!ch_upper.selected) for(i=10; i<36; i++) out[i] = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
119 if (!ch_lower.selected) for(i=36; i<62; i++) out[i] = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
120 if(modelnum.selectedIndex == 0) {
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
121 for(i=0; i<62; i++) s += out[i];
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
122 if(s) for(i=0; i<62; i++) out[i] /= s;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
123 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
124
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
125 var ind:Array = out.sort(Array.DESCENDING | Array.RETURNINDEXEDARRAY | Array.NUMERIC);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
126 lab0.text = carac.charAt(ind[0])
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
127 lab1.text = carac.charAt(ind[1])
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
128 lab2.text = carac.charAt(ind[2])
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
129 rec0.width = out[ind[0]]*130
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
130 rec1.width = out[ind[1]]*130
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
131 rec2.width = out[ind[2]]*130
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
132 //rec0.setStyle("backgroundColor", 0xff0000);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
133
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
134 setTimeout(calc_pred, 10);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
135 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
136
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
137 private function calc_pred():void {
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
138 var bd:BitmapData = imnorm.source.bitmapData;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
139 var rect:Rectangle = new Rectangle(0, 0, 32, 32);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
140 var bytes:ByteArray = bd.getPixels(rect);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
141 bytes.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
142 lib.choosemodel(modelnum.selectedIndex);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
143 lib.prediction(calc_done, bytes);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
144 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
145
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
146 private function begin_drawing(event:MouseEvent):void {
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
147 can2.graphics.lineStyle(thickness.value * imdraw.width/32, 0xFFFFFFFF);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
148 can2.graphics.moveTo(imdraw.mouseX, imdraw.mouseY)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
149 imdraw.addEventListener(MouseEvent.MOUSE_MOVE, draw_line);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
150 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
151 private function stop_drawing(e:MouseEvent):void
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
152 {
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
153 imdraw.removeEventListener(MouseEvent.MOUSE_MOVE, draw_line);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
154 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
155
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
156 private function draw_line(e:MouseEvent):void
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
157 {
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
158 var x:Number = imdraw.mouseX, y:Number = imdraw.mouseY
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
159 /*if (x<0 || x>imdraw.width || y<0 || y>imdraw.height) {
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
160 stop_drawing(e)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
161 return
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
162 }*/
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
163 can2.graphics.lineTo(x, y);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
164 changeDrawing()
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
165 changeImage()
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
166 e.updateAfterEvent();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
167 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
168
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
169 private function changeDrawing():void{
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
170 var bitmapDataObject2:BitmapData = new BitmapData(32, 32, false, 0x00000000);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
171 var rect:Rectangle = new Rectangle(0, 0, 32, 32);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
172 var m:Matrix = new Matrix()
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
173 m.scale(32/imdraw.width, 32/imdraw.height)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
174 bitmapDataObject2.draw(can2,m,null,null,null,true);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
175 var myBitmap:Bitmap = new Bitmap(bitmapDataObject2);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
176 imdraw.source = myBitmap;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
177 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
178
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
179 private var ready:Boolean = false;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
180 private var cache:Number;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
181 public function RandNormal(sigma:Number):Number {
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
182 ready = !ready;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
183 if (!ready) return cache * sigma;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
184 var x:Number = Math.sqrt(-2 * Math.log(Math.random())), y:Number = Math.random()
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
185 cache = x * Math.cos(2*Math.PI*y);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
186 return x * Math.sin(2*Math.PI*y) * sigma;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
187 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
188
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
189 private function changeImage():void{
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
190
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
191 var bitmapDataObject2:BitmapData = new BitmapData(32, 32, false, 0x00000000);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
192
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
193 var can3:Sprite = new Sprite()
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
194 var x:Number, y:Number, l:int, t:Number, w:int, c:uint, n:uint
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
195 n = int(0.999 + 3*rat.value)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
196 for(var j:uint=0; j<n; j++) {
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
197 x = -10+ Math.random()*52
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
198 y = -10 + Math.random()*52
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
199 l = 5 + 30*rat.value*Math.random()
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
200 t = 2*Math.PI * Math.random()
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
201 w = 1 + 3*rat.value*Math.random()
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
202 c = 50+ 250*rat.value*Math.random()
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
203 can3.graphics.lineStyle(w, c | c<<8 | c<<16 | c<<24);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
204 can3.graphics.moveTo(x, y)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
205 can3.graphics.lineTo(x + l*Math.cos(t), y + l*Math.sin(t));
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
206 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
207 bitmapDataObject2.draw(can3,null,null,null,null,true);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
208
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
209 var m:Matrix = new Matrix()
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
210 m.scale(32/imdraw.width, 32/imdraw.height)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
211 m.translate(-16,-16)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
212 m.concat(new Matrix(1,0,-skew.value,1))
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
213 m.scale(scalex.value, scaley.value)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
214 m.rotate(Math.PI* rot.value/180)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
215 m.translate(transx.value, transy.value)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
216 m.translate(16,16)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
217
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
218 bitmapDataObject2.draw(can2,m,null,null,null,true);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
219
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
220 var rect:Rectangle = new Rectangle(0, 0, 32, 32);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
221 var bytes:ByteArray = bitmapDataObject2.getPixels(rect);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
222
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
223 bytes.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
224 for(var i:uint=0; i<4*32*32; i+=4) {
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
225 //bytes[i]=0
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
226 var g:int = bytes[i+1]
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
227
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
228 if (Math.random() < spnoise.value/5)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
229 g = Math.random() * 255
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
230
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
231 g += RandNormal(gnoise.value*55)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
232 g = Math.min(Math.max(g,0),255)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
233
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
234 g = 127.5 + (g-127.5)*contr.value
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
235 bytes[i+1]=bytes[i+2]=bytes[i+3] = g
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
236 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
237
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
238 bitmapDataObject2.setPixels(rect, bytes);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
239
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
240 var myBitmap:Bitmap = new Bitmap(bitmapDataObject2);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
241 img.source = myBitmap;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
242
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
243 NormImage();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
244 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
245
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
246 private function NormImage():void{
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
247 var rect:Rectangle = new Rectangle(0, 0, 32, 32);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
248
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
249 /*var f:BlurFilter = new BlurFilter(5.0, 5.0, 1);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
250 var b2:BitmapData = new BitmapData(32, 32, false, 0);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
251 b2.applyFilter(img.source.bitmapData, rect, new Point(0,0), f);*/
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
252 //var b2:BitmapData = img.source.bitmapData.clone();
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
253
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
254 var bytes:ByteArray = img.source.bitmapData.getPixels(rect);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
255 bytes.position = 0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
256
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
257 var pix:Array = new Array(32*32);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
258 var i:int, j:int;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
259 for(i=0; i<32*32; i++)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
260 pix[i] = bytes[4*i+1];
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
261
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
262 var ind:Array = pix.sort(Array.RETURNINDEXEDARRAY | Array.NUMERIC);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
263 var med:Number = pix[ind[32*32/2]];
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
264
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
265 var ci:Number = 0, cj:Number = 0, s:Number = 0, mtot:Number=0;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
266 for(i=0; i<32; i++)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
267 for(j=0; j<32; j++) {
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
268 var g:int = pix[j*32+i];
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
269 g = Math.abs(g-med);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
270 mtot += g;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
271 ci += g*i;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
272 cj += g*j;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
273 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
274 ci /= mtot;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
275 cj /= mtot;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
276
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
277 for(i=0; i<32; i++)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
278 for(j=0; j<32; j++) {
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
279 g = pix[j*32+i];
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
280 g = Math.abs(g-med);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
281 s += g* ((i-ci)*(i-ci) + (j-cj)*(j-cj));
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
282 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
283 s = Math.sqrt(s / mtot);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
284 s = Math.max(s, 3)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
285 s = 9/s;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
286
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
287 var bitmapDataObject2:BitmapData = new BitmapData(32, 32, false, med | med<<8 | med<<16);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
288
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
289 var m:Matrix = new Matrix()
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
290 m.translate(-ci, -cj)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
291 m.scale(s, s)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
292 m.translate(16, 16)
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
293
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
294 bitmapDataObject2.draw(img.source.bitmapData,m,null,null,null,true);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
295
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
296 var myBitmap:Bitmap = new Bitmap(bitmapDataObject2);
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
297 imnorm.source = myBitmap;
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
298 }
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
299 ]]>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
300 </mx:Script>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
301 <mx:CheckBox x="840" y="309" label="Digits" selected="true" id="ch_dig"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
302 <mx:CheckBox x="840" y="338" label="Uppercase letters" selected="true" id="ch_upper"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
303 <mx:CheckBox x="840" y="368" label="Lowercase letters" selected="true" id="ch_lower"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
304 <mx:Canvas x="863" y="419" width="130" height="8" borderStyle="solid" borderColor="#B1C6CA" backgroundColor="#567B83" id="rec0">
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
305 </mx:Canvas>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
306 <mx:Label x="839" y="442" text="Y" id="lab1" width="43" height="36" fontSize="12" fontWeight="bold" textAlign="left" color="#0B333C" fontFamily="Verdana"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
307 <mx:Canvas x="863" y="448" width="130" height="8" borderStyle="solid" borderColor="#B1C6CA" backgroundColor="#567B83" id="rec1">
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
308 </mx:Canvas>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
309 <mx:Label x="839" y="471" text="Z" id="lab2" width="43" height="36" fontSize="12" fontWeight="bold" textAlign="left" color="#0B333C" fontFamily="Verdana"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
310 <mx:Canvas x="863" y="477" width="130" height="8" borderStyle="solid" borderColor="#B1C6CA" backgroundColor="#567B83" id="rec2">
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
311 </mx:Canvas>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
312 <mx:ComboBox x="912" y="234" editable="false" id="modelnum" selectedIndex="1"><mx:ArrayCollection>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
313 <mx:String>Shallow MLP 500 h.u. /NIST</mx:String>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
314 <mx:String>Deep SDA 3x1000 h.u. /P07</mx:String>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
315 </mx:ArrayCollection></mx:ComboBox>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
316 <mx:Button x="475" y="60" label="Reset" click="transx.value=transy.value=0;scalex.value=scaley.value=1; rot.value=skew.value=spnoise.value=gnoise.value=rat.value=0; contr.value=1; changeImage();"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
317 <mx:Label x="371" y="260" text="Polarity / Contrast" width="108" height="20"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
318 <mx:HSlider x="503" y="262" id="contr" liveDragging="true" minimum="-1" maximum="1" change="changeImage()" value="1"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
319 <mx:Label x="371" y="288" text="Crossings Amount" width="108" height="20"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
320 <mx:Label x="115" y="444" text="Thickness" width="108" height="20"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
321 <mx:HSlider x="503" y="290" id="rat" liveDragging="true" minimum="0" maximum="1" change="changeImage()" value="0"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
322 <mx:Image x="992" y="285" width="100" height="100" id="imnorm" autoLoad="true" scaleContent="true"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
323 <mx:HSlider x="194" y="443" id="thickness" liveDragging="true" minimum="0.1" maximum="10" value="1.9" width="121"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
324 <mx:Button x="671" y="221" label="Shuffle" click="changeImage()" width="71"/>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
325
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
326 </mx:Application>
269c39f55134 Added demo source files
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
327