Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Perspective transform revisited
#7
The link in post #1 no longer works. Apparently I can no more edit that post. Here is a new link to the new version 0.2, with a little change plus a new plugin.

http://kmarkku.arkku.net/Perspective_tra...aster.html

The changes are:
  1. Dropped the options to draw the two special lines. I shouldn't have put them in the plugin to begin with. If for some strange reason somebody wants them back, just raise your voice.
  2. Made another plugin in the same package, called "Perspective transform by a path and a rectangle".

How to get the new version: click the link above, scroll down to the bottom, click the Download button, unzip the file you get, and place the file perspective_transform.py in your Gimp's user plug-ins folder. You get now two plugins, and they are located in Gimp's menu at

Filters > Distorts > Perspective transform > ...

The new plugin works on the active layer. I give no pictures but only explain. The plugin takes as input one 4-anchor path ("source path"): Suppose you have in the picture some area A that you would like to be rectangular but it is not due to perspectivity. You make the source path so that it goes round that area A, cyclically from corner to corner, so defining a quadrangle. Then you call the plugin. That's it. The layer is distorted so that area A becomes rectangular with sides horizontal and vertical.

That is the default working of the plugin. You can also tell the plugin more exactly what you want. The plugin uses so-called "target rectangle". It is the rectangle onto which the quadrangle will be mapped. You can let the plugin use its default action; then it computes the target rectangle from the source path with an algorithm of its own. If the result is not satisfactory, you have two ways to specify the target rectangle exactly: by a rectangle selection, or by guides (two horizontal, two vertical).

For instance, you may want area A to become square, or otherwise have some particular aspect ratio. To that end, you can use a selection or guides.

The target rectangle will normally have sides horizontal and vertical. The plugin offers an option to rotate it. The angle is inputted in degrees.

Example: you can do the same correction as in post #1 (the clock picture by denzjos) also as follows: For the source path take the same one which appeared in post #1 (connect the hours 3,6,9,12 in the dial). Make a square selection of proper size. Then call the new plugin by choosing the selection for the target rectangle, and setting the rotation angle to 45.

If the plugin does something odd, or if it does not work at all, please report.

Occasionally the plugin fails with the message that a part of the layer would go to infinity. Then you can try to crop the layer to its essential contents, or you can try to change the source path.

I have the nagging feeling that I am re-inventing the wheel here. There must already be a tool that does the same? How else could it be since this must be a frequently appearing problem. But Gimp's Transform Tools, as far as I understand, work so that one has to play by one's eye. My plugin gives exact result (as soon as the source path is good). So, tell me: is there some older tool or plugin for the same job?
Reply


Messages In This Thread
Perspective transform revisited - by Ottia Tuota - 10-28-2020, 05:11 PM
RE: Perspective transform revisited - by Krikor - 10-28-2020, 07:04 PM
RE: Perspective transform revisited - by denzjos - 10-29-2020, 05:15 PM
RE: Perspective transform revisited - by Ottia Tuota - 11-03-2020, 10:30 AM
RE: Perspective transform revisited - by Blighty - 11-03-2020, 11:16 AM
RE: Perspective transform revisited - by Krikor - 11-03-2020, 02:12 PM
RE: Perspective transform revisited - by denzjos - 11-05-2020, 04:40 PM
RE: Perspective transform revisited - by Krikor - 11-05-2020, 06:04 PM
RE: Perspective transform revisited - by denzjos - 11-06-2020, 09:10 AM
RE: Perspective transform revisited - by Krikor - 11-10-2020, 09:04 PM
RE: Perspective transform revisited - by Krikor - 11-11-2020, 12:50 PM
RE: Perspective transform revisited - by akovia - 11-16-2020, 06:11 PM
RE: Perspective transform revisited - by Krikor - 12-01-2020, 12:45 PM
RE: Perspective transform revisited - by denzjos - 12-03-2020, 02:17 PM
RE: Perspective transform revisited - by denzjos - 12-03-2020, 05:42 PM
RE: Perspective transform revisited - by denzjos - 12-04-2020, 08:58 AM
RE: Perspective transform revisited - by Krikor - 12-05-2020, 07:06 PM
RE: Perspective transform revisited - by denzjos - 12-06-2020, 12:02 PM

Forum Jump: