Before implementing this as a program, you may want to take the original photo and play with it in GIMP or another editor to see what you can do.
One way to deal with shadows is to run a high-pass filter before deploying it.
Here's how you do it in the image editor (manually, without the "highpass" filter):
1. Convert the image to shades of gray and save it to "layer_A"
2. Make a copy of "layer_A" in "Layer_B"
3. Invert colors to "Layer_B"
4. Gaussian blur "Layer_B" with a radius that is larger than the largest function you want to keep. (blur radius greater than a letter)
5. Merge "Layer_A" with "Layer_B", where result = "Layer_A" * 0.5 + "Layer_B" * 0.5 .
6. Increase the contrast in the resulting image.
7. Run the trophy.

In opengl, this will be done in the same way (and without multiple layers)
This will not work well with strong / sharp shadows (obviously), but it will destroy the huge smooth shadows that result from a bent page, etc.
A technique (high-pass filter) is often used to create seamless textures, and you can find several such tutorials and additional information using google (high GIMP skip or high GIMP skip).
By the way, if you want to improve readability, you might want to keep it in shades of gray (while improving contrast) instead of converting it to black and white (1 bit). Sharp letter boundaries make reading difficult.
source share