Skip to content
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 #47: binarizeEdgePlus #48

Conversation

zvezdochiot
Copy link

@zvezdochiot zvezdochiot commented May 3, 2023

Hi @vigri and @lightsilverberryfox .

⚠️ This PR is just a recipe. I was only able to build binarizeEdgePlus into the general functionality. At the same time, I use the Sauvola options, which I don’t think is correct (the new threshold requires smaller area values ​​and larger coefficient values). Due to this, projects with a new threshold are safely saved. Use this PR as a recipe.

Good Luck.


Example

Origin Otsu threshold Sauvola threshold Wolf threshold EdgePlus threshold EdgePlus threshold EdgePlus threshold
(screenshot from 600dpi scan) (default) (default: ws:200 c:0.34) (default) (default: ws:200 c:0.34) (manual: ws:20 c:0.80) (manual: ws:5 c:0.99 Equalize:0ff Savitzky-Golay:off)
screen-origin screen-otsu screen-sauvola screen-wolf screen-edgeplus-default screen-edgeplus-a20-c80 screen-edgeplus-a5-c99-off-sav-norm

Links

Closes #47

@zvezdochiot
Copy link
Author

zvezdochiot commented Jun 14, 2023

Hi @vigri , @lightsilverberryfox .

The usefulness of the new thresholds has been confirmed (worst part of the scanned material):

Origin Otsu Sauvola Wolf Wolf EdgePlus BlurDiv
(600dpi) (default) (default) (default) (ws:20,c:0.75) (ws:20,c:0.75) (ws:20,c:0.75)
test test otsu test sauvola test wolf test wolf_20_075 test edgeplus_20_075 test blurdiv_20_075

See threshold BlurDiv.

@zvezdochiot
Copy link
Author

zvezdochiot commented Jun 21, 2023

[Feature request] thresholdAdjustment in other threshold. #59

@zvezdochiot
Copy link
Author

@alfish2000
Copy link

Hi!
Is there any chance that the PRs here get merged and e.g. a new version 1.0.19 is released?
It gets confusing because it seems that this PR is now released here https://github.com/ImageProcessing-ElectronicPublications/scantailor-advanced as 1.0.18

@zvezdochiot
Copy link
Author

@alfish2000 say:

Is there any chance that the PRs here get merged and e.g. a new version 1.0.19 is released?

I don't hope so. Therefore, I release mods for existing releases. ;)

@ghost ghost requested review from vigri and a user June 25, 2023 12:20
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, the code seems to be fine, I don't understand how the EdgePlus algorithm works though... But if it works it should be okay. Let's see if @vigri has something to say.

@zvezdochiot zvezdochiot requested a review from a user June 25, 2023 13:31
@mara004
Copy link

mara004 commented Jun 25, 2023

Is there any chance that the PRs here get merged and e.g. a new version 1.0.19 is released?

I don't hope so. Therefore, I release mods for existing releases. ;)

I'm confused by your "I don't hope so."
Are you still OK with this being merged and included in a release here eventually?
Otherwise, I think you should close the PR, mark it as draft, or similar.

@zvezdochiot
Copy link
Author

zvezdochiot commented Jun 25, 2023

Hi @mara004 .

I don't have enough experience with Qt and XML. If there are bugs, it will be difficult for me to eliminate them. If this PR enters the mainstream, I will be happy. Doubts are caused purely by lack of skill (especially in XML).

PS: During testing, I did not notice any failures.

@zvezdochiot
Copy link
Author

zvezdochiot commented Jul 1, 2023

Hi @mara004 , @lightsilverberryfox , @vigri .

Demo of new thresholds:

Origin Otsu EdgePlus
150dpi 600dpi (d: 16) 600dpi (d:16, ws: 20, c: 0.99)
p-004 p-004 otsu p-004 pbm

@zvezdochiot
Copy link
Author

zvezdochiot commented Jul 12, 2023

Hi @mara004 , @lightsilverberryfox , @vigri .

Github Action: build-linux-qt5:

...
Err:12 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libinput-bin amd64 1.20.0-1ubuntu0.2
  404  Not Found [IP: 52.154.174.208 80]
Err:13 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libinput10 amd64 1.20.0-1ubuntu0.2
  404  Not Found [IP: 52.154.174.208 80]
