Daniel Reetz, the founder of the DIY Book Scanner community, has recently started making videos of prototyping and shop tips. If you are tinkering with a book scanner (or any other project) in your home shop, these tips will come in handy. https://www.youtube.com/channel/UCn0gq8 ... g_8K1nfInQ

Color and lighting correction techniques

DIY Book Scanner Skunk Works. Share your crazy ideas and novel approaches. Home of the "3D structure of a book" thread.
Post Reply
steve1066d
Posts: 296
Joined: 27 Nov 2010, 02:26
E-book readers owned: PRS-505
Number of books owned: 1250
Location: Minneapolis, MN
Contact:

Color and lighting correction techniques

Post by steve1066d » 09 Feb 2013, 15:54

I've been playing around color correcting, and lighting correction, and I though I'd share some things I've tried.

Notes about my setup

I've got a (now old) "new standard" scanner, which I've surrounded by black fabric, with two holes cut out of the fabric where the cameras can look through. I needed to do that because I was getting reflections off of the cameras.
I'm using a pair of Powershot A480 cameras running CHDK. For lighting I use two 75 watt halogen daylight PAR lamps.

When I'm shooting something that I want to reproduce as accurately as possible I shoot RAW, which is possible using the CHDK software.

I use the following software:

Adobe Lightroom. This software works well for performing photo corrections to a set of images. It costs about $120, but there is a free 30 day trial.

Adobe Lens Profile Creator: This will allow you create a camera profile that Lightroom can use that will correct for lens imperfections. Lightroom does have many lenses included, but it doesn't include Point & Shoot cameras. This tool will create a calibration for Lightroom that corrects for barrel distortion and vignetting. It is free.

ColorChecker Passport: This is a combination color checker target and software that integrates with Lightroom. It costs about $100.

Spyder3Express: This software and sensor is used to calibrate your display to more accurately the true colors. This is helpful because if you are trying to match colors, it will be difficult to do if your monitor is off. I got this for $75, but it looks like they are much more expensive now... Perhaps there is a different product out there now that is cheaper.

BookScanWizard: The book scanning post-processor that I wrote.

Shooting
Using CHDK, I set the camera in manual mode where I set he shutter speed and focal distance. I use ISO 80. I also use a custom white balance which I choose by zooming in on the white Passport target.
I also take photos of the right and left sides of the Passport target.

Correcting Spherical and Chromatic aberration
Using the Lens profile correct, I create a lens calibration following the directions in the software. This only needs to be done once.
Then in Lightroom apply that lens correction.

Color Correcting
Follow the directions for Passport and create a color profile for the left and right pages, and apply the correction.

Take a look at the images and see if there are other corrections needed. if the the lighting isn't consistent across the page, Lightroom has options to "dodge" and "burn" sections to help normalize the lighting. You might also want to tweak the color and a bit.

Once you are satisfied, save the output as a high quality jpeg, or uncompressed tiff files.

Next, I bring the files into BSW to crop and correct for perspective.

BSW also has an option "NormalizeLighting" If you take a picture of two white or grey cards, it will use the difference in brightness to adjust the other images, as well as make the left and right images exposures equal.

Final Notes
As you can see, there's quite a few extra steps to do this, so it isn't something I do with every book. Just using a custom white balance and shooting JPEGs will be accurate enough for most things. But when you are trying to get as accurate reproduction as possible, these steps can get you that extra fidelity.
Steve Devore
BookScanWizard, a flexible book post-processor.

royeven
Posts: 19
Joined: 27 Nov 2012, 19:43
E-book readers owned: ipad
Number of books owned: 0
Country: Norway

Re: Color and lighting correction techniques

Post by royeven » 09 Apr 2013, 16:38

I too am very interested in color and lens correction. I have a Nikon D3200 to take photos. I know the LEDs I'm using for lighting, and have posted the color spectrum from them here:
http://www.diybookscanner.org/forum/vie ... =10#p15735

Is is possible to use lightroom to correct colors when you know the color spectrum for your light? I'm not satisfied with the very narrow blue and almost non-existent red in my LEDs and would like to correct it. Also, I would like to process the images in bach, not on a one-by-one basis. And I would also like to export the images as PPM images in order to do dewarping and descewing:
http://www.diybookscanner.org/forum/vie ... =19&t=2589

Could Adobe Lightroom do these things?

abmartin
Posts: 79
Joined: 15 Sep 2010, 15:33
Number of books owned: 2000
Country: USA
Location: Ohio

Re: Color and lighting correction techniques

