-
Notifications
You must be signed in to change notification settings - Fork 4
ISSUE: Loss of black text clarity in white-dominant images when scaling 2x, 3x, 4x #33
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
Comments
Hi, @fusefib . In Linux, the one you described cannot be played either on 2x or 4x. |
I'll try to prepare a better picture for testing. In any case, it consistently does this for high resolution pictures that are mostly white and have almost no black, when scaling up. However, pages with enough text always turn out fine. Here is the result for me: |
@zvezdochiot Reproduced with Otsu, Dots8, EdgePlus(somehow), BlurDiv, EdgeDiv, Robust Also reproducible on 32-bit linux. So maybe should look for long (32bit on windows and 32bit linux, 64bit on 64bit linux) variables I suggest to check aafb67f 587683b and 0.2023.11.10...0.2023.11.19#diff-4ddd4b67d244ac7c7864d278c0179f232b36742520daee44b20ec5b80e4f6324R870 (and maybe other code) and replace long with int64_t/uint64_t |
@plzombie , this could be (?!) an overflow in:
but the type is specified independent of the bit depth (!). PS: All the thresholds you listed use
Tb = (ib > 0) ? (Tb / (double) ib) : 0.0;
Tw = (iw > 0) ? (Tw / (double) iw) : (double) histsize;
for (k = 0; k < histsize; k++)
{
im = histogram[k];
if (k < threshold)
{
Tb += ((double) im * (double) k);
ib += im;
}
else
{
Tw += ((double) im * (double) k);
iw += im;
}
}
unsigned long int im, histogram[histsize] = {0};
double iw = 0.0, ib = 0.0; |
@fusefib Could you try this build? |
Confirmed it works properly now with both zips. Thanks to both of you for the fix! |
Description:
I am experiencing difficulties with the normal binarizing feature in ScanTailor-Experimental. When attempting to process an image containing predominantly white background with little black text, the resulting binarized image displays faint or erased text when scaling up the resolution to
2x
or higher. Adjusting theCurve/Sqr color
settings from0.5/0
to1/1
provides some improvement but does not fully restore the text clarity. Changing the Threshold method fromOtsu
does, but keepingOtsu
is preferred. Setting the thickness to the max doesn't help.Expected Behavior:
The binarization process should maintain the clarity and legibility of the black text, even when scaling up the resolution.
Actual Behavior:
The black text becomes faint or disappears entirely in the binarized image when the resolution is increased.
Environment:
Steps to reproduce:
Output
.Resolution Enhancement
box and click2x
.Notes:
I've just started using this variant of ScanTailor (awesome work!) and I haven't done extensive testing to determine if this is a regression and, if so, when it occurred. Would be happy to test if needed.
The text was updated successfully, but these errors were encountered: