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

Sauvola delivers black for some radius and images #340

Open
thhart opened this issue Feb 24, 2022 · 3 comments
Open

Sauvola delivers black for some radius and images #340

thhart opened this issue Feb 24, 2022 · 3 comments

Comments

@thhart
Copy link
Contributor

thhart commented Feb 24, 2022

I have observed that Sauvola delivers black images in combination with special radius and special images. Unfortunately it behaves extremely strange and I can not reproduce it in a test environment. However I am 100% sure the input right before the function call is valid. The questionable radius is 4-9 and it only happens on a special image. Maybe it is related to the image modification chain before, but I have to check carefully if I can find some reason. So I can only report here for the records yet.

Code is like this:

GrayU8 sauvola = GThresholdImageOps.localSauvola(gray, null, ConfigLength.fixed(radius), threshold, true); return VisualizeBinaryData.renderBinary(sauvola, invert, null);
@lessthanoptimal
Copy link
Owner

Could you add this before the call and see if it prints out zero when you have the issue?

var copied = gray.clone()
System.out.println("mean="+ GImageStatistics.mean(copied ));
GrayU8 sauvola = GThresholdImageOps.localSauvola(copied , null, ConfigLength.fixed(radius), threshold, true); return VisualizeBinaryData.renderBinary(sauvola, invert, null);

Next try adding this line before any code is called and see if it fixes the issue.

BoofConcurrency.USE_CONCURRENT = false;

Is this a threaded application? Is it possible another thread is modifying an image while this process is going?

@thhart
Copy link
Contributor Author

thhart commented Feb 25, 2022

  1. Mean value is ok before
  2. Concurrency on/off no change
  3. No modification going on, I even used the copy for the call

I tried to serialize the questionable image before, so I could reproduce, but it only happens in the complex application chain, maybe there is a dependency conflict, I have to check further I am afraid...

@lessthanoptimal
Copy link
Owner

any update?

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

No branches or pull requests

2 participants