Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Perspective transform revisited
#16
New version 0.3 is now available at

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

Changes:
  1. In the latest plugin (path and rectangle) I made changes:
    • Dropped the option to do operation backwards. I should learn not to put too many options. This one was, as I now think, just confusing. If somebody wants to do such operation, the regular Perspective Transform tool is enough for that.
    • Changed the plugin label to clearer "Perspective transform - 4 points to rectangle corners".
  2. Added a new plugin: "Perspective transform - 4 points to circle".

I explain now the new plugin "Perspective transform - 4 points to circle". It is meant for correcting distorted circles to true circles. (Here "distorted circles" means circles distorted by some pespective transformation. That is usually the case occurring in photos, at least approximately.)

The GUI looks like the following:

   

The most important fields are (1) the source path; (2-5) the hours on an imaginary clock face meant to correspond to the 4 anchors of the source path. These are needed to specify the transformation.

It goes like this: Suppose you have a picture that contains a distorted circle.
  1. You choose 4 points on the distorted circle; let us call them A0,A1,A2,A3.
  2. From those you make the source path: it has A0,A1,A2,A3 as its 4 anchors.
  3. Then you imagine a circle as a clock face, and you choose 4 points on the dial, for example hours 12,3,6,9.
  4. You insert this data in the GUI of the plugin.
  5. Then you run the plugin.
The plugin may fail. But if it does not, it performs a transformation where the distorted circle is mapped to a true circle (placing the circle approximately where the distorted circle was), and the points A0,A1,A2,A3 are mapped to the chosen places on the circle (for example 12,3,6,9).

Example: I use again that photo by denzjos in post #1. That photo put the ball running in the first place. In the following picture the original photo is on the left (the clock dimmed for clarity). As the 4 points A0,A1,A2,A3 I chose the hours 12,3,6,9 on the distorted dial, and I made the source path from them (red). To correct the distortion, open the GUI of the plugin, input the source path, and input the hours 12,3,6,9 in the GUI (these are the defaults). Then press OK. If the result is not good, try to use the source path reversed (next field). The result is on the right.

   

You can try the same job using some different hours. The result seems to be very sensitive on the exact placement of the anchors of the path, so better to zoom in when you do it.

This example was a clock, so it was trivial to pick the required 4 points A0,A1,A2,A3 in the picture and the corresponding hours 12,3,6,9 on the clock. But of course you can use the plugin for any distorted circle, but in order to specify the hours (inputs 2-5), you must imagine that the figure is a clock. How well you can get the hours right, determines how well the distortion will be corrected. This may not be easy, depending on the picture.

Note: I am currently making another plugin that is easier to use but not so exact. Instead of a perspective transform (projective transformation), it uses an affine transformation. So, it does not really correct perspective distortions,  but it does a kind of a sloppy correction, which may suffice in some cases.
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 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 Ottia Tuota - 11-10-2020, 04:11 PM
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: