The right place for var and std should be ColorVectorSpace
|
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...)) |
Steps to achieve it:
- copy codes to
ColorVectorSpaces, merge and ask for a new release
- remove codes here: since ColorVectorSpace is loaded in this package, we don't need to deprecate them. But we need some compatibility-checking codes so that if an older version of
ColorVectorSpace is installed, this package still functions normally.
The right place for
varandstdshould be ColorVectorSpaceImages.jl/src/algorithms.jl
Lines 79 to 97 in 2176612
Steps to achieve it:
ColorVectorSpaces, merge and ask for a new releaseColorVectorSpaceis installed, this package still functions normally.