11-10-2020, 04:11 PM
New version 0.3 is now available at
http://kmarkku.arkku.net/Perspective_tra...aster.html
Changes:
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.
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.
http://kmarkku.arkku.net/Perspective_tra...aster.html
Changes:
- 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".
- 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.
- 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.
- You choose 4 points on the distorted circle; let us call them A0,A1,A2,A3.
- From those you make the source path: it has A0,A1,A2,A3 as its 4 anchors.
- Then you imagine a circle as a clock face, and you choose 4 points on the dial, for example hours 12,3,6,9.
- You insert this data in the GUI of the plugin.
- Then you run the plugin.
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.