...
E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/libi/libinput/libinput-bin_1.20.0-1ubuntu0.2_amd64.deb  404  Not Found [IP: 52.147.219.192 80]
E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/libi/libinput/libinput10_1.20.0-1ubuntu0.2_amd64.deb  404  Not Found [IP: 52.147.219.192 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Error: Process completed with exit code 100.

http://azure.archive.ubuntu.com/ubuntu/pool/main/libi/libinput/:

name date size
libinput-bin_1.20.0-1_amd64.deb 2022-02-22 23:45 19K
libinput-bin_1.20.0-1_i386.deb 2022-03-02 14:09 24K
libinput-bin_1.20.0-1ubuntu0.1_amd64.deb 2022-05-02 06:13 19K
libinput-bin_1.20.0-1ubuntu0.1_i386.deb 2022-05-02 06:13 24K
libinput-bin_1.20.0-1ubuntu0.3_amd64.deb 2023-06-16 18:24 19K
libinput-bin_1.20.0-1ubuntu0.3_i386.deb 2023-06-16 18:24 24K

Thu, 13 Jul 2023 15:49:44 +0300

Resolved:

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, @zvezdochiot

After some testing and reviewing, I believe the PR is ready to be merged, I didn't encounter any issues and this could be a very useful feature, I would normally wait for @vigri to offer their review, however he hasn't been here for three months already, so, I don't know what to do.

If you believe it's ready to be merged, I'll merge it. I can tell you put a lot of effort in this PR and wanted to say thank you, you have also offered your input on other issues and bugs, so if vigri sees this, he may want to consider sending you an invitation to our organization so you have write access (I can't invite you myself, I don't have owner permissions).

Is issue #59 also solved by this PR?

Copy link
Member

@vigri vigri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I see no problems. Please see my comments. Especially the one with the qt-version.

src/core/filters/output/BlackWhiteOptions.cpp Show resolved Hide resolved
src/dewarping/DetectVertContentBounds.cpp Show resolved Hide resolved
@vigri
Copy link
Member

vigri commented Jul 15, 2023

I can tell you put a lot of effort in this PR and wanted to say thank you, you have also offered your input on other issues and bugs, so if vigri sees this, he may want to consider sending you an invitation to our organization so you have write access (I can't invite you myself, I don't have owner permissions).

apologies very much.

Thank you very much @zvezdochiot.
As @lightsilverberryfox said: If you are interested, I can send you an invitation. Please let me know.

Regarding this PR: Pleasse see my "review".

@zvezdochiot zvezdochiot requested a review from vigri July 15, 2023 11:46
@zvezdochiot
Copy link
Author

zvezdochiot commented Jul 15, 2023

@lightsilverberryfox say:

Is issue #59 also solved by this PR?

This PR closes the issues:

PS: Me, @plzombie and @trufanov-nok will oversee the STA fork at organization https://github.com/ImageProcessing-ElectronicPublications. Participation in https://github.com/ScanTailor-Advanced is not required.

Copy link
Member

@vigri vigri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much again for this PR!

@mara004
Copy link

mara004 commented Jul 15, 2023

PS: Me, @plzombie and @trufanov-nok will oversee the STA fork at organization https://github.com/ImageProcessing-ElectronicPublications. Participation in https://github.com/ScanTailor-Advanced is not required.

Wouldn't it be better to join efforts in one repo/organization, instead of all the fragmentation?

@zvezdochiot
Copy link
Author

@mara004 say:

Wouldn't it be better to join efforts in one repo/organization

Maybe, but not now. I myself specialize in console utilities (GUI is not mine), @plzombie is busy with depress (it is more important to him), @trufanov-nok is in charge of STU. Everyone is busy with their projects.

PS: Until I figure out the STA (XML) projects, my help is over. I won't figure it out until I see how it's done. Such are the things.

@vigri vigri merged commit b0788fc into ScanTailor-Advanced:master Jul 16, 2023
2 checks passed
@zvezdochiot
Copy link
Author

zvezdochiot commented Jul 16, 2023

Hi @mara004 , @lightsilverberryfox , @vigri .

New version?
1.0.19?
I need for forums.

Current:

#define VERSION "1.0.18"

@vigri
Copy link
Member

vigri commented Jul 16, 2023

Hi @mara004 , @lightsilverberryfox , @vigri .

New version? 1.0.19? I need for forums.

Current:

#define VERSION "1.0.18"

I've uploaded 1.0.19 now.
https://github.com/ScanTailor-Advanced/scantailor-advanced/releases/tag/v1.0.19

zvezdochiot pushed a commit to ImageProcessing-ElectronicPublications/scantailor-advanced that referenced this pull request Jul 20, 2023
zvezdochiot pushed a commit to ImageProcessing-ElectronicPublications/scantailor-advanced that referenced this pull request Jul 20, 2023
zvezdochiot pushed a commit to ImageProcessing-ElectronicPublications/scantailor-advanced that referenced this pull request Jul 20, 2023
@ireun
Copy link

ireun commented Sep 6, 2023

Guys it would be great to have the docs improves to explain the new thresholds, maybe with examples or when to use what. :)

@zvezdochiot
Copy link
Author

zvezdochiot commented Sep 6, 2023

Hi all, @ireun .

⚠️ Don't clutter this repository!
Documentation can be updated, but examples and stuff only in a separate repository. In this link only!

"Recommendations from the author":

  1. EdgeDiv is the most balanced combination of Otsu threshold prefilters. This is a "universal solution" when you need clearly drawn letters without thickening and narrowing. Requires additional cleaning of the result from "garbage". Initial parameters: d:0, ws:20, c:0.75.
  2. EdgePlus is an ill-balanced Otsu threshold prefilter. It is used when it is necessary to highlight the weakly expressed contours of letters at any cost. Creates a lot of "garbage", requires thorough cleaning. Initial parameters: d:0, ws:5, c:0.99.
  3. BlurDiv is an ill-balanced Otsu threshold prefilter. Whitens the background. It is used when it is necessary to get rid of a very noisy background and at the same time, if possible, preserve the characters. Initial parameters: d:0, ws:50, c:0.75.

-- Google Translit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] binarizeEdgePlus
5 participants