trufanov-nok / scantailor-universal

ScanTailor Universal - a fork based on Enhanced+Featured+Master versions of ST
http://scantailor.org
Other
181 stars 16 forks source link

feature_request(dewarping): select areas for auto dewarping #90

Open Kristinita opened 3 years ago

Kristinita commented 3 years ago

#67 — possibly related issue

1. Summary

In some cases, I get bad auto dewarping output. It would be nice if ScanTailor Universal users can use auto dewarping for them.

2. Case 1 — Free space above a page number

Auto dewarping may give poor results when a lot of free space between the end of the text and the page number at the bottom of it.

Example:

2.1. Bad dewarping

  1. Scan image:

    1 Scan image

  2. I selected content with the page number:

    1 Select with number

  3. OutputDewarpingAuto:

    1 Dewarping auto

    I don’t want this “Star Wars” output.

  4. Dewarping tab:

    1 Dewarping

2.2. Good dewarping

  1. I selected content without the page number:

    1 Select without number

  2. Dewarping tab:

    1 Dewarping normal

  3. Dewarping nice:

    1 Dewarping without number normal

    But a problem — no page number at the bottom.

3. Case 2 — Different fonts on the page

Also, auto dewarping may not work correctly if different fonts and design used in one page.

Example:

3.1. Bad dewarping

  1. Scan image:

    2 Input image

  2. I selected all:

    2 Select with head

  3. Dewarping tab:

    2 Dewarping

  4. Auto dewarping result:

    2 Dewarping auto

    This is not at all what I wanted.

3.2. Good dewarping

  1. I can select solely the text without the header:

    2 Select without head

  2. Dewarping tab in this case:

    2 Dewarping normal

  3. I get a nice dewarping:

    2 Dewarping without head normal

    But without the header.

4. Feature request — Select areas for auto dewarping

If you know better solutions for the problem, please tell me about them.

4.1. Desired behavior

Users optionally will be able to manually select areas for auto dewarping → auto dewarping will apply solely for these selected areas. For example, for cases above it would be nice, if dewarping will apply solely for areas inside red rectangles:

1 dewarping areas

2 dewarping areas

5. Reply to possible counterargument

5.1. “Use manual, not auto dewarping”

I tried manual dewarping, but it looks like it hard and time-consuming for the user.

Thanks.

mara004 commented 1 year ago

Thanks for the illustrative write-up. Yes, improved auto dewarping in ST would be nice.


User hint: There's an old windows program "BookRestorer v4.2.1" from i2s which seems to provide relatively good auto dewarp results. It runs well on Wine emulator. You can pipe the input through BookRestorer just for dewarping and then do the other processing with ScanTailor. If BookRestorer's auto-dewarping fails, one can still emplace the original files and dewarp them manually with ScanTailor.

Originally suggested by @4lex4 in https://github.com/4lex4/scantailor-advanced/issues/22#issuecomment-39664376

BookRestorer_v4.zip