Today, we live in an age of high definition camera sensors that capture high-resolution images. An image can have a size of up to 1920 x 1920 pixels. So, processing of these pixels on computers in real time involves billions of floating point operations to be performed per second. This is difficult for even the fastest of CPUs. A GPU can help in this kind of situation. It provides high computation power, which can be leveraged using CUDA in your code.
Images are stored as multidimensional arrays in a computer with two dimensions for a grayscale image and three dimensions for a color image. CUDA also supports multidimensional grid blocks and threads. So, we can process an image by launching multidimensional blocks and threads, as seen previously. The number of blocks and threads can vary depending on the size of an image. It will also depend on your...