8

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!

Illya Moskvin
  • 181
  • 1
  • 6
  • Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. – bbgodfrey Apr 24 '15 at 02:12
  • 1
    Does this help? http://mathematica.stackexchange.com/q/17125/8 – Verbeia Apr 24 '15 at 06:58
  • 3
    @blochwave Sorry, this slipped through the cracks. I don't think it is prudent to close this question, since an answer to it would benefit the book scanning community in general, not just me. I'll go ahead and edit the question with sample images immediately. – Illya Moskvin Sep 28 '15 at 08:41
  • 1
    This answer from halirutan is one of a few I've seen on this site about removing/fixing the lighting in an image - maybe it will help get started http://mathematica.stackexchange.com/a/11442/13162 – dr.blochwave Sep 28 '15 at 09:48
  • 1
    if you have mathematica 10.0. you may try RemoveBackground[img, {"Background", {LightYellow, 0.5}}] – s.s.o Sep 28 '15 at 10:58
  • 1
    Also related links: http://mathematica.stackexchange.com/questions/77177/image-processing-for-extracting-regions-of-book-pages-that-are-covered-by-text and http://mathematica.stackexchange.com/questions/32114/how-could-i-use-mathematica-to-remove-finger-tips-that-appear-in-images – s.s.o Sep 28 '15 at 11:09

1 Answers1

3

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

dr.blochwave
  • 8,768
  • 3
  • 42
  • 76