BoofCV
BoofCV copied to clipboard
Sauvola delivers black for some radius and images
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);
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?
- Mean value is ok before
- Concurrency on/off no change
- 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...
any update?