cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

guruvyasa
Journeyman III

wierd results for particle filter initialization

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.x0 = particles.xp = particles.x = x; particles.y0 = particles.yp = particles.y = y; particles.sp = particles.s = 1.0; particles.width = width; particles.height = height; // particles.histo = histos; particles.w = 0.0; }

0 Likes
2 Replies
guruvyasa
Journeyman III

as is clear from the results the first particle is getting the correct values for the x,y,width and height but then i dont know what is happening..

0 Likes

Your code doesn't show the definition of histogram.

Try removing it from particle, since you are not doing anything with it in your test code, anyway.

In general, structs as parameters to kernels cause "problems". Search the forum and read about alignment and the use of attributes.

Another thing to bear in mind is that the size of the global range must be an integer multiple of the work group size. See the formulas in section 3.2 of the specification. This means that the values of k in your kernel (considering all work items) may not map to values you are expecting. You will need to ensure that particles has enough elements to support all values of k, otherwise you will get invalid data.

Try enabling AMD's printf extension and printing k.

0 Likes