1
\$\begingroup\$

I know there is already an answer to this question on either photo.SE or something about imaging SE but after trying gazillions of search terms and word combinations until exasperation (and of course using the search-before-posting mechanism here until the same result), I'm admitting defeat and saying sorry please help (and maybe also help make the post in question more searchable for).

(Also, with the hundreds of new sites that have sprung up and the sites page not text searchable (FWIW?!) in my browser, I even had a hard time determining whether there is imaging.SE or something but that may be another problem.)

I have a photograph of a printed document that I made for lack of easy access to a flatbed scanner at the time and place I had easy access to the document (in case you ask, the document was sent to me and this is all legit but I needed the image quickly and I didnt have a scanner at hand).

Now of course the camera lens has some geometry error, line straightness aberration or whatever would be the correct term to retrieve the answer I am looking for, that I would like corrected in an easy fashion (definitely not looking for a coding solution here).

(There is also some lighting problem particularly in the corners of the picture but this is about the geometry thing as well and first of all.)

I recall that in an answer in "that" QA - which IIRC largely focused around a manual process with GIMP involving averaging and masking or something to do adaptive thresholding (IIRC without calling it so) -

someone recommended using some one-stop-shop type linux software that was named something about easy and scanning or something because it could also do lighting correction in photos as well as flatbed scans.

(I may be wrong in that it was really the same QA but I think it was. Also, I did download and use that software back then but that was a number of computers ago and it seems the downloaded package is gone because I didn't have a constant need for it and life happened and now I just can't find it, or any usable trace of it, for that matter.)

The workings of that software was you just load the picture you got and go through IIRC five steps without needing much skill but receive impressive results impressively easily just by going through the steps, like in a wizard type software.

Basically you just put in something camera-wise fairly botched image that you wish it were a clean PDF and you get just that.

All other info I remember is it was definitely on a Linux system and I think it was free and libre software or at the very least very close to that.

BTW there is some impressive commandline software solution (which is not that) for adaptive thresholding mentioned in stackoverflow 1811800 using ImageMagick -lat but that's a completely different beast and not doing geometry correction.

Also, the software in question maybe could be started from the commandline (duh) but in itself it was all GUI.

Any help appreciated finding that QA or that software.

\$\endgroup\$
2
  • \$\begingroup\$ I remember something baked in microsoft office for android. If you go into that app and on the bottom there is an actions button. Then either scan to pdf or pictures to pdf. I think it did it somewhat automatic. I only used the feature once, but thought it was neat. \$\endgroup\$
    – gns100
    Jun 28, 2022 at 14:31
  • \$\begingroup\$ There is a Software Recommendations site, and for popular graphic software like GIMP or Adobe Photoshop, those questions could probably be asked on Graphic Design. Also, the site list is text searchable for me. \$\endgroup\$
    – jaskij
    Jun 28, 2022 at 16:40

2 Answers 2

9
\$\begingroup\$

Look like Gimp, which was born on Linux but also has versions for Windows and OSX these days.

If your problem is to fix something like this:

enter image description here

Then you just start the Perspective tool, set it to Corrective mode, and align its 4 handles with the 4 corners of the document:

enter image description here

Then run the tool:

enter image description here

You will note that the tool doesn't respect the aspect ratio of the original document (because AFAIK there is no way to tell from just the picture), but if it's a standard document (Legal, Letter, A4) you already know its size, so you can use Image > Scale Image to fix this (very often you need to scale your photo anyway, it is usually too big to be usable in a document or a web site). The input fields will do the math for you (here, I know that the input document is A4, so its aspect ratio is 1.414):

enter image description here

Which gives:

enter image description here

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Worth noting: the lensfun plugin might also be useful in your example. The inwardly curved borders suggest a bit of lens distortion that has not been corrected. (Do that first!) \$\endgroup\$
    – Matthew
    Jun 28, 2022 at 14:52
  • \$\begingroup\$ A bit of practical experimentation hints that the added complexity isn't really worth it, with this kind of "casual" shooting the distortions coming from a document not completely flat are somewhat more visible than those from the lens. I also had to redo my shots since lensfun had no data for my first lens (Canon EFS-35mm Macro). \$\endgroup\$
    – xenoid
    Jun 28, 2022 at 20:12
  • \$\begingroup\$ Ah, that's a good point. And the OP probably doesn't have a convenient sheet of glass or other way to force the subject material to be flat. \$\endgroup\$
    – Matthew
    Jun 28, 2022 at 20:25
  • \$\begingroup\$ @Matthew the borders do look curved, but I think it came from the image manipulation. Holding a straight edge against the original image seems to show the edge of the paper and the printed border are both straight. \$\endgroup\$
    – FreeMan
    Jun 30, 2022 at 17:52
0
\$\begingroup\$

While it sounds like you are looking for a PC solution, I thought perhaps I'd share how I'd do that on my iPhone/iPad when I'm away from my computer and can't use Photoshop.

On my iPhone I use this app... Scanner Pro-OCR Scanning & Fax 4+ by Readdle Technologies Limited

Once you import images from your photo stream into a new document you can edit the skew.

I use it frequently for scanning documents. When photographed against a contrasting background (example: white paper on a black desk) it automatically finds the corners.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.