diff --git a/src/Images.jl b/src/Images.jl index 0a8b72c8..a0498347 100644 --- a/src/Images.jl +++ b/src/Images.jl @@ -84,7 +84,6 @@ using TiledIteration: EdgeIterator include("misc.jl") include("labeledarrays.jl") include("algorithms.jl") -include("exposure.jl") include("deprecations.jl") include("corner.jl") include("edge.jl") @@ -152,7 +151,6 @@ export clearborder, #Exposure - complement, imhist, histeq, adjust_gamma, diff --git a/src/algorithms.jl b/src/algorithms.jl index 347703e5..d5ead017 100644 --- a/src/algorithms.jl +++ b/src/algorithms.jl @@ -1,7 +1,7 @@ using Base: axes1, tail using OffsetArrays import Statistics -using Statistics: mean, var +using Statistics: mean import AxisArrays using ImageMorphology: dilate!, erode! @@ -76,26 +76,6 @@ function sumfinite!(S, K, A::AbstractArray{T,N}) where {T,N} end _newindexer(ax) = Base.Broadcast.shapeindexer(ax) -function Statistics.var(A::AbstractArray{C}; kwargs...) where C<:AbstractGray - imgc = channelview(A) - base_colorant_type(C)(var(imgc; kwargs...)) -end - -function Statistics.var(A::AbstractArray{C,N}; kwargs...) where {C<:Colorant,N} - imgc = channelview(A) - colons = ntuple(d->Colon(), Val(N)) - inds1 = axes(imgc, 1) - val1 = Statistics.var(view(imgc, first(inds1), colons...); kwargs...) - vals = similar(imgc, typeof(val1), inds1) - vals[1] = val1 - for i in first(inds1)+1:last(inds1) - vals[i] = Statistics.var(view(imgc, i, colons...); kwargs...) - end - base_colorant_type(C)(vals...) -end - -Statistics.std(A::AbstractArray{C}; kwargs...) where {C<:Colorant} = mapc(sqrt, Statistics.var(A; kwargs...)) - # Entropy for grayscale (intensity) images function _log(kind::Symbol) if kind == :shannon diff --git a/src/exposure.jl b/src/exposure.jl deleted file mode 100644 index 56143b05..00000000 --- a/src/exposure.jl +++ /dev/null @@ -1,13 +0,0 @@ -# This functionality ought to be moved to another package. -# Perhaps ImageMorphology.jl ? - -""" - y = complement(x) - -Take the complement `1-x` of `x`. If `x` is a color with an alpha channel, -the alpha channel is left untouched. Don't forget to add a dot when `x` is -an array: `complement.(x)` -""" -complement(x::Union{Number,Colorant}) = oneunit(x)-x -complement(x::TransparentColor) = typeof(x)(complement(color(x)), alpha(x)) -@deprecate complement(x::AbstractArray) complement.(x) diff --git a/test/algorithms.jl b/test/algorithms.jl index 06eb4933..cb3fd3e5 100644 --- a/test/algorithms.jl +++ b/test/algorithms.jl @@ -67,14 +67,6 @@ using Test Random.seed!(1234) - @testset "Complement" begin - @test complement.([Gray(0.2)]) == [Gray(0.8)] - @test complement.([Gray{N0f8}(0.2)]) == [Gray{N0f8}(0.8)] - @test complement.([RGB(0,0.3,1)]) == [RGB(1,0.7,0)] - @test complement.([RGBA(0,0.3,1,0.7)]) == [RGBA(1.0,0.7,0.0,0.7)] - @test complement.([RGBA{N0f8}(0,0.6,1,0.7)]) == [RGBA{N0f8}(1.0,0.4,0.0,0.7)] - end - @testset "Entropy" begin img = rand(1:10,10,10) img2 = rand(1:2,10,10) diff --git a/test/exposure.jl b/test/exposure.jl index f0de92c7..85a461c0 100644 --- a/test/exposure.jl +++ b/test/exposure.jl @@ -515,11 +515,6 @@ eye(m,n) = Matrix{Float64}(I,m,n) @test eltype(imadjustintensity(img)) == Gray{N0f16} img = Gray{N0f16}.([0.01164 0.01118; 0.01036 0.01187]) - @test complement(Gray(0.5)) == Gray(0.5) - @test complement(Gray(0.2)) == Gray(0.8) - @test all(complement.(img) .== 1 .- img) - # deprecated (#690) - @test all(complement.(img) .== 1 .- img) hist = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]