12-05-2020, 04:21 PM
I pondered a little about that difficulty to set the would-be center exactly. This lead to a new plugin. New version is 0.7, available at:
http://kmarkku.arkku.net/Perspective_tra...aster.html
The new plugin is called "Perspective transform - 2+2+2 points to circle (3 diameters)". The idea is that, depending on the picture, setting diameters may be easier than setting the would-be center. And the center can be computed as the intersection of any pair of diameters. The new plugin takes as input 3 diameters (no center).
By a diameter I mean a line segment that connects two points on the distorted circle such that those points should become diametrically opposite points of the corrected circle.
Example: On the left is a figure. I made it on purpose such that the center point is not shown. On the right is the test figure: the original figure distorted by the Perspective transform tool. Now I want to correct the distortion back.
The plugin takes as input 3 diameters (diameter 1, diameter 2, diameter 3). In the next picture, on the left you see the distorted figure equipped with the three diameters (blue) that I used: line segments connecting hours 12-6, 2-8, and 4-10; the end points are on the inner ellipse. I ran the plugin with those diameters, and the result is on the right. It looks very much like the original figure except that it is a little blurred.
In this particular picture the diameters are easy to draw (but to get them exact enough it is best to zoom in).
In addition to the 3 diameters, the plugin takes as input a fourth 2-anchors path (any line segment). It is used to determine the orientation (rotation): its direction can be turned vertical (default) or horizontal or kept as it is. In the above example I used diameter 1 (hours 12-6) as that direction path, and since I used the default value, the plugin turned that diameter to be vertical which was good.
The diameters intersect roughly at one spot, and that is what you should try to achieve when drawing the diameters. (Note again the interesting fact that the intersection point is not the center of the ellipse.)
There are now three plugins for correcting a circle. The first (clock face) is a direct application of the idea of building a projective transformation from 4 source points and 4 target points (the latter given as hours on a clock face). The two others are based on the new idea of (1) solving an ellipse from its 5 points, and (2) setting the center point.
I hope that I shall get no more new ideas about this problem. Another project was interrupted when I started with these plugins, and I am anxious to go back to it. But if you have any good suggestions, please say them aloud. I have now all pieces ready and fresh in my mind, and from them I could make different versions of the plugins with different inputs.
http://kmarkku.arkku.net/Perspective_tra...aster.html
The new plugin is called "Perspective transform - 2+2+2 points to circle (3 diameters)". The idea is that, depending on the picture, setting diameters may be easier than setting the would-be center. And the center can be computed as the intersection of any pair of diameters. The new plugin takes as input 3 diameters (no center).
By a diameter I mean a line segment that connects two points on the distorted circle such that those points should become diametrically opposite points of the corrected circle.
Example: On the left is a figure. I made it on purpose such that the center point is not shown. On the right is the test figure: the original figure distorted by the Perspective transform tool. Now I want to correct the distortion back.
The plugin takes as input 3 diameters (diameter 1, diameter 2, diameter 3). In the next picture, on the left you see the distorted figure equipped with the three diameters (blue) that I used: line segments connecting hours 12-6, 2-8, and 4-10; the end points are on the inner ellipse. I ran the plugin with those diameters, and the result is on the right. It looks very much like the original figure except that it is a little blurred.
In this particular picture the diameters are easy to draw (but to get them exact enough it is best to zoom in).
In addition to the 3 diameters, the plugin takes as input a fourth 2-anchors path (any line segment). It is used to determine the orientation (rotation): its direction can be turned vertical (default) or horizontal or kept as it is. In the above example I used diameter 1 (hours 12-6) as that direction path, and since I used the default value, the plugin turned that diameter to be vertical which was good.
The diameters intersect roughly at one spot, and that is what you should try to achieve when drawing the diameters. (Note again the interesting fact that the intersection point is not the center of the ellipse.)
There are now three plugins for correcting a circle. The first (clock face) is a direct application of the idea of building a projective transformation from 4 source points and 4 target points (the latter given as hours on a clock face). The two others are based on the new idea of (1) solving an ellipse from its 5 points, and (2) setting the center point.
I hope that I shall get no more new ideas about this problem. Another project was interrupted when I started with these plugins, and I am anxious to go back to it. But if you have any good suggestions, please say them aloud. I have now all pieces ready and fresh in my mind, and from them I could make different versions of the plugins with different inputs.