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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 725 - (download) (annotate)
Fri Apr 1 23:02:38 2011 UTC (8 years, 7 months ago) by glk
File size: 867 byte(s)
now show bug
// rsmp2d
//
// demos 2D convolution

string dataFile = "../data/pix1-11.nrrd";
int dataSize = 11;
int imgSize = 200;
image(2)[] img = load (dataFile);
field#2(2)[] F = img ⊛ bspln3;

strand sample (int ui, int vi)
{
    real uu = real(dataSize)*(real(ui)+0.5)/real(imgSize) - 0.5;
    real vv = real(dataSize)*(real(vi)+0.5)/real(imgSize) - 0.5;
    vec2 pos = [uu,vv];
    //output real val = -∞;
    output vec3 vxy = [0.0,0.0,0.0];

    update
    {
        if (inside(pos,F)) {
          real f = F@pos;
          vec2 grad = ∇F@pos;
          // HEY (BUG) what happened to vector indexing?
          vxy = [0.1 if f > 0.01 else 0.0, grad[0], grad[1]];
          //vxy = [0.1 if f > 0.01 else 0.0, dot(grad, [1.0,0.0]), dot(grad, [0.0,1.0])];
        }
        stabilize;
    }
}

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