As a universal rule, before effectively process the image, it is almost mandatory for most applications, perform some enhancement at image in order to optimize further calculations. At this step, as sreevenkjan mentioned, basic filtering is done for eliminate unnecessary information, and also highlight points of interests.
I would say that as a practical reference for programming, you could refer to OpenCV library, which contains a set of examples wrote in C language.
+++