I'm looking for code which cleans up a document picture, meaning takes out shadows and other noises and turns it into a simple black & white image (black-the writing, white-the background).
Maybe a simple pixel algorithm will be helpful such as: dividing the image into rectangles, for each defining the most frequent scale as background and and the darker pixels as the actual writing lines.
Any help will be highly appreciated.