You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #30 we changed the usage of AdaptiveThreshold from
w =recommend_window_size(img)
f =AdaptiveThreshold(window_size = w, percentage =15)
binarize(img, f)
to
f =AdaptiveThreshold(percentage =15)
binarize(img, f)
By doing this, users no longer need to call recommend_window_size anymore, which is an improvement.
However, this isn't what we really want in the beginning, since we'd like to hold all parameters of AdaptiveThreshold inside of it.
a window_size is something that is intrinsic to an adaptive method since the existence of a window is what often differentiates global thresholding from adaptive local thresholding. A sensible choice of window_size does indeed depend on the size of the image.
-- @zygmuntszpak
As a solution, I’m keeping thinking of introducing another set of API that generate the algorithms with the “best” inferred parameters from prior information, for example, the usage could be:
# option 1
f =AdaptiveThreshold(img)
# option 2
f =algorithm_plan(:AdaptiveThreshold, img)
binarize(img, f)
The idea here is, use img to infer as much information as needed, and leave the others using the default value.
Changes:
* refactor the codebase using the functor API discussed in #26
* enhance the API by introducing a submodule `BinarizationAPI`
* add in-place function `binarize!`
* support Color3 inputs
* add more test codes
* slightly enhance the documentation
Breaking changes (Deprecated in 0.3):
* swap the argument order discussed in #23 ( d1f8309)
* unexport `recommend_size` in favor of #41, i.e., `AdaptiveThreshold(img)` instead of `recommend_size(img)` ( PR: #30#45)
* made `window_size` of `AdaptiveThreshold` not an optional argument. ( PR: #45 )
In #30 we changed the usage of
AdaptiveThreshold
fromto
By doing this, users no longer need to call
recommend_window_size
anymore, which is an improvement.However, this isn't what we really want in the beginning, since we'd like to hold all parameters of
AdaptiveThreshold
inside of it.As a solution, I’m keeping thinking of introducing another set of API that generate the algorithms with the “best” inferred parameters from prior information, for example, the usage could be:
The idea here is, use
img
to infer as much information as needed, and leave the others using the default value.A toy implementation of option 1 could be:
P.S., a practical example of this design is used in my
NonlocalMean
, where we infer the bestr_p
(aka.window_size
) usingimg
.The text was updated successfully, but these errors were encountered: