-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Dewarp before selecting content #67
Comments
@Mister-Teatime say:
Fixed: transform method: nothing [+ deskew [+ deperspective [+ dewarp ]]] See also https://github.com/tibob/yasw , https://github.com/ImageProcessing-ElectronicPublications/yasw , 4lex4/scantailor-advanced#85 , https://github.com/scantailor/scantailor/issues/317 . |
If I get you right, you're suggesting to split the current dewarp tool into two components? That sounds nice to me. It kinda does that already, when manually picking four corners and not adding control points, but I'd quite like the ability to (for example) turn the additional control points on/off (by switching between deperspective and dewarp modes), or picking the page corners by hand, then but leaving dewarp on auto so it can find the control points to make the control cage match the paper edge. |
I would also consider this very useful, as content could then be selected on the dewarped picture (otherwise you have to estimate how your image will look). It would just make a lot more sense. I tried the experimental branch from the original author (https://github.com/Tulon/scantailor/tree/experimental) which already has dewarp before content selection. Could it be ported to ST Universal? |
Hi, Currently I'm leisurely working on 2 other features: ellipse zones (among polylines and rects) and brand new last processing stage that will automatically encode output images into bundled DjVu doc using a so-called "Separated scans method" with minidjvu_mod.exe as an encoder. |
Hi @trufanov-nok . It would be nice to create a separate utility combining djvu created by minidjvu (BW) and djvu created by c44 and djvm (illustrations). |
Hi, @zvezdochiot |
@trufanov-nok I understand you don't want to spend time on dewarp if you don't have a use for it yourself, but I think it's a very nice feature and for me, it's the main/only reason to use ScanTailor. I'm digitalizing books, too, and the warping / wrong geometry that I get makes the pages look bad and difficult to read. If I didn't use dewarp, I would have the choice to either remove page content or include a lot of unneeded space in the end result. |
@mara004 say:
Do you mean https://github.com/jwilk/didjvu ? But http://djvu.sourceforge.net/ !: man djvumake cjb2 mymask.pbm mymask.djvu
djvumake my.djvu Sjbz=mymask.djvu PPM=myimage.ppm |
Hmm, for me, dewarping always worked very well, except for the problem that it's at the wrong point. (However, I agree that automatic dewarping fails a lot - one has to adjust it manually to achieve good results)
Okay, I see. |
I'd like to echo what mara said: Although I'd like to have a look at Tulon's new openCL-based dewarp, my request really is "simply" to move the dewarp tool from its current place to before content selection. I've tried and failed a few times to compile the experimental branch on my machine, but I've been working in Python only for so long, and compiling code is a distant memory to me, so I don't really know what I'm doing... I know that there may be a lot more consequences to changing the order of execution than moving GUI elements, of course, but on the GUI side, I'd imagine that the "dewarp" tab would disappear from the output view and show up in the "Deskew" view, and then all following steps would be performed on the dewarped (or just rotated) version of the scan. There's any number of things which could be updated and improved on the deskewing and dewarping process, but really, this request is only about having at an earlier stage. |
@Mister-Teatime Sorry for my late response, but if you want to, I can try to help you compile ScanTailor Experimental (on Linux). I too had never done any c++ compiling before and the ScanTailor branches were one of my very first tries. It's actually not that difficult. The only thing which can be a bit tough is to get all dependencies (in particular for OpenCL it depends on your GPU vendor which packages you need to install). I assume you are using a Linux distribution? In case you are on Windows, you don't necessarily need to compile it yourself, you can just use a pre-release binary from |
@mara004 say:
This is because a flexible mesh is used. A local affine transformation of quadrangles into rectangles would be used, it would be more reliable and simpler. |
@Mister-Teatime Another problem with building ST Experimental that I forgot to mention above can be missing QPainterPath includes at some source files. With newer Qt (I believe at least since 5.15), you need to explicitly include it. Previously, that wasn't mandatory. If you get error messages from the compiler related to QPainterPath, then just try adding |
@zvezdochiot Okay, interesting. However, I only experienced these dewarping problems in ST Experimental but not in ST Advanced |
@mara004 Thanks a bunch for the good advice! I did take some time to get back to dealing with Scantailor, but I did, eventually. Anyway, turned out I had to install Eigen first, and adding the ... any smart ideas? |
@Mister-Teatime try to add |
Oh, that was an easy fix! Thanks a lot for the hint! I would not expected that to work, but it did. The Experimental branch just finished compiling and is running! I used that as an opportunity to get accustomed to Git (as a long-time TortoiseHG user). I wonder if I could submit the new includes as a patch/pull request or something, to spare others the trouble of doing that manually ... but I won't have time to work that out before next weekend, I think. |
Hi @zvezdochiot |
I viewed the examples, but this does not seem to be what I'm looking for. |
Yeah, I know. STE is the variant I'm using ATM (see above). For clarity, the removal of some other features is not logically caused by third-stage dewarping, I think it's just that this improvement was committed amidst a deep technical refactoring (eigen, opencl). |
Question though: How does https://github.com/ImageProcessing-ElectronicPublications/scantailor-experimental (A) differ from @Tulon's https://github.com/Tulon/scantailor/tree/experimental (B) ? |
Yes, I mean ScanTailor Experimental, not Enhanced.
Thanks. FYI, I had made a similar private fork/patch some time ago, yours may be better though: |
I'm digitizing books which I'd rather not press flat against a scanner, which are much quicker digitized by means of setting up decent light, lying them flat on the floor and pointing a good camera straight down at them.
This causes quite a bit of warping (particularly with softcovers), which the dewarping algorithm deals with reasonably well.
However, I have to select the pages, their content and in some cases pictures beforehand, and Scantailor assumes that most of these things were rectangular (which they only become afterwards ...). For image maps, I can use polygons instead, for content selection I can adjust content boxes after the fact (iteratively...), but these workarounds take significantly more time than if the contents were nicely aligned, and sometimes the box around content will have corners off-page, despite ample page margins
This often makes me wish I could reverse the order of those steps, and do the dewarping first.
I'm not familiar with the code architecture (yet...?) but I would hope that it must be possible to change the order of processing steps to put dewarping before the content selection stage.
I would imagine that the automatic content detection should also have an easier time with dewarped inputs.
Proposed implementation:
I'm not familiar with Scantailor's code structure, so I can only comment on what would make sense from a user's perspective -- so I accept that some of the following may not be practically realistic, or that there are smarter/faster ways to get a working implementation.
My favourite implementation would be to bundle the dewarping with the deskewing step. It seems to me that the dewarp tool would be able to replace the "deskew" (i.e. rotation) function, as it can represent rotation, too. This might be overkill for users who really just need to rotate the contents a little, but since dewarping is already optional, it could stay optional, either following the rotation step, or optionally replacing it. ("deskew method: nothing | rotate | dewarp")
The text was updated successfully, but these errors were encountered: