title: colored image to greyscale image using CUDA parallel processing
body: <p>I am trying to solve a problem in which i am supposed to change a colour image to a greyscale image. For this purpose i am using CUDA parallel approach.<br><br> The kerne code i am invoking on the GPU is as follows.</p>
  
  <pre><code>__global__
  void rgba_to_greyscale(const uchar4* const rgbaImage,
                     unsigned char* const greyImage,
                     int numRows, int numCols)
  {
      int absolute_image_position_x = blockIdx.x;  
      int absolute_image_position_y = blockIdx.y;
  
    if ( absolute_image_position_x &gt;= numCols ||
     absolute_image_position_y &gt;= numRows )
   {
       return;
   }
  uchar4 rgba = rgbaImage[absolute_image_position_x + absolute_image_position_y];
  float channelSum = .299f * rgba.x + .587f * rgba.y + .114f * rgba.z;
  greyImage[absolute_image_position_x + absolute_image_position_y] = channelSum;
  
  }
  
  void your_rgba_to_greyscale(const uchar4 * const h_rgbaImage,
                              uchar4 * const d_rgbaImage,
                              unsigned char* const d_greyImage,
                              size_t numRows,
                              size_t numCols)
  {
    //You must fill in the correct sizes for the blockSize and gridSize
    //currently only one block with one thread is being launched
    const dim3 blockSize(numCols/32, numCols/32 , 1);  //TODO
    const dim3 gridSize(numRows/12, numRows/12 , 1);  //TODO
    rgba_to_greyscale&lt;&lt;&lt;gridSize, blockSize&gt;&gt;&gt;(d_rgbaImage,
                                               d_greyImage,
                                               numRows,
                                               numCols);
  
    cudaDeviceSynchronize(); checkCudaErrors(cudaGetLastError());
  }
  </code></pre>
  
  <p><br> i see a line of dots in the first pixel line.<br></p>
  
  <p>error i am getting is<br><br>
          libdc1394 error: Failed to initialize libdc1394<br>
          Difference at pos 51 exceeds tolerance of 5<br>
          Reference: 255<br>
          GPU      : 0<br>
  <a href="https://docs.google.com/folder/d/0B_4HoenewpKDdFh6R19XOVBrNkU/edit?usp=sharing" rel="noreferrer">my input/output images</a>
  Can anyone help me with this??? thanks in advance.</p>