Skip to content

Commit

Permalink
Qualify use of centered
Browse files Browse the repository at this point in the history
 is exported by both ImageFiltering and OffsetArrays. This causes issues, as both packages are using within, so the name is ambiguous. Fix by (1) explicitly calling OffsetArrays.centered (2) import rather than using ImageFiltering.
  • Loading branch information
angusmoore committed Aug 7, 2021
1 parent bb4e7d1 commit f2c2998
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/ImageQualityIndexes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ using ImageCore
# Where possible we avoid a direct dependency to reduce the number of [compat] bounds
using ImageCore.MappedArrays
using ImageCore: NumberLike, Pixel, GenericImage, GenericGrayImage
using ImageDistances, ImageFiltering
using ImageDistances
import ImageFiltering: KernelFactors, kernelfactors, imfilter
using Statistics: mean, std
using Base.Iterators: repeated, flatten

Expand Down
2 changes: 1 addition & 1 deletion src/msssim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct MSSSIM{A, N} <: FullReferenceIQI
all(x-> x>=0, flatten(W)) || throw(ArgumentError("α, β, γ should be non-negative for all scales, instead it's $(W)"))
sum(flatten(W)) == 0 && throw(ArgumentError("MS-SSIM must have at least one weight > 0"))

kernel = centered(kernel)
kernel = OffsetArrays.centered(kernel)
if num_scales length(W)
W MSSSIM_W && @warn "truncate MS-SSIM weights to scale $num_scales"
end
Expand Down
2 changes: 1 addition & 1 deletion src/ssim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct SSIM{A<:AbstractVector} <: FullReferenceIQI
ndims(kernel) == 1 || throw(ArgumentError("only 1-d kernel is valid"))
issymetric(kernel) || @warn "SSIM kernel is assumed to be symmetric"
all(W .>= 0) || throw(ArgumentError("(α, β, γ) should be non-negative, instead it's $(W)"))
kernel = centered(kernel)
kernel = OffsetArrays.centered(kernel)
new{typeof(kernel)}(kernel, W, crop)
end
end
Expand Down

0 comments on commit f2c2998

Please sign in to comment.