Page 1 of 4

My DIY Scanner

Posted: 19 Dec 2016, 21:08
by BillGill
I started building a book scanner in February 2016. I based it generically on "The New 'Standard Scanner' " by Daniel Reetz. That plan can be found here on the DIY Book Scanner Forum. However I did it rather ad hoc and came up with one that kind of looked like Daniel's, but the details were different.
Done_Alsmost (1).JPG
For camera control I am using Pi-Scan software from Jonathon Duerig. It runs on a Raspberry Pi computer which is strapped to the right hand camera mounting post. There is a link to this on the DIY Book Scanner home page.

I got this one working pretty good, but did some more mods before I took it to the Tulsa MiniMaker Faire last August. There was quite a bit of interest shown by people who attended the faire, but I wasn't really well prepared. Next year I hope to be a bit better prepared.

Since then I have been kind of unhappy with the camera mounts. They are rather unstable. If I need to remove and replace the cameras I have to do a realignment to get them back into shape. So I went back to work and designed my own camera mounts. I moved the mounts to the platen, so that they would retain their position with regard to the page as I worked through the book.

The first thing I did was to make a couple of camera mounting blocks. Each block consists of a piece of wood with a 1/8 inch deep groove in it which is just wide enough for the camera body to fit in it.
CameraMount (7).JPG
As you can see the camera is now firmly mounted and will retain its position when it is removed and reattached. The 1/4-20 camera mounting bolt is run through a 3/8 inch hole drilled through the mounting block and the mounting wing on the platen. In my setup I needed a 2 1/4 inch bolt to make it the right length, but couldn't find one, so I used a 2 1/2 inch bolt and shimmed it with a nut run all the way down to the head of the bolt and several washers. In order to keep the bolt in place when the camera is off of the mount I drilled a 1/2 inch hole through the middle of the mounting block and ran the mounting bolt through an extra nut that is in the through hole. That way I can take the camera off without having the bolt fall out.
CameraMount (3).JPG
When I got through the system looked quite a bit different from the original build, but works better.
CameraMount (13).JPG
Now the camera mounts are stable and I found and extra benefit. In the past I have had problems with focus during the scan of a book. The camera would drift out of focus someplace in the process and sometimes I wouldn't notice it until I had transferred the images to my main computer, then I would have to go back and rescan the out of focus pages. The first book I scanned after I built the new camera mounts stayed in focus for the entire scan.

Re: My DIY Scanner

Posted: 19 Dec 2016, 23:35
by rkomar
Nice work, and thanks for sharing! Since your cameras are always at the same position, I'd try to lock the focus and zoom to the same position every time. I'm assuming that you are using CHDK to control the cameras. You can use chdkptp to set different focus points and zoom levels to see which one produces the best results, and then preset the cameras to those best settings and lock them before starting the process. I would also do the same with the exposure. I'm not familiar with the raspberry pi system, but I hope it has the ability to preset those camera settings.

Re: My DIY Scanner

Posted: 20 Dec 2016, 11:08
by duerig
Pi Scan finds the focus once at the beginning of the session and then locks it there. So it is really designed for the case where the camera is fixed relative to the platen. This must be why it slowly drifted out of focus on the original design.

Billgill, this scanner looks really good. Especially the final version.

What is the function of the white curtains?

How is the lighting with the cameras so much closer to the platen?

Did you have to change the platen motion system to account for the extra weight and imbalance of the cameras and wings?

-Jonathon Duerig

Re: My DIY Scanner

Posted: 22 Dec 2016, 18:52
by BillGill
In reply to RKomar I figured that the change in camera distance wasn't working for the Pi-scan. Now that it isn't changing as I go through the book it is working much better. I would like to have the software run on a PC. That way I could review the scans immediately and then go straight on to the postprocessing. I have looked at chdkptp and while it does a lot it basically works with one camera at a time. I have looked at writing my own PC software, I know Visual Basic programming, but everything I tried has bounced.

duerig, The lighting is still good. That is a pretty bright light, a 150 watt work light. I did move it closer to the platen when I did the revisions.

The white bags on the back are counterweights. I was looking for something that I could easily change the weight of and chose to use 2 hot water bottles. I sewed up 2 bags to hold them. With those I can change the weight on a moments notice by adding or removing water.

Re: My DIY Scanner

Posted: 22 Dec 2016, 19:19
by rkomar
I wasn't suggesting to use chdkptp for scanning books, but rather to use it to search for the optimum values for the focus distance, zoom and exposure time. Once you have those values, hopefully you can pass them to whatever software is doing the scanning. Personally, I don't trust the camera to get the focus and exposure right every time it tries. I've seen mine get the focus wrong slightly too many times, and even get it wrong badly occasionally.

Re: My DIY Scanner

Posted: 22 Dec 2016, 19:44
by BillGill
Yep, but Pi-Scan doesn't have anything like that. It runs on the Raspberry-Pi computer, which in its way, is a great little computer. But the Pi-Scan software is like a lot of software written by a user who wants a neat program. It does its job, but Is relatively simplistic. It has all the functions built in and there are no external controls. It is what it is and that is what you get. This is not to run down Pi-Scan. It is really a very useful program that does what it is built to do. It is a tribute to how somebody can start with not much and build a good program. But, now that I have seen what it can do I want to have it do more, and do it more conveniently for me. That is a common thing, everybody sees something that works good and then wants it improved according to their idea of how it should run. One simple thing I would like would be a finer zoom. In Pi-Scan there are steps from 1 to 10 for the zoom. I would like to get in between those steps and get closer to covering just the books page, and not so much territory around it.

What would really be useful would be if somebody could supply me with a Windows DLL for the camera interface, so I could write an interface that would allow me to get into the camera, without have to learn all about working with the USB ports and then with the chdk software on the camera.

Re: My DIY Scanner

Posted: 22 Dec 2016, 21:38
by rkomar
It's not that easy to optimize the zoom value for different sized books because the center of the page on the platen moves as the book changes size. If you want to cut down on wasted picture area, you have to be able to move the camera up and down to position it over the center of the current page. With the cameras fixed in one position, you have to accept wasted space in the images.

Re: My DIY Scanner

Posted: 23 Dec 2016, 00:32
by BillGill
I realize that you can't get a perfect match for the picture area and the page. I tried to align the cameras for the center of an average page. But with the levels that are available in Pi-Scan I go from way over scan to too tight in one step. I think if there was more zoom adjustment I could get a better compromise. As I said the fact that it works at all is a real achievement, I would just like to have an even better one. And there are some other things
I would like to be improved.

Of course if I wrote a program that did what I want it to do then other people would be able to look at what I had done and find things they think could be improved. They would very likely be correct. That is one of those endless chains of software development.

Re: My DIY Scanner

Posted: 23 Dec 2016, 12:44
by dpc
BillGill wrote:What would really be useful would be if somebody could supply me with a Windows DLL for the camera interface, so I could write an interface that would allow me to get into the camera, without have to learn all about working with the USB ports and then with the chdk software on the camera.
I hear ya. It's the reason why I went with Canon DSLRs so that I could use their SDK to control the camera settings and retrieve/preview images via my own code.

There's some benefit to locking the zoom. You'll know what the DPI is for all your scans since it won't change. You also need to ask yourself if it's really necessary to get a higher DPI on books with smaller page sizes by changing the zoom for different sized pages. The typical small book is a paperback novel and they are comprised of black text on white pages. The higher DPI here isn't really a win (at least it wasn't for me).

Re: My DIY Scanner

Posted: 23 Dec 2016, 14:48
by BillGill
Well, I am using 2 Canon Elph 160 cameras. I don't really plan to spend the money to go to DSLRs. That is a big upgrade on price. I will keep that in mind though. If I ever get rich I can buy them and then do it myself using their SDKs, as you say you did. My new general purpose camera is a Sony RX10 and I notice you can get software to control it from a PC. But I don't plan to put it on my digitizer.

As far as the resolution. I get a stated resolution of 150 DPI no matter the zoom. That is not correct. I checked the dimensions stated for the pictures and it seems that the computer says they are 28 X21 inches. I did the math and that comes out to 150 DPI, but the image is not any place close to 28 inches. They should be more like 300 DPI. That is a fight I have no idea how to win.

As far as zooming in more, it doesn't change the resolution, but the size of the text gets larger, so there are more dots per character for the OCR software to work with.

Your paperbacks may be black on white, mine tend to be blackish gray on yellowish white, with lots of extraneous speckles. In fact the biggest part of the job of digitizing a book is the editing to fix all the errors picked up by the OCR software.