Scanning an image with pointers
In most image-processing tasks, you need to scan all the pixels of an image in order to perform a computation. Considering a large number of pixels will need to be visited, it is essential that you perform this task in an efficient way. This recipe and the next one will show you different ways of implementing efficient scanning loops. This recipe uses the pointer arithmetic.