Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flattening a scanned book
#21
What I did was the following:

01- I reproduced the steps presented by denzjos in post #18;  ( With this I created 3 paths: Top, Bottom and guides vectors )

02- I duplicated the paths (Top and Bottom);
03- This left me with 4 paths - Top, Bottom, Top copy, Bottom copy and Guides vectors;
04 - I applied the Replicate path by affine mapping plugin, between the paths: Top and Top copy, generating the Top replicate path;
05- I applied the Repliacte path by affine mapping plugin between the Bottom and Bottom copy paths, thus creating the Bottom replicate path.
06- Finally, I applied the script provided by rich2005 - Distortion Correction Between Paths  (on the Top repliaction and Bottom repliation paths) ... and voilà

This way it was possible to follow the steps given by denzjos and get the script working correctly.
                               .....
Samj PortableGimp 2.10.28 - Win-10 /64.
Reply
#22
(12-16-2023, 04:33 PM)Krikor Wrote: Maybe Ofnuts will be interested in the subject and create something along these lines :-)

Thought about it but the very complicated bit is that you also have to non-uniformly stretch things laterally. In this piece of squared paper, all the vertical lines should be regularly spaced:

   

But this is far from being really the case.

   

And I can't find a usable way to deduce the actual distortion from simple image characteristics, because if some of it is caused by the page curling, a good part of it is also due to the distance difference with the lens. I have done something similar in the past, for bottles and for scanners, but each works on only one kind of distortion (and in the case of the scanner, the distortion is constant).
Reply
#23
(12-16-2023, 06:50 PM)Krikor Wrote: What I did was the following:

01- I reproduced the steps presented by denzjos in post #18;  ( With this I created 3 paths: Top, Bottom and guides vectors )

02- I duplicated the paths (Top and Bottom);
03- This left me with 4 paths - Top, Bottom, Top copy, Bottom copy and Guides vectors;
04 - I applied the Replicate path by affine mapping plugin, between the paths: Top and Top copy, generating the Top replicate path;
05- I applied the Repliacte path by affine mapping plugin between the Bottom and Bottom copy paths, thus creating the Bottom replicate path.
06- Finally, I applied the script provided by rich2005 - Distortion Correction Between Paths  (on the Top repliaction and Bottom repliation paths) ... and voilà

This way it was possible to follow the steps given by denzjos and get the script working correctly.

Krikor, thanks for the tip. I can replicate your workflow, but the 'Distortion Correction Between Paths'  result in an error. Can you make a screenshot (and post it) from the setting in the 'Replicate path by affine mapping' you used? Thanks in advance.
Reply
#24
[attachment=10884 Wrote:denzjos pid='37141' dateline='1702805981']
(12-16-2023, 06:50 PM)Krikor Wrote: What I did was the following:

01- I reproduced the steps presented by denzjos in post #18;  ( With this I created 3 paths: Top, Bottom and guides vectors )

02- I duplicated the paths (Top and Bottom);
03- This left me with 4 paths - Top, Bottom, Top copy, Bottom copy and Guides vectors;
04 - I applied the Replicate path by affine mapping plugin, between the paths: Top and Top copy, generating the Top replicate path;
05- I applied the Repliacte path by affine mapping plugin between the Bottom and Bottom copy paths, thus creating the Bottom replicate path.
06- Finally, I applied the script provided by rich2005 - Distortion Correction Between Paths  (on the Top repliaction and Bottom repliation paths) ... and voilà

This way it was possible to follow the steps given by denzjos and get the script working correctly.

Krikor, thanks for the tip. I can replicate your workflow, but the 'Distortion Correction Between Paths'  result in an error. Can you make a screenshot (and post it) from the setting in the 'Replicate path by affine mapping' you used? Thanks in advance.

Ofnuts,
I understood what you explained.
Deep down, we laymen always think that you plugin/script wizards can do magic and create any kind of thing.

denzjos,
By chance I still had this case open in my Gimp. So I saved it as .XCF and will leave it attached.

There are some small differences, the names of the paths are different, since in the forum here I used names to better exemplify the steps I used.
Here's the screenshot - I opened the plugin and these are the sets I must have used last, as I don't remember using this plugin after describing the steps in my last post.
   


Attached Files
.xcf   NoName.xcf (Size: 684.06 KB / Downloads: 41)
                               .....
Samj PortableGimp 2.10.28 - Win-10 /64.
Reply
#25
(12-17-2023, 04:07 PM)Krikor Wrote:
(12-17-2023, 09:39 AM)denzjos Wrote:
(12-16-2023, 06:50 PM)Krikor Wrote: What I did was the following:

