Posts: 1,147
Threads: 178
Joined: Sep 2018
Reputation:
114
Operating system(s):
- Windows (Vista and later)
Gimp version: 2.10
Sorry, but I can't let the plugin version 2 work to correct round objects. I've tried on several things like stained windows, technical drawings, round box,... and the result is not correct.
(Windows10, gimp 2.10.22).
Box before the plugin with path
Box after using the plugin. The red circle is for controlling the roundness.
If I press CTRL and left mouse button appear a white rectangular box round the path
Posts: 1,048
Threads: 87
Joined: Aug 2018
Reputation:
83
Operating system(s):
- Windows (Vista and later)
Gimp version: 2.10
11-05-2020, 06:04 PM
(This post was last modified: 11-05-2020, 06:58 PM by Krikor.)
I tried it with both forms, with 2 paths and with path and rectangle.
I prefer the first.
From top to bottom, 02 paths, Path + Rectangle, Original.
Denzjos, try 45 for the option "Rotate the target rectangle (degrees)
https://i.imgur.com/ChsKH74.png
Posts: 236
Threads: 26
Joined: Mar 2020
Reputation:
29
Operating system(s):
- Windows (Vista and later)
Gimp version: Don't know yet
(11-05-2020, 04:40 PM)denzjos Wrote: Sorry, but I can't let the plugin version 2 work to correct round objects. I've tried on several things like stained windows, technical drawings, round box,... and the result is not correct.
(Windows10, gimp 2.10.22).
I notice that you have the setting for "Operation backwards?" as "Yes". Why so? Try with "No". I put that option there only since some Gimp's tool has some similar mode to do operation backwards (inverse operation).
The normal way to use the plugin is when you are trying to make a correction to a distorted figure (a distorted rectangle or circle perhaps). Then the option should be "No".
But if you do the operation backwards (the option is "Yes") then the plugin makes the inverse transformation (goes backwards), and a true rectangle or circle becomes distorted as defined by the path. I guess that if you have a distorted circle to begin with, and you make the path as for correcting the figure, but you do the operation backwards, you get the circle doubly distorted.
So please try with "No" and report back.
The wordings in the plugin could be clearer. Suggestions are welcome.
By the way, the newer plugin is meant to correct distorted rectangles (but can be used for circles too though clumsily). I am now writing another plugin that is dedicated to correcting distorted circles. Perhaps it will be easier to use for such pictures. I hope to publish it in a couple of days.
Posts: 1,147
Threads: 178
Joined: Sep 2018
Reputation:
114
Operating system(s):
- Windows (Vista and later)
Gimp version: 2.10
@Krikor, thanks for the response, I tried it out with another image an enclosed the flow in this reply (nearly correct).
@Ottia Tuota, the screen dump with the 'Operation backwards' was not ok, I've tried it with different settings, and this was a wrong screen dump. Now I tried it with a other drawing.
Posts: 236
Threads: 26
Joined: Mar 2020
Reputation:
29
Operating system(s):
- Windows (Vista and later)
Gimp version: Don't know yet
So, perhaps I now understand where the problem is. Plugin #2 is designed to correct rectangles, not circles, and it works as follows: You have a distorted rectangle. You make the source path so that its anchors are at the corners of the distorted rectangle. Then you call the plugin.
But if you nevertheless want to use this plugin to correct a distorted circle, you can do as follows, for example. You have to find on the distorted circle 4 points that should be corners of a square after the correction (this is not trivial). You make a path from those 4 points. Then you make a square selection (rectangular with aspect ratio 1:1). Then you call the plugin by choosing
- the source path to be that 4-anchor path,
- the target rectangle to be the selection.
What the plugin does, is that it transforms the 4 anchors of the path to the corners of the target rectangle (the square). If everything is done right, the distorted circle should be corrected. But the problem here is, how to find those 4 points on the distorted circle that should form a square when corrected. Any choice of 4 points will not do.
Your last picture shows that you did as follows, if I guess right: Choose the 4 points on the distorted circle at: top, right, bottom, left. Then call the plugin. In this case those 4 points indeed form a square when corrected, so the result is ok.
There is no magic here. It would be great if we had a plugin which could be given any distorted circle and it would find the correction automatically. But my plugin is very simple. You have to understand what it does: It transforms the 4 anchors to the corners of the target rectangle.
I shall soon publish another plugin to correct circles, but it will do no magic either. It is just a variation of the same theme.
Posts: 236
Threads: 26
Joined: Mar 2020
Reputation:
29
Operating system(s):
- Windows (Vista and later)
Gimp version: Don't know yet
New version 0.3 is now available at
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".
- 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.
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.
Posts: 1,048
Threads: 87
Joined: Aug 2018
Reputation:
83
Operating system(s):
- Windows (Vista and later)
Gimp version: 2.10
11-10-2020, 09:04 PM
(This post was last modified: 11-10-2020, 09:43 PM by Krikor.)
The plugin ran smoothly.
I don't know if I understood the mechanics of the operation well, but this is what I achieved using the 4 points to circle plugin:
Posts: 236
Threads: 26
Joined: Mar 2020
Reputation:
29
Operating system(s):
- Windows (Vista and later)
Gimp version: Don't know yet
(11-10-2020, 09:04 PM)Krikor Wrote: The plugin ran smoothly.
I don't know if I understood the mechanics of the operation well, but this is what I achieved using the 4 points to circle plugin:
I think you got it right. I guess you chose from the original distorted circle 4 points that should (after correction) be at points 12,3,6,9 on a clock face, and then you ran the plugin with the defaults (hours 12,3,6,9).
I am becoming very aware of that it is difficult to formulate and explain such plugins so that they would be easy to understand and use. When I have been pondering and pondering a problem for a long time, everything becomes so clear in my mind that I just cannot imagine what it looks like for somebody who sees it for the first time. Also, I develop fixed ideas and can no longer see other points of view. So, any suggestions for making things clearer are always welcome.
Posts: 1,048
Threads: 87
Joined: Aug 2018
Reputation:
83
Operating system(s):
- Windows (Vista and later)
Gimp version: 2.10
(11-11-2020, 06:16 AM)Ottia Tuota Wrote: I think you got it right. I guess you chose from the original distorted circle 4 points that should (after correction) be at points 12,3,6,9 on a clock face, and then you ran the plugin with the defaults (hours 12,3,6,9).
You are correct, that was my approach.
I basically ran the plugin without changing the default settings, I just provided the requested path as the starting position.
(11-11-2020, 06:16 AM)Ottia Tuota Wrote: I am becoming very aware of that it is difficult to formulate and explain such plugins so that they would be easy to understand and use. When I have been pondering and pondering a problem for a long time, everything becomes so clear in my mind that I just cannot imagine what it looks like for somebody who sees it for the first time. Also, I develop fixed ideas and can no longer see other points of view. So, any suggestions for making things clearer are always welcome.
It is common to find tutorials in which the following steps are not self-explanatory, but in the author's mind everything seems simple and clear. But in this case it seems to me that the explained way of using the plugin was very detailed.
The difficulty lies in choosing points A0, A1, A2 and A3. Due to distortion of the original image, this choice will not always be easy, especially if the distortion of the image occurs on the X and Y axes. (Or x, y, z).
Thanks for the update!
Posts: 117
Threads: 15
Joined: Jan 2019
Reputation:
9
Operating system(s):
Gimp version: 2.10
Really nice plugin.
Just using it for straightening perspective DVD cover images like Amazon and other outlets will use sometimes, and it worked perfectly.
Thanks!
|