I am new to image processing, and I was hoping someone might set me in the right direction. I am trying to create a simple toolkit for personal use for digitizing scanned book images into a database. I managed to figure out how to detect and extract rectangular images from a scanned page with Mathematica, but as expected, I'm running into problems with gutter (spine) shadows distorting my thresholds.

I found a couple papers that describe potential algorithms for removing gutter shadows, but the math is a bit beyond me (for now). I don't have time to figure it out at the moment, so I'll be doing the current batch of images by hand, but I wanted to share this quandary with you guys, as this seems like a challenge some of you might enjoy.

Here are some relevant articles:

I'm hesitant to share sample images due to copyright restrictions, but here are two pages meant for the dataset I had in mind:

Here is a more typical two-page scan:

There are other variations to the problem, such as grainy gutters, gutters with uneven shadows, blurry gutters, gutters on dark backgrounds, gutters on colored backgrounds, etc. For the time being, however, let's assume that the source images are high-quality and that the scan was done with care.

Thank you and good luck!


1 Answer 1


This has already been mentioned in a comment, so if you have access to Mathematica version 10 then the recently-introduced function RemoveBackground[] is very handy.

Example 1 with a light yellow background, as provided by s.s.o in a comment above.

image = Import["http://i.imgur.com/aIU3zCH.jpg"];
ImageAdjust@RemoveBackground[image, {"Background", {LightYellow, 0.5}}]

enter image description here

Example 2 with a blurred gutter, based on an example in the documentation:

image = Import["http://i.imgur.com/9ZQ0lQt.jpg"];
ImageAdjust@RemoveBackground[image, {"Blurred", 1}]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.