I am trying to get [i, j] index of image pixel.
I Initialize dimensions this way
dim3 Db = dim3( 16, 16, 1 ); // block dimensions are fixed to be 256 threads
dim3 Dg = dim3( (width+Db.x-1)/Db.x, (height+Db.y-1)/Db.y, 1 );
Run<<<Dg, Db>>>()
Than in kernel i calculate [i, j]
int i = blockIdx.x * blockDim.x + threadIdx.x;
int j = blockIdx.y * blockDim.y + threadIdx.y;
printf("[%d, %d], ", i, j);
But if I print those values, I never got numbers like [0, 0], [0,1], [0,2] etc… but always high numbers [350, 352] etc
Hovewer, if i access image pixels
unsigned char * pixel = (unsigned char*)(surface + y*pitch) + 4*x;
I got correct result…
How can I got “real” image indexes, because I need them in algorithm?