Post by abmartin » 09 Apr 2013, 18:14

I haven't played with Lightroom in ages, but it used to do what you want it to do.

For free: Ufraw. Knowing what you know already, you could do it there. Even better, if you can snap a photo of a gray card in your process, you can fix colors without having to do any math! Ufraw has an excellent batch mode. Ufraw can spit out ppm images too!

I actually do exactly what you are wanting to do and have written a linux script to take care of color and distortions:
http://www.diybookscanner.org/forum/vie ... =19&t=2795

While the lighting on my setup is terriblly-uneven, I hope my examples shows how well it would work in a more controlled setup.

The thing I would really love is a way to automatically take care of what are now the 2 manual steps of my script. (Especially calculating DPI is something I expect someone could write given that the point detection is already written in the program. I just don't have any clue how to write that) Neither take much time, but it would be cool to have things run without human input.

royeven
Posts: 19
Joined: 27 Nov 2012, 19:43
E-book readers owned: ipad
Number of books owned: 0
Country: Norway

Re: Color and lighting correction techniques

Post by royeven » 10 Apr 2013, 11:54

abmartin wrote:I haven't played with Lightroom in ages, but it used to do what you want it to do.

For free: Ufraw. Knowing what you know already, you could do it there. Even better, if you can snap a photo of a gray card in your process, you can fix colors without having to do any math! Ufraw has an excellent batch mode. Ufraw can spit out ppm images too!
Fantastic news. I'm a linux user myself, and would much rather use ufraw than something in windows.
abmartin wrote: I actually do exactly what you are wanting to do and have written a linux script to take care of color and distortions:
http://www.diybookscanner.org/forum/vie ... =19&t=2795

While the lighting on my setup is terriblly-uneven, I hope my examples shows how well it would work in a more controlled setup.

The thing I would really love is a way to automatically take care of what are now the 2 manual steps of my script. (Especially calculating DPI is something I expect someone could write given that the point detection is already written in the program. I just don't have any clue how to write that) Neither take much time, but it would be cool to have things run without human input.
That's more than fantastic, that's perfect! I'll use your script and have a shot at your two manual points. As you say, it should be possible to do these automatically. For the time being I'm having the same difficulties with the lighting as my countryman spomwii has(http://www.diybookscanner.org/forum/vie ... =16&t=2761), but as soon as I have lighting conditions I'm satisfied with, I shall start writing software for automatic photography and post-processing of the images, and your scripts have just made that job a lot easier. Thanks!

royeven
Posts: 19
Joined: 27 Nov 2012, 19:43
E-book readers owned: ipad
Number of books owned: 0
Country: Norway

Re: Color and lighting correction techniques

Post by royeven » 10 Apr 2013, 13:37

Oh, and by the way: You write in your post that you use
Gray card (I use an 18%, which has rgb values of 128 128 128)
Where do you get this? I don't live in the US, so I probably can't get it from the same place you buy yours, but is it an ordinary standard piece of paper that I can purchase in Europe too, or is it a specially made color I must purchase in a photography shop?

abmartin
Posts: 79
Joined: 15 Sep 2010, 15:33
Number of books owned: 2000
Country: USA
Location: Ohio

Re: Color and lighting correction techniques

Post by abmartin » 10 Apr 2013, 14:45

I look forward to seeing if you can hack out those manual steps! I would be thrilled if one or both of those could go away.

If you can still find the kodak gray cards, they are excellent, but since Kodak has gone out of business, the supply seems to have dried up. Perhaps your amazon localization would have one? Camera stores may have them too. In the US, I've purchased them from B&H as well as Amazon.

If you want to just try it out before finding and purchasing a card, you can always just print your own if you have a decent printer. The issue there is that white paper is pretty reflective, is rarely true white, and printers are rarely perfect. A good gray card is precisely 18% reflective. (Of course, like most other things, there are differing opinions - some prefer 12%...) However, you would probably be within a 5 percent of where a $20 card would get you, provided you weren't using reflective photo paper. http://www.diyphotography.net/diy-makin ... gray-cards

royeven
Posts: 19
Joined: 27 Nov 2012, 19:43
E-book readers owned: ipad
Number of books owned: 0
Country: Norway

Re: Color and lighting correction techniques

Post by royeven » 29 Apr 2013, 13:44

Just wanted to way that I think I have solved the problem as to calculate the PPI in software. Feel free to test my solution and gove me feedback so I can make it better. The code is posted here:
http://www.diybookscanner.org/forum/vie ... 975#p15975

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest