Script to turn a photo into a scan

Anything Really. Just keep it clean!

Moderators: Dorian (MJT support), JRL

Post Reply
ZeitenWanderer
Pro Scripter
Posts: 68
Joined: Wed Dec 07, 2005 7:13 am

Script to turn a photo into a scan

Post by ZeitenWanderer » Wed Oct 08, 2014 8:09 am

Once I desperately looked for a solution, which would help me to turn a photo into a scan. I found a unix script here http://staff.washington.edu/corey/camscan/, which later a friend of mine simplified, so I could use for my purposes and also turned it into a windows script.

[snippet=]set "CGQ=-colorspace gray -quality"
set "CGT=-compress group4 -density 480x480"
set "TMP1=t-%1"
set "TMP2=x-%1"

convert *.jpg *.tif
convert %CGQ% 99 "%1" -resize 5120x5120 "%TMP2%"
convert %CGQ% 99 "%1" -resize 1024x1024 -negate -blur 15,15 -resize 5120x5120 "%TMP1%"
composite %CGQ% 99 -compose plus "%TMP2%" "%TMP1%" "%TMP1%"
convert %CGQ% 60 "%TMP1%" -normalize -level 50,85%% "%3"
convert %CGT% "%TMP1%" -normalize -threshold 85%% "%2"
del "%TMP1%"
del "%TMP2%"[/snippet]

As the original creator said, it was meant to make a digital cam (or other modern device) a scanner. It worked. :D

User avatar
Meryl
Staff
Posts: 124
Joined: Wed Sep 19, 2012 1:53 pm
Location: Texas
Contact:

Re: Script to turn a photo into a scan

Post by Meryl » Mon Oct 13, 2014 2:22 pm

Thanks for posting it!

ZeitenWanderer
Pro Scripter
Posts: 68
Joined: Wed Dec 07, 2005 7:13 am

Re: Script to turn a photo into a scan

Post by ZeitenWanderer » Thu Oct 16, 2014 8:57 am

Just to spark an idea to other folks. Once you your picture this far, you might also want to use some OCR.

And since this site is about automation, you might want to check out the free (and giant) "tesseract". Once developed by Hewlett Packard, bought by Google, who use it themselves to read in rare books, before the originals get lost.

This one would get you the text out of picture, once that you converted it and assume it is a German text. Check the documentation to set your own language or use "eng" for "deu" instead.

[snippet=]
scancvt original.jpg conversion.tif final.jpg
tesseract final.jpg OCR -l deu
[/snippet]

If it does not work, you have to check or add you local path.
Your webcam will hardly every produce pictures, which would get you decent OCR results, an HD cam might do better. Your digital cam might be all right, if it offers a resolution of 3.2 (like Canon A70 and later) and your smartphone (not old mobile) will next to always deliver decent raw material for good OCR results, which is in any case due to the actual density (dots per inch, ahem). That is not very technical speaking, but hopefully helpful to those, who want to do a quick check - and stand a fair chance. For permanent works we decided against an HD cam, since it sucks too much energy from the machine, phones are phones are phones, digital cams are nice, but only Canon and Nikon offer a life view.

ZeitenWanderer
Pro Scripter
Posts: 68
Joined: Wed Dec 07, 2005 7:13 am

Re: Script to turn a photo into a scan

Post by ZeitenWanderer » Thu Oct 16, 2014 3:02 pm

And now a rather special part, which camera-device to use for a permanent station to handle your work-photos. Means, items you are about to sell, sheets telling when you sent the package out to which address, taxes, incoming invoices etc.. All the stuff, you would erase in a few days or keep in folders like "January invoices" or "January mail_in" etc..

In all these cases, you will want a solution, which is affordable, reliable and permanent without eating up all the space on your desk. Later, you will want this not to be too obvious. Here is my solution:

Step 1: Digital camera, Canon Powershot series.
Step 2: They deliver a software called "Remote Control", this helps to run and control and fire off the camera from your keyboard - including a life view.
Step 3: Make yourself aware, which operating system you are using, since the older ones only run with XP, the later ones with Windows 7 and 8. To find out about this, there is a brilliant site:
http://www.breezesys.com/PSRemote/index.htm

This guy produces an alternative to PSRemote, which comes along with the Canon. It has a few extras, but it kicks when it comes to the batch and api mode!

Depending on the money you are ready to spend, DSLRs can do even more fancy things - controlwise.

From experience, I advise everyone to look for a camera, which offers a power supply and to use a single tripod leg (not a small desktop tripod). The single tripod leg offers telescoping, you can pull your camera out or push it in. It hardly takes any place and inside any daylight office it takes very reasonable pictures - good enough for OCR.

This is an old picture, but it shows what is important, I believe.
http://www.zeitenwanderer.de/images/sin ... tripod.jpg

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts