JuliaImages / HistogramThresholding.jl

A Julia package for determining thresholds by analyzing one-dimensional histograms
MIT License
13 stars 9 forks source link

improve Entropy with numerical stability and performance #36

Closed johnnychen94 closed 3 years ago

johnnychen94 commented 3 years ago

fixes #35

using FileIO, ImageContrastAdjustment, HistogramThresholding
file = download("https://vision-group-file-sharing.s3.eu-central-1.amazonaws.com/Dungbeetle_temp/img.png")
img = FileIO.load(file)
edges, counts = build_histogram(img, 256)

@btime find_threshold(Entropy(), $(counts[1:end]), $edges)
# master 4.598 μs (4 allocations: 8.50 KiB)
# PR 4.213 μs (3 allocations: 6.38 KiB)

A merge commit is required because the other two commits are not related; they're maintenance updates.

codecov[bot] commented 3 years ago

Codecov Report

Merging #36 (efdff64) into master (d2e9634) will decrease coverage by 0.37%. The diff coverage is 90.90%.

:exclamation: Current head efdff64 differs from pull request most recent head 44eeb6e. Consider uploading reports for the commit 44eeb6e to get more accurate results Impacted file tree graph

@@             Coverage Diff             @@
##            master      #36      +/-   ##
===========================================
- Coverage   100.00%   99.62%   -0.38%     
===========================================
  Files           11       11              
  Lines          244      266      +22     
===========================================
+ Hits           244      265      +21     
- Misses           0        1       +1     
Impacted Files Coverage Δ
src/entropy_thresholding.jl 96.15% <90.90%> (-3.85%) :arrow_down:
src/yen.jl 100.00% <0.00%> (ø)
src/otsu.jl 100.00% <0.00%> (ø)
src/common.jl 100.00% <0.00%> (ø)
src/minimum.jl 100.00% <0.00%> (ø)
src/moments.jl 100.00% <0.00%> (ø)
src/unimodal.jl 100.00% <0.00%> (ø)
src/intermodes.jl 100.00% <0.00%> (ø)
src/minimum_error.jl 100.00% <0.00%> (ø)
src/balancedthreshold.jl 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d2e9634...44eeb6e. Read the comment docs.