Using ImageContrastAdjustment v0.3.12 with JuliaImages.jl and I am having some troubles using Adaptive histogram Equalization:
I1 = load("/some-image.jpg");
I1=Gray.(I1);
alg = AdaptiveEqualization(nbins = 256, rblocks = 8, cblocks = 8, clip = 0.2)
I1_eq = adjust_histogram((I1), alg)
this doesnt happen always, but for some images I get ArgumentError:
ArgumentError: N0f8 is an 8-bit type representing 256 values from 0.0 to 1.0; cannot represent 1.0000000000000002
Stacktrace:
[1] throw_converterror(::Type{N0f8}, x::Float64)
@ FixedPointNumbers ~/.julia/packages/FixedPointNumbers/Dn4hv/src/FixedPointNumbers.jl:326
[2] _convert
@ ~/.julia/packages/FixedPointNumbers/Dn4hv/src/normed.jl:76 [inlined]
[3] FixedPoint
@ ~/.julia/packages/FixedPointNumbers/Dn4hv/src/FixedPointNumbers.jl:58 [inlined]
[4] convert
@ ./number.jl:7 [inlined]
[5] Gray
@ ~/.julia/packages/ColorTypes/L7biZ/src/types.jl:359 [inlined]
[6] convert
@ ~/.julia/packages/ColorTypes/L7biZ/src/conversions.jl:105 [inlined]
[7] setindex!
@ ./array.jl:996 [inlined]
[8] transform_interior!(out::Matrix{…}, img::Matrix{…}, bounds::Tuple{…}, block_centroids::Tuple{…}, block_dimensions::Tuple{…}, intensity_range::Tuple{…}, block_cdf::Matrix{…})
@ ImageContrastAdjustment ~/.julia/packages/ImageContrastAdjustment/J15Ip/src/algorithms/adaptive_equalization.jl:515
[9] transform_image!(out::Matrix{…}, img::Matrix{…}, block_centroid_r::Vector{…}, block_centroid_c::Vector{…}, block_width::Int64, block_height::Int64, intensity_range::Tuple{…}, cblocks::Int64, rblocks::Int64, block_cdf::Matrix{…})
@ ImageContrastAdjustment ~/.julia/packages/ImageContrastAdjustment/J15Ip/src/algorithms/adaptive_equalization.jl:449
[10] (::AdaptiveEqualization{Float64, Float64, Float64})(out::Matrix{Gray{N0f8}}, img::Matrix{Gray{N0f8}})
@ ImageContrastAdjustment ~/.julia/packages/ImageContrastAdjustment/J15Ip/src/algorithms/adaptive_equalization.jl:299
[11] adjust_histogram!
@ ~/.julia/packages/ImageContrastAdjustment/J15Ip/src/HistogramAdjustmentAPI/histogram_adjustment.jl:44 [inlined]
[12] #adjust_histogram#3
@ ~/.julia/packages/ImageContrastAdjustment/J15Ip/src/HistogramAdjustmentAPI/histogram_adjustment.jl:64 [inlined]
[13] adjust_histogram
@ ~/.julia/packages/ImageContrastAdjustment/J15Ip/src/HistogramAdjustmentAPI/histogram_adjustment.jl:59 [inlined]
[14] adjust_histogram(::Matrix{Gray{N0f8}}, ::AdaptiveEqualization{Float64, Float64, Float64})
@ ImageContrastAdjustment.HistogramAdjustmentAPI ~/.julia/packages/ImageContrastAdjustment/J15Ip/src/HistogramAdjustmentAPI/histogram_adjustment.jl:68
[15] top-level scope
@ In[52]:2
[16] eval(m::Module, e::Any)
@ Core ./boot.jl:489
is this a bug, or by design? if i change the type from N0f8 to Float it works correctly.
Using ImageContrastAdjustment v0.3.12 with JuliaImages.jl and I am having some troubles using Adaptive histogram Equalization:
this doesnt happen always, but for some images I get ArgumentError:
is this a bug, or by design? if i change the type from N0f8 to Float it works correctly.