Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /branches/pure-cfg/test/rsmp2d.diderot
ViewVC logotype

Annotation of /branches/pure-cfg/test/rsmp2d.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 723 - (view) (download)

1 : glk 698 // rsmp2d
2 :     //
3 : glk 723 // demos 2D convolution
4 : glk 698
5 :     string dataFile = "../data/pix1-11.nrrd";
6 :     int dataSize = 11;
7 :     int imgSize = 200;
8 :     image(2)[] img = load (dataFile);
9 :     field#2(2)[] F = img ⊛ bspln3;
10 :    
11 :     strand sample (int ui, int vi)
12 :     {
13 :     real uu = real(dataSize)*(real(ui)+0.5)/real(imgSize) - 0.5;
14 :     real vv = real(dataSize)*(real(vi)+0.5)/real(imgSize) - 0.5;
15 :     vec2 pos = [uu,vv];
16 : glk 723 //output real val = -∞;
17 :     output vec3 vxy = [0.0,0.0,0.0];
18 : glk 698
19 :     update
20 :     {
21 : glk 723 if (inside(pos,F)) {
22 :     real f = F@pos;
23 :     vec2 grad = ∇F@pos;
24 :     // HEY (BUG) what happened to vector indexing?
25 :     //vxy = [0.1 if f > 0.01 else 0.0, grad[0], grad[1]];
26 :     vxy = [0.1 if f > 0.01 else 0.0, dot(grad, [1.0,0.0]), dot(grad, [0.0,1.0])];
27 :     }
28 : glk 698 stabilize;
29 :     }
30 :     }
31 :    
32 :     initially [ sample(ui, vi) | vi in 0..(imgSize-1), ui in 0..(imgSize-1) ];

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0