From 2fa503cb855fcc57708edb4ecb4e79a35b454f2a Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Wed, 5 Aug 2015 10:47:42 -0500 Subject: [PATCH 1/2] Accumulate Float32 to Float32 Fixes the sad and ssd tests for Ufixed8 --- src/algorithms.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/algorithms.jl b/src/algorithms.jl index 37b249c5..5ba20b0b 100644 --- a/src/algorithms.jl +++ b/src/algorithms.jl @@ -321,6 +321,7 @@ difftype{CV<:AbstractRGB,T<:Real}(::Type{CV}, ::Type{T}) = RGB{Float32} difftype{CV<:AbstractRGB}(::Type{CV}, ::Type{Float64}) = RGB{Float64} accum{T<:Integer}(::Type{T}) = Int +accum(::Type{Float32}) = Float32 accum{T<:Real}(::Type{T}) = Float64 # normalized by Array size From 3fc3fb00fd100f2e5f8f0bfcd775b68b3c36d29a Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Wed, 5 Aug 2015 11:00:53 -0500 Subject: [PATCH 2/2] Compensate for isapprox(eps(), 0.0) = false on julia 0.4 https://github.com/JuliaLang/julia/pull/12393 --- test/algorithms.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/algorithms.jl b/test/algorithms.jl index 289c0dc7..b5bf9d6f 100644 --- a/test/algorithms.jl +++ b/test/algorithms.jl @@ -182,7 +182,9 @@ facts("Algorithms") do Afft = Images.imfilter_fft(A, kern, "inner") @fact Af => roughly(Afft) h = [0.24,0.87] - @fact Images.imfilter(eye(3), h, "inner") => roughly(Images.imfilter_fft(eye(3), h, "inner")) # issue #204 + hfft = Images.imfilter_fft(eye(3), h, "inner") + hfft[abs(hfft) .< 3eps()] = 0 + @fact Images.imfilter(eye(3), h, "inner") => roughly(hfft) # issue #204 @fact approx_equal(Images.imfilter_gaussian(ones(4,4), [5,5]), 1.0) => true A = fill(convert(Float32, NaN), 3, 3)