Closed SB2020-eye closed 3 years ago
You can do something like this:
for ba in doxapy.Binarization.Algorithms.__members__.values():
algo = doxapy.Binarization(ba)
An issue you may run into is that each algorithm needs to be tuned with its own set of parameters. You can either omit the parameters, and stick with the library defaults, or you can create a dictionary that looks up the custom parameters in the loop for the algorithm. I hope that helps!
An issue you may run into is that each algorithm needs to be tuned with its own set of parameters. You can either omit the parameters, and stick with the library defaults, or you can create a dictionary that looks up the custom parameters in the loop for the algorithm.
I'd like to do just that – get a glimpse at the default params for each algorithm. But how?
(So far all I have come up with is looking into the members and docstrings of each doxapy.Binarization.Algorithms
– class and object. But nothing tells me what params are available and what are their defaults.)
EDIT So basically I am interested in this – from Python:
fgrep -r parameters.Get Doxa
Doxa/UnitTests/CalculatorTests.cpp: const int windowSize = parameters.Get("window", 75);
Doxa/UnitTests/CalculatorTests.cpp: const double k = parameters.Get("k", 0.2);
Doxa/Bernsen.hpp: const int windowSize = parameters.Get("window", 75);
Doxa/Bernsen.hpp: const int GT = parameters.Get("threshold", 100);
Doxa/Bernsen.hpp: const int L = parameters.Get("contrast-limit", 25);
Doxa/Nick.hpp: const int windowSize = parameters.Get("window", 75);
Doxa/Nick.hpp: const double k = parameters.Get("k", -0.2);
Doxa/Niblack.hpp: const int windowSize = parameters.Get("window", 75);
Doxa/Niblack.hpp: const double k = parameters.Get("k", 0.2);
Doxa/TRSingh.hpp: const int windowSize = parameters.Get("window", 75);
Doxa/TRSingh.hpp: const double k = parameters.Get("k", 0.2);
Doxa/Gatos.hpp: const int glyphSize = parameters.Get("glyph", 60);
Doxa/Sauvola.hpp: const int windowSize = parameters.Get("window", 75);
Doxa/Sauvola.hpp: const double k = parameters.Get("k", 0.2);
Doxa/Wolf.hpp: const int windowSize = parameters.Get("window", 75);
Doxa/Wolf.hpp: const double k = parameters.Get("k", 0.2);
Doxa/Wan.hpp: const int windowSize = parameters.Get("window", 75);
Doxa/Wan.hpp: const double k = parameters.Get("k", 0.2);
Doxa/Su.hpp: int windowSize = parameters.Get("window", 0); // Based on Stroke Size
Doxa/Su.hpp: int minN = parameters.Get("minN", windowSize); // Roughly basd on size of window
(plus maybe the C++ comments for each algorithm on the Doxa
namespace, as a docstring)
@bertsky I have created: https://github.com/brandonmpetty/Doxa/issues/23
I will work on documenting it first on the github wiki and then in the code base.
Hello!
I'm trying to specify binarization methods and/or use all at once using demo.py as my starter template.
Here's the latest that I tried:
I also tried with the list's methods in quotes, mixed in with 3 or so variations on this line:
algo = doxapy.Binarization(doxapy.Binarization.Algorithms.ba)
(str(ba), for example, pluses (for both str(ba) and just ba like you see above)Any idea what I'm doing wrong?