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

How to Darken a B&W Image

All about lighting. LED, CFL, Halogen, Other? Questions and info about lighting go here.
Post Reply
rcull
Posts: 16
Joined: 13 Feb 2012, 00:23
Number of books owned: 0

How to Darken a B&W Image

Post by rcull » 10 May 2020, 13:53

I am not sure whether the problem I am having with light B&W images is related to camera exposure or lighting or something else.
The image on the left is with my DYI scanner running two Cannon 2200s. The one on the right is with my flatbed. I would like the result from my DYI with the 2200s to appear more like the one from the flatbed. Any suggestions as to what I should look at or play with? Lighting, camera settings,...

Thanks
Image

duerig
Posts: 384
Joined: 01 Jun 2014, 17:04
Number of books owned: 1000
Country: United States of America

Re: How to Darken a B&W Image

Post by duerig » 11 May 2020, 13:21

For camera control, you can try adjusting the shutter speed. That is the best way to control how much light gets to the camera on these cheaper point and shoot cameras. Longer shutter speed means more light. And if there is too much light, the whole image gets washed out.

However, even with ideal shutter speeds, you may find that the contrast is not as good as you would like. There are two main ways to handle this in post-processing.

One is to renormalize the image in some way. Usually the white areas aren't 100% white and the black areas aren't 100% black. So you can spread the various shades of gray across the whole spectrum instead of the limited range that the photo has on its own.

The other is to 'sharpen' the image in some way. In Marker Crop, I do this with a Gaussian Blur. Here is the opencv code:

var blurred = createMatrix(image, sharpenBlurredData);
cv.GaussianBlur(image, blurred, new cv.Size(5, 5), 3);
var result = createMatrix(image, sharpenResultData);
cv.addWeighted(blurred, -0.5, image, 1.5, 0, result);
return result;

If you are using ImageMagick or some other tool/library that allows fine-grained image transformations then you can do the equivalent. Or if you are using a more high-level tool then look for 'sharpen' or contrast options.

Note that in general, the best way to solve something like this is with better cameras/equipment. A flatbed scanner almost certainly gets better quality images (higher DPI, better contrast, etc.) if it is feasible. But it is just not feasible with books where you care about getting into the gutter and need to preserve.

-Jonathon Duerig

rcull
Posts: 16
Joined: 13 Feb 2012, 00:23
Number of books owned: 0

Re: How to Darken a B&W Image

Post by rcull » 07 Jun 2020, 13:54

Update:
I have played with the shutter speed to darken the images. It seems to work.
My lighting is 2x40 watt incandescent bulbs. I was using a shutter speed of 30, and have moved to 125. The images look dark on the pi capture screen, and on the Scan Tailor screen. But, Scan Tailor does an excellent job of processing them and they look great when finished.

Thanks

Post Reply