Filtering a photo of a document to look like a proper scan
You can use ScanTailor.
Scan Tailor is an interactive post-processing tool for scanned pages. It performs operations such as page splitting, deskewing, adding/removing borders, and others. You give it raw scans, and you get pages ready to be printed or assembled into a PDF or DJVU file.
The program is developed for Windows, GNU / Linux, and other Unix-like systems such as Mac OS X. See Installation . You might need to build it from source though.