01- I reproduced the steps presented by denzjos in post #18;  ( With this I created 3 paths: Top, Bottom and guides vectors )

02- I duplicated the paths (Top and Bottom);
03- This left me with 4 paths - Top, Bottom, Top copy, Bottom copy and Guides vectors;
04 - I applied the Replicate path by affine mapping plugin, between the paths: Top and Top copy, generating the Top replicate path;
05- I applied the Repliacte path by affine mapping plugin between the Bottom and Bottom copy paths, thus creating the Bottom replicate path.
06- Finally, I applied the script provided by rich2005 - Distortion Correction Between Paths  (on the Top repliaction and Bottom repliation paths) ... and voilà

This way it was possible to follow the steps given by denzjos and get the script working correctly.

Krikor, thanks for the tip. I can replicate your workflow, but the 'Distortion Correction Between Paths'  result in an error. Can you make a screenshot (and post it) from the setting in the 'Replicate path by affine mapping' you used? Thanks in advance.

Ofnuts,
I understood what you explained.
Deep down, we laymen always think that you plugin/script wizards can do magic and create any kind of thing.

denzjos,
By chance I still had this case open in my Gimp. So I saved it as .XCF and will leave it attached.

There are some small differences, the names of the paths are different, since in the forum here I used names to better exemplify the steps I used.
Here's the screenshot - I opened the plugin and these are the sets I must have used last, as I don't remember using this plugin after describing the steps in my last post.
Krikor , thanks for the information but I can't get the handles from the the nodes symmetric. In your example the path layer 'top|chop' and 'top|chop copy' have a handle that point to the left direction. The path layer 'Path Top' have symmetric handles on the nodes. I can not reproduce this with the 'Replicate path by affine mapping'. After using the plugin the handles still pointing to the left and are not symmetric.
Reply
#26
(12-18-2023, 10:49 AM)denzjos Wrote:
(12-17-2023, 04:07 PM)Krikor Wrote:
(12-17-2023, 09:39 AM)denzjos Wrote: Krikor, thanks for the tip. I can replicate your workflow, but the 'Distortion Correction Between Paths'  result in an error. Can you make a screenshot (and post it) from the setting in the 'Replicate path by affine mapping' you used? Thanks in advance.

Ofnuts,
I understood what you explained.
Deep down, we laymen always think that you plugin/script wizards can do magic and create any kind of thing.

denzjos,
By chance I still had this case open in my Gimp. So I saved it as .XCF and will leave it attached.

There are some small differences, the names of the paths are different, since in the forum here I used names to better exemplify the steps I used.
Here's the screenshot - I opened the plugin and these are the sets I must have used last, as I don't remember using this plugin after describing the steps in my last post.
Krikor , thanks for the information but I can't get the handles from the the nodes symmetric. In your example the path layer 'top|chop' and 'top|chop copy' have a handle that point to the left direction. The path layer 'Path Top' have symmetric handles on the nodes. I can not reproduce this with the 'Replicate path by affine mapping'. After using the plugin the handles still pointing to the left and are not symmetric.

To make handles symmetric just drag one of them with the Shift key pressed.
Reply
#27
(12-18-2023, 12:00 PM)Ofnuts Wrote:
(12-18-2023, 10:49 AM)denzjos Wrote:
(12-17-2023, 04:07 PM)Krikor Wrote: Ofnuts,
I understood what you explained.
Deep down, we laymen always think that you plugin/script wizards can do magic and create any kind of thing.

denzjos,
By chance I still had this case open in my Gimp. So I saved it as .XCF and will leave it attached.

There are some small differences, the names of the paths are different, since in the forum here I used names to better exemplify the steps I used.
Here's the screenshot - I opened the plugin and these are the sets I must have used last, as I don't remember using this plugin after describing the steps in my last post.
Krikor , thanks for the information but I can't get the handles from the the nodes symmetric. In your example the path layer 'top|chop' and 'top|chop copy' have a handle that point to the left direction. The path layer 'Path Top' have symmetric handles on the nodes. I can not reproduce this with the 'Replicate path by affine mapping'. After using the plugin the handles still pointing to the left and are not symmetric.

To make handles symmetric just drag one of them with the Shift key pressed.

