guruvyasa

wierd results for particle filter initialization

Discussion created by guruvyasa on Jun 15, 2011
Latest reply on Jul 9, 2011 by Jawed

I am implementing a parallel particle filter for my project. I ve written a simple kernel for parallel initialization and it works fine if the region is initialized manually..the kernel code is as given..now i wrote a function to take input from user ie a rectangle on the target to track and stored it in variable region..but calling the same initialization kernel is giving wierd results as shown .

 

No build errors

width 169 height 53 x = 181.500000 y = 167.500000 

width 53 height 0 x = 167.500000 y = 1.000000 

width 0 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 1.000000 

width 1065353216 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 0.000000 

width 1065353216 height 1127579648 x = 0.000000 y = 0.000000 

width 1127579648 height 1126662144 x = 0.000000 y = 0.000000 

width 1126662144 height 169 x = 0.000000 y = 181.500000 

width 169 height 53 x = 181.500000 y = 167.500000 

width 53 height 0 x = 167.500000 y = 1.000000 

width 0 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 1.000000 

width 1065353216 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 0.000000 

width 1065353216 height 1127579648 x = 0.000000 y = 0.000000 

width 1127579648 height 1126662144 x = 0.000000 y = 0.000000 

width 1126662144 height 169 x = 0.000000 y = 181.500000 

width 169 height 53 x = 181.500000 y = 167.500000 

width 53 height 0 x = 167.500000 y = 1.000000 

width 0 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 1.000000 

width 1065353216 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 0.000000 

width 1065353216 height 1127579648 x = 0.000000 y = 0.000000 

width 1127579648 height 1126662144 x = 0.000000 y = 0.000000 

width 1126662144 height 169 x = 0.000000 y = 181.500000 

width 169 height 53 x = 181.500000 y = 167.500000 

width 53 height 0 x = 167.500000 y = 1.000000 

width 0 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 1.000000 

width 1065353216 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 0.000000 

width 1065353216 height 1127579648 x = 0.000000 y = 0.000000 

width 1127579648 height 1126662144 x = 0.000000 y = 0.000000 

width 1126662144 height 169 x = 0.000000 y = 181.500000 

width 169 height 53 x = 181.500000 y = 167.500000 

width 53 height 0 x = 167.500000 y = 1.000000 

width 0 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 1.000000 

width 1065353216 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 0.000000 

width 1065353216 height 1127579648 x = 0.000000 y = 0.000000 

width 1127579648 height 1126662144 x = 0.000000 y = 0.000000 

width 1126662144 height 169 x = 0.000000 y = 181.500000 

width 169 height 53 x = 181.500000 y = 167.500000 

width 53 height 0 x = 167.500000 y = 1.000000 

width 0 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 1.000000 

width 1065353216 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 0.000000 

width 1065353216 height 1127579648 x = 0.000000 y = 0.000000 

width 1127579648 height 1126662144 x = 0.000000 y = 0.000000 

width 1126662144 height 169 x = 0.000000 y = 181.500000 

width 169 height 53 x = 181.500000 y = 167.500000 

width 53 height 0 x = 167.500000 y = 1.000000 

width 0 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 1.000000 

width 1065353216 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 0.000000 

width 1065353216 height 1127579648 x = 0.000000 y = 0.000000 

width 1127579648 height 1126662144 x = 0.000000 y = 0.000000 

width 1126662144 height 169 x = 0.000000 y = 181.500000 

width 169 height 53 x = 181.500000 y = 167.500000 

width 53 height 0 x = 167.500000 y = 1.000000 

width 0 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 1.000000 

width 1065353216 height 1127579648 x = 1.000000 y = 181.500000 

width 1127579648 height 1126662144 x = 181.500000 y = 167.500000 

width 1126662144 height 1065353216 x = 167.500000 y = 0.000000 

width 1065353216 height 1127579648 x = 0.000000 y = 0.000000 

width 1127579648 height 1126662144 x = 0.000000 y = 0.000000 

width 1126662144 height 169 x = 0.000000 y = 181.500000 

width 169 height 53 x = 181.500000 y = 167.500000 

width 53 height 0 x = 167.500000 y = 1.000000 

width 0 height 1127579648 x = 1.000000 y = 181.500000 

width 0 height 0 x = 181.500000 y = 167.500000 

width 0 height 0 x = 0.000000 y = 0.000000 

width 0 height 0 x = 0.000000 y = 0.000000 

width 0 height 0 x = 0.000000 y = 0.000000 

width 0 height 0 x = 0.000000 y = 0.000000 

width 0 height 0 x = 0.000000 y = 0.000000 

width 0 height 0 x = 0.000000 y = 0.000000 

width 0 height 0 x = 0.000000 y = 0.000000 

width 0 height 0 x = 0.000000 y = 0.000000 

please help me with this..


typedef struct CvRect{ int x; int y; int width; int height; }CvRect; typedef struct particle { float x; /**< current x coordinate */ float y; /**< current y coordinate */ float s; /**< current scale */ float xp; /**< previous x coordinate */ float yp; /**< previous y coordinate */ float sp; /**< previous scale */ float x0; /**< original x coordinate */ float y0; /**< original y coordinate */ int width; /**< original width of region described by particle */ int height; /**< original height of region described by particle */ histogram* histo; /**< reference histogram describing region being tracked */ float w; /**< weight of the particle */ } particle; __kernel void init_distribution(__global struct particle* particles, __global struct CvRect *region) { int k = get_global_id(0); //int np; float x, y; int i, width, height; //np = p / n; //this is the number of particles per region /* create particles at the centers of each of n regions */ width = region->width; height = region->height; x = region->x + width / 2.0; y = region->y + height / 2.0; particles[k].x0 = particles[k].xp = particles[k].x = x; particles[k].y0 = particles[k].yp = particles[k].y = y; particles[k].sp = particles[k].s = 1.0; particles[k].width = width; particles[k].height = height; // particles[k].histo = histos[i]; particles[k].w = 0.0; }

Outcomes