can somebody help. I am writing my code to loop through every pixel of RGB nad convert it to gray scale but it doesn’t work!. It compiles but the results are not as expected.
I have defined
#define DIM 512
and my kernel call looks like this:
gpuConvert <<<grid, 1>>>(dev_ptrout, dev_ptrin);
My function looks like this:
global void gpuConvert(unsigned char *b, const unsigned char *a)
// Calculate the index of the pointers based on pixel location for each thread
int x = blockIdx.x; // current row
int y = blockIdx.y; // current column
int dim= gridDim.x; // Perform the convertion int index = x + y*dim; // current pixel index b[index] = (a[index]+ a[index+1]+ a[index+2])/3.0f;
Am I missing something?
Please help! I am lost