Accessing RGB channel of the image in CUDA-OpenCV program


I am working on an image correction algorithm implemented in opencv-c++ programming. To improve the performance i have used CUDA with a wrapper function. Below is the code:

__global__ minValue(double *input, double *output, size_t pitch)
      //about this function discussed below

void minvalue_wrapper(const Mat3d& src, Mat1d& dst)
    size_t pitch;
    double *d_src, *d_dst;
    cudaMallocPitch(&d_src,&pitch, src.cols*sizeof(double), src.rows);
    cudaMallocPitch(&d_dst,&pitch, src.cols*sizeof(double), src.rows);

    cudaMemcpy2D(d_src, pitch, src.ptr(),src.cols*sizeof(double), src.cols*sizeof(double),src.rows,cudaMemcpyHostToDevice);
    const dim3 block(16,16);
    const dim3 grid(src.cols/block.x, src.rows/block.y);

    minValue<<< grid, block >>>(d_src, d_dst, pitch);

From the main function the image is passed to the wrapper function.

Now, in actual opencv-c++ code of minValue, channel-wise computation is performed, like taking first pixel of all the three channels(RGB) and finding minimum out of it, which is done inside two for loops. I want to assign this computation to GPU for faster performance. But, in the device code, i am not getting how to access channels of the image using *input variable discussed above.
please, provide me some example code in which the RGB channels of the image are accessed and computation is done in each pixel in the device code.