Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Perspective transform revisited
#31
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.
Reply
#32
Ottia Tuota,
This new plugin is much more intuitive to use and the result was also very satisfactory.
Top to bottom: Original - Distorted - Fixed.
   
Thx by the plugin!
Reply
#33
Ottia Tuota, the 07 version of the plugin is easy to use, good job. Thanks

.xcf   stained glass willaert.xcf (Size: 538.47 KB / Downloads: 255)
Reply
#34
I am glad you both liked it.

Yes, these things are not invented. They grow. One thing leads to another. Every now and then one gets a new idea though much too seldom. And the first ideas are almost never the best.

Denzjos: You do have nice example pictures. I mention one small fact that I was going to mention when I announced the plugin but didn't after all. Your three diameter paths don't intersect quite in the same point. That does not really matter much. The plugin works so that it finds the would-be center by taking the inersection of the diameters. But it takes the intersection from two diameters at a time, getting three intersection points, and then uses the average of those as the would-be center. So, it always gets some result. In such real-world pictures you really cannot expect to have quite exact diameters anyhow.
Reply


Forum Jump: