Skip to content

Commit

Permalink
support binarize for ThresholdAlgorithm (#70)
Browse files Browse the repository at this point in the history
Introduce a non-exported trait type BinaryHistogramThreshold to wrap ThresholdAlgorithm. Except for the change of type hierarchy, there are no other behavior changes.
  • Loading branch information
johnnychen94 authored Dec 13, 2020
1 parent 86b7d59 commit 86e9d9c
Show file tree
Hide file tree
Showing 23 changed files with 219 additions and 1,419 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ImageContrastAdjustment = "f332f351-ec65-5f6a-b3d1-319c6670881a"
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
Expand All @@ -20,6 +21,7 @@ HistogramThresholding = "0.1, 0.2"
ImageContrastAdjustment = "0.1, 0.2, 0.3"
ImageCore = "0.8.3"
Polynomials = "1.0"
Reexport = "0.2"
ReferenceTests = "0.7, 0.8"
julia = "1"

Expand Down
28 changes: 8 additions & 20 deletions src/ImageBinarization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ using Base.Iterators: repeated
using LinearAlgebra
using Polynomials
using Statistics
using Reexport

using ImageContrastAdjustment
using HistogramThresholding
@reexport using HistogramThresholding

using ImageCore
using ImageCore.MappedArrays
Expand All @@ -17,27 +18,20 @@ using ColorVectorSpace
include("BinarizationAPI/BinarizationAPI.jl")
import .BinarizationAPI: AbstractImageBinarizationAlgorithm,
binarize, binarize!
import HistogramThresholding: ThresholdAlgorithm

include("integral_image.jl")
include("util.jl")
include("compat.jl")

# Concrete binarization algorithms

# Balanced, Entropy, Intermodes, Minimum, MinimumError, Moments, Otsu, UnimodalRosin, Yen
include("algorithms/single_histogram_threshold.jl")
include("algorithms/adaptive_threshold.jl") # AdaptiveThreshold
include("algorithms/balanced.jl") # Balanced
include("algorithms/entropy.jl") # Entropy
include("algorithms/intermodes.jl") # Intermodes
include("algorithms/minimum.jl") # MinimumIntermodes
include("algorithms/minimum_error.jl") # MinimumError
include("algorithms/moments.jl") # Moments
include("algorithms/niblack.jl") # Niblack
include("algorithms/otsu.jl") # Otsu
include("algorithms/polysegment.jl") # Polysegment
include("algorithms/sauvola.jl") # Sauvola
include("algorithms/unimodal.jl") # UnimodalRosin
include("algorithms/yen.jl") # Yen


include("deprecations.jl")

Expand All @@ -47,17 +41,11 @@ export

# Algorithms
AdaptiveThreshold, recommend_size,
Balanced,
Entropy,
Intermodes,
MinimumError,
MinimumIntermodes,
Moments,
Niblack,
Otsu,
Polysegment,
Sauvola,
UnimodalRosin,
Yen

# also reexport algorithms in HistogramThresholding
SingleHistogramThreshold

end # module ImageBinarization
93 changes: 0 additions & 93 deletions src/algorithms/balanced.jl

This file was deleted.

96 changes: 0 additions & 96 deletions src/algorithms/entropy.jl

This file was deleted.

54 changes: 0 additions & 54 deletions src/algorithms/intermodes.jl

This file was deleted.

54 changes: 0 additions & 54 deletions src/algorithms/minimum.jl

This file was deleted.

Loading

0 comments on commit 86e9d9c

Please sign in to comment.