2

I am trying to reproduce the image of a painting printed in a heavy book. This circumstance makes impossible to use a flat bed scanner for the job. So I am using a handheld one.

After several tries I have obtained quite decent images, but not one of them is perfectly rectangular as the original is. Because of the irregularities in my driving of the scanner, the sides of the image are not ortogonal and are also slightly ondulated. It is not much but, when one fits it in a true rectangle, there remain small white kind of wedges around the sides.

I can conceive of a couple of methods for solving the problem in some way:

  • keep the (bigger) enclosing rectangle size, fill the blanks with surrounding material via some kind of cloning tool and finally reduce the size to the original one;

  • select one corner, rotate the image around it in the required measure, make a smaller rectangular selection, crop what does not fit in it and expand the rest to the required final size.

But both of them would give as a result a copy slightly (in this case) unfaithful to the original, something that I do not want: I want to get the full image of the original painting. On the other hand such an adulterated outcome does not seem to be unavoidable, as all the right pixels are there, only a little displaced. Can some clear and expert mind suggest to me some general approach that could be followed to rectify in due form these deviations? I am using Gimp for it but, as this same question shows, not very proficiently.

6 Answers 6

1

Have a look at Gimp's cage transform tool, it has been introduced in version 2.8. An accurate mesh of many polygons might help you with roundish distortions near the center of the book.

1

I am trying to reproduce the image of a painting printed in a heavy book. This circumstance makes impossible to use a flat bed scanner for the job. So I am using a handheld one.

After several tries I have obtained quite decent images, but not one of them is perfectly rectangular as the original is. Because of the irregularities in my driving of the scanner, the sides of the image are not ortogonal and are also slightly in.

A handheld scanner is better suited for portability over accuracy.

If you only have a small number of pages to scan you could place the heavy book on a color photocopier and flatbed scan the copy. The small loss of color fidelity is probably easier to correct than random waviness in the image.

For a large number of copies a high resolution camera pointed downward on a light table can capture 40+ MP images with excellent color fidelity and with minimal chance of damaging the book. Any slight skew will be even and easy to automatically correct with software.

0

You could try the "perspective" tool. I must admit I have never used GIMP, but this seems to be the same tool as I would use in Photoshop.

0

The proper term for what you are wanting to do is called deskewing. Deskewing fixes the perspective issues you are having by using a handheld scanner. It also typically involves resizing the image back to its original print size as well. This is common in architectual and aerospace fields when converting paper/mylar prints into digital versions. Tools like Gimp and Photoshop can do this, but require a delicate touch to avoid artifacts on the produced image.

The tool we use is called VPStudio, and it made for the purpose of manipulating blueprints. http://www.softelec.com/

It's probably overkill for this situation though(and extremely expensive!) You'd probably be better off with some Gimp or PS plugins. One i found, aptly titled Deskew is for gimp. I haven't given it a try but it may be what you're looking for.

http://andrewmemory.wordpress.com/2010/04/15/straightening-pictures-with-gimp/ http://wa5pb.freeshell.org/motd/?p=542

0

It has taken me some time to get the materials suggested by you all, assimilate them and try some of them. I thank you very much for your help. I think that I have learnt quite a few things in the process, so that I will try to sythetize them here just in case they could be of some help to someone else in the future. I regret that they have to be rather verbose to pretend any utility at all.

The nature of the problem

The first thing that I see more clearly now is the nature and the causes of my original problem.

The handheld scanner has two sources of image distortion that the flatbed one does not:

1) irregularities in the velocity of its forward displacement (which will influence the number of resulting scan lines and its contents) and

2) lateral deviations from the initial direction of the scan (which will deform the image's perimeter).

The first one will be seldom detectable to the unaided eye if present only in small amounts, unless the subject matter provides strong helping clues (like some kind of grid or reference lines). The perception of the second will be on the contrary usually unavoidable, given the mathematical exactness that should have the contour of the resulting image (rectangle or square) and the extreme sensitiviness of human vision to squareness.

Perspective

Fortunately neither of these devices can have problems related to perspective, as none of them generates its image by conical or pyramidal projection through pointlike apertures (stenope, pinhole, lens system). Its optical mechanism provides ideally a contact copy (in old photographic terms) of the original. The surfaces of the object and image planes are parallel and therefore cannot produce perspective distortions (which are consequent to distances and angles intervening between them). What is more, each pixel of the sensor has its own exclusive aperture for itself so that posible perspective problems would be limited to its minuscule individual area. The perspectival aspects of paintings and photographs extend on the contrary to the whole surface of the image.

Therefore the tools provided by image manipulation programs for handling perspective issues (in its proper sense) are not pertinent to this case. As well the Tools / Transform tools / Perspective tool as the very well conceived and exemplarly documented Ez perspective filter of Gimp (http://registry.gimp.org/node/24537) deal with the image as a whole, as they should do, whereas what the problem under consideration usually requieres is the manipulation of just some part of it.

Skew

Although I am not sure of the proper technical meaning of this term, as I have seen it used loosely in different contexts, I conclude that the more common one would refer to the angle that the whole image or some subset of it (for instance a text column) makes in some direction with the system of coordinates currently operative as reference. Of course the present problem implies skews in this sense also, but the important ones are determined by its relation to the straight parts of the same image and much less to the axes of the coordinate system.

Therefore the deskewing algorithms that I have been able to examine are also unsuitable for the task, as they deal with the whole image and take care only of its rotation as such. In the case of Gimp's obscure, difficult to get and undocumented deskew plugin all it seems to be able to do is to perform automatically small rotations of the whole image around its geometrical center (http://registry.gimp.org/node/22177).

The appropriate tools

So is there no way out of the difficulty? No, I think that there are enough. As the problem under consideration is one of partial image distortion, its solution must necessarily come from the application of a neutralizing complementary distortion at the right places and in the right measure.

Gimp has several complements that can be used for this: Filters / Map / Displace, Filters / Map / Warp, Filters / Generic / Convolution matrix or Filters / Distort / Curve bend. But all of them are quite subtle to understand (especially because Gimp's pedagogical materials keep being much poorer than the program after so many years) and difficult to apply, although for different individual reasons. They can do the job but they require a lot of effort and patience in their application. Its use should better be compared to the old procedure of retouching negatives or paper positives manually than to the effortless automatic performance which we have come to expect nowadays of magical computer algorithms.

But one can learn a lot by studying and applying them. Just reflecting about how one should structure an eventual Gimp script or complement that helped to perform programmatically this operation would be a nice and instructive exercise.

Concluding (practical) remarks

  • the graphical reproductions obtained with handheld scanners will almost always be affected by distortion of several kinds in variable amounts. Such distortion is aleatory and nonlinear and therefore very difficult to remove by procedural rules (algorithms) of an elementary nature. Through the retouching process one can only aspire to replace one kind of distortion with another less objectionable.

  • if it is unavoidable to use such devices for demanding work, one has to ponder the relative convenience of these two ways of behaving: either to make as many trials as necessary until obtaining one result that is passable (or can be made so with elementary manipulations only) or to devote a lot of time and skill to rectify the bigger distortions of a faulty one with the generic deformation tools available in contemporary image manipulation programs. Or both.

-1

I suggest putting a large sheet of graph paper behind the page to be scanned, so the resulting image is surrounded by a grid that should be regular. This would inform the distortion removal process, whether manual or automated. Something like the cage tool could work, but you'd need a separate control that would provide much more stiffness in one direction than the other.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .