Daniel Reetz, the founder of the DIY Book Scanner community, has recently started making videos of prototyping and shop tips. If you are tinkering with a book scanner (or any other project) in your home shop, these tips will come in handy. https://www.youtube.com/channel/UCn0gq8 ... g_8K1nfInQ

First build with automatic dewarping

Scan Tailor specific announcements, releases, workflows, tips, etc. NO FEATURE REQUESTS IN THIS FORUM, please.
spamsickle
Posts: 596
Joined: 06 Jun 2009, 23:57

Re: First build with automatic dewarping

Post by spamsickle » 04 Mar 2011, 19:09

Ah, I understand.

You may be right, but my experience with the Photoshop scripts and Book Scan Wizard makes me think that, for keystone correction anyway, there's enough similarity from one same-side page to the next that the same manual grid would probably work well enough to satisfy me. Since you solved my compile problem, I can play around with the code to see if that thought is justified.

In the project file, I find this:

Code: Select all

  <distortion-model>                                                                
    <top-curve>                                                                     
      <xspline>                                                                     
        <point x="2899.653965154599" y="572.726352586418"/>                         
        <point x="2902.540373650997" y="912.3144924431959"/>                        
        <point x="2905.426782147395" y="1251.902632299974"/>                        
        <point x="2908.313190643795" y="1591.490772156753"/>                        
        <point x="2911.199599140193" y="1931.07891201353"/>                         
      </xspline>                                                                    
      <polyline>dzo1RX0uD0SlaDVFIRRkRNSWNUXifJxEA8U1RbTvxkQy8zVFhmLxRA==</polyline> 
    </top-curve>                                                                    
    <bottom-curve>                                                                  
      <xspline>                                                                     
        <point x="534.3417606708167" y="552.08458569402"/>                          
        <point x="525.0791997189333" y="891.5667031006279"/>                        
        <point x="515.8166387670499" y="1231.048820507238"/>                        
        <point x="506.5540778151665" y="1570.530937913847"/>                        
        <point x="497.2915168632831" y="1910.013055320456"/>                        
      </xspline>                                                                    
      <polyline>35UFRGoFCkQSRQNEReReRET0AESQ4ZlE7Eb9Q/1QxERQpfhDa8DuRA==</polyline> 
    </bottom-curve>                                                                 
  </distortion-model>                                                               
I've worked with splines before, so I think I understand that part, but the "polyline" format is new to me. Can you suggest a reference to help get me up to speed before I start digging through the code?


spamsickle
Posts: 596
Joined: 06 Jun 2009, 23:57

Re: First build with automatic dewarping

Post by spamsickle » 05 Mar 2011, 00:39

Tulon wrote:You are only applying dewarping mode (off, manual, auto). Applying the grid itself is not implemented, as I don't think that will work well enough.
Actually, this doesn't seem to be happening either. I shift-selected a group of 4 pages, changed one from "off" to "auto", and said "apply to selected", but only the page I changed had the dewarping mode set to "auto". On the other 3 pages, dewarping remained "off".

Tulon
Posts: 687
Joined: 03 Oct 2009, 06:13
Number of books owned: 0
Location: London, UK
Contact:

Re: First build with automatic dewarping

Post by Tulon » 05 Mar 2011, 04:23

spamsickle wrote: I've worked with splines before, so I think I understand that part, but the "polyline" format is new to me. Can you suggest a reference to help get me up to speed before I start digging through the code?
[/quote]
Actually I think looking through the source code is the only way to understand this custom encoding. Look here for serializePolyline and deserializePolyline.
spamsickle wrote:I shift-selected a group of 4 pages, changed one from "off" to "auto", and said "apply to selected", but only the page I changed had the dewarping mode set to "auto". On the other 3 pages, dewarping remained "off".
There indeed seems to be a bug in the Apply dialog when checking "Selected pages" doesn't uncheck the previously selected option. I'll fix that soon. It's easy to workaround though by manually unchecking the other option.
Scan Tailor experimental doesn't output 96 DPI images. It's just what your software shows when DPI information is missing. Usually what you get is input DPI times the resolution enhancement factor.

spamsickle
Posts: 596
Joined: 06 Jun 2009, 23:57

Re: First build with automatic dewarping

Post by spamsickle » 05 Mar 2011, 09:21

Huh, I didn't even notice that the "this page only" button wasn't being unchecked when I checked "selected". Yes, that work-around gets the job done. Thank you.

Tulon
Posts: 687
Joined: 03 Oct 2009, 06:13
Number of books owned: 0
Location: London, UK
Contact:

Re: First build with automatic dewarping

Post by Tulon » 09 Mar 2011, 19:10

Beta10 has arrived: http://depositfiles.com/files/hn4xr1ur2
The most important change is an edge tracer integrated into the dewarping algorithm. There are still some rough edges, including one or two introduced by this new feature, but it's an important milestone anyway. It brings new hope for cases previously considered hopeless:
distortion_model.jpg
distortion_model.jpg (49.69 KiB) Viewed 5709 times
Scan Tailor experimental doesn't output 96 DPI images. It's just what your software shows when DPI information is missing. Usually what you get is input DPI times the resolution enhancement factor.

eL_PuSHeR
Posts: 125
Joined: 28 Jun 2010, 15:25

Re: First build with automatic dewarping

Post by eL_PuSHeR » 10 Mar 2011, 04:02

Thank you very much.

matt

Re: First build with automatic dewarping

Post by matt » 10 Mar 2011, 04:10

grab 2011-03-10 at 12.04.52 AM.PNG
grab 2011-03-10 at 12.04.52 AM.PNG (418.26 KiB) Viewed 5688 times
hi tulon, this new edge-tracing is very encouraging. thank you for your continued efforts!

please disregard if this is superfluous, but i found a pattern which seems to confuse the auto-dewarping algorithms, in particular the vertical line detection. as you can see in the attached image and project file, the non-aligned text in the top line distorts the otherwise very nice auto-dewarping-grid.

matt
Attachments
dewarping_test.zip
(539.98 KiB) Downloaded 259 times

Tulon
Posts: 687
Joined: 03 Oct 2009, 06:13
Number of books owned: 0
Location: London, UK
Contact:

Re: First build with automatic dewarping

Post by Tulon » 10 Mar 2011, 04:37

That's a known problem. I do have an idea on how to handle cases like that. I'll try that idea before releasing version 1.0
Scan Tailor experimental doesn't output 96 DPI images. It's just what your software shows when DPI information is missing. Usually what you get is input DPI times the resolution enhancement factor.

emmerick

Re: First build with automatic dewarping

Post by emmerick » 10 Mar 2011, 05:50

Tulon wrote:That's a known problem. I do have an idea on how to handle cases like that. I'll try that idea before releasing version 1.0
Hello, very good ta getting the SC, Tulon excellent work. Maybe if you put a bar top mark, equal to the sidebar of the last beta might help.

Post Reply