Ofnuts, thank you for the reply. I know about the symmetric handles with the shift key pressed, but I could not follow Krokors workflow on his example. In his descripten of his workflow it seems he used the Replicate path by affine mapping plugin to do this. I did'nt understand this manipulation and also I could'nt get symmetric handles. So, confusing about how Krikor did it automatically with this plugin.  
Reply
#28
Quote:What I did was the following:

01- I reproduced the steps presented by denzjos in post #18;  ( With this I created 3 paths: Top, Bottom and guides vectors )

02- I duplicated the paths (Top and Bottom);
03- This left me with 5 paths - Top, Bottom, Top copy, Bottom copy and Guides vectors;
04 - I applied the Replicate path by affine mapping plugin, between the paths: Top and Top copy, generating the Top replicate path;
05- I applied the Repliacte path by affine mapping plugin between the Bottom and Bottom copy paths, thus creating the Bottom replicate path.
06- Finally, I applied the script provided by rich2005 - Distortion Correction Between Paths  (on the Top repliaction and Bottom repliation paths) ... and voilà


(12-16-2023, 08:51 AM)denzjos Wrote: I tried the script with bended paths but it seems only working with straight paths. On my configuration the script is working fine (windows10 / gimp 2.10.36). I discovered the script is only working with straight paths parts this way (I could be wrong) :
Make a curved path on top and bottom.
Make a guides grid : Image / Guides / Grid  (use only vertical guides - max 17)
Delete the horizontal guide (because the minimal value for guides in the guide grid script is 1)   
Image / Guides / Guides To Path
Make guides invisible : Shift+CTRL+T
Top path : Tools / Chopping / Chop path by another path (chop curved path with converted guides)
Bottom path : Tools / Chopping / Chop path by another path (chop curved path with converted guides)
Edit / Join Strokes
Now using the script I got an error.
When I want to use the script this way I only miss a script / plugin to straighten the chopped bended path parts. Exist such a script / plugin?

(12-18-2023, 10:49 AM)denzjos Wrote: Krikor , thanks for the information but I can't get the handles from the the nodes symmetric. In your example the path layer 'top|chop' and 'top|chop copy' have a handle that point to the left direction. The path layer 'Path Top' have symmetric handles on the nodes. I can not reproduce this with the 'Replicate path by affine mapping'. After using the plugin the handles still pointing to the left and are not symmetric.


denzjos,

If you look closely, you will see that the handles automatically became symmetrical after Edit - Join Strokes

Just compare, before applying Join Strokes, the handles are facing to the left.

However....

I retraced my steps, as stated in post #21, but to my surprise I couldn't get the script to work correctly; only those error messages appeared as a result of using the script.

So I spent a lot of time retracing all the steps and looking for something I had done and not noted.

One of the things I did but didn't comment on, because I thought it hadn't made any difference, was to apply Edit - Reverse strokes twice on the same paths, trying to reorient the path nodes from left to right. (but then I thought it didn't make sense, so I didn't comment).

In short, even following my steps several times I was unable to get the script to work.

But when I get the .xcf (the same one I sent as an attachment in my previous post) I can make the script work perfectly.

This means that I was missing something in reproducing my own steps.

Fortunately I was able to make the script work again and curve the text depending on the paths created.

I started to create the curve with the paths so that the ends go beyond the margins of the documents.
In other words, go beyond the vertical paths on the sides.

   

With this, when the paths are chopped and before being joined, I remove these extreme "ends", leaving the second and penultimate nodes as the first and last respectively. This applies to both the upper and lower paths.

Also, I believe that the Alpha channel layer makes a difference!
Then add Alpha channel to the layer where the script will be applied.

It is necessary to ensure that all nodes are aligned (top and bottom).

Perhaps due to 'snap to guides' being active, I had the top node at position (-0.0, 94.1) while the bottom node was at (0.0, 94.1).

Only after correcting the top node to (0.0, 94.1) did the script work.

   

In other words, there are many small details, which, if not followed, prevent the correct execution of the script if curved paths are used, instead of straight ones (as per rich2005's example).
   


Attached Files
.xcf   NoName0002.xcf (Size: 680.69 KB / Downloads: 39)
                               .....
Samj PortableGimp 2.10.28 - Win-10 /64.
Reply
#29
@Krikor, thank you for the reply. I'll try it out.
Reply
#30
@Krikor, after using your update information the workflow is working fine. Thanks. A quick example using the workflow on a free photo from the internet (not 100% level, but it was a quick try):
   

I'm not a gimp programmer but it must be possible to make a script from this workflow.
Reply


Forum Jump: