From cdf2df70b58bef6370a109651f99f3b53714b9bd Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Wed, 19 May 2021 22:31:59 +0800 Subject: [PATCH 1/5] ImageTransformations v0.9.0 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 7c087b4..23cce43 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ImageTransformations" uuid = "02fcd773-0e25-5acc-982a-7f6622650795" -version = "0.8.12" +version = "0.9.0" [deps] AxisAlgorithms = "13072b0f-2c55-5437-9ae7-d433b7a33950" From f0d1231c2411c4f55dd07bc56d3c851c8b668b4f Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Thu, 19 Aug 2021 16:47:26 +0800 Subject: [PATCH 2/5] add Changelog --- CHANGELOG.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8b3f5ea --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,54 @@ +# ImageTransformations + +## Version `v0.9.0` + +This version introduces changes internal `warp` and `invwarpedview` implementation thus users can expect some numerical differences. This version introduce a lot of API +deprecations. + +- ![BREAKING][badge-breaking] Previously, `SubArray` passed to `invwarpedview` will use out-of-domain values to build a better result on the boundary. This is considered a too strong assumption and thus removed. ([#138][github-138]) +- ![BREAKING][badge-breaking] Rounding for numerical stability in `warp` is now applied to the corner points instead of to the transformation coefficients. ([#143][github-143]) +- ![Deprecation][badge-deprecation] `degree` and `fill` arguments are deprecated in favor of their keyword versions `method` and `fillvalue`. ([#116][github-116]) +- ![Deprecation][badge-deprecation] `invwarpedview` is deprecated in favor of `InvWarpedView`. ([#116][github-116], [#138][github-138]) +- ![Deprecation][badge-deprecation] `warpedview` is deprecated in favor of `WarpedView`. ([#116][github-116]) +- ![Enhancement][badge-enhancement] `restrict`/`restrict!` are moved to more lightweight package [ImageBase.jl]. ([#127][github-127]) +- ![Enhancement][badge-enhancement] `imresize` now works on transparent colorant types(e.g., `ARGB`). ([#126][github-126]) +- ![Enhancement][badge-enhancement] `restrict` now works on 0-argument colorant types(e.g., `ARGB32`). ([ImageBase#3][github-base-3]) +- ![Bugfix][badge-bugfix] Interpolations v0.13.3 compatibility. ([#132][github-132]) +- ![Bugfix][badge-bugfix] `restrict` on singleton dimension is now a no-op. ([ImageBase#8][github-base-8]) +- ![Bugfix][badge-bugfix] `restrict` on `OffsetArray` is now type stable. ([ImageBase#4][github-base-4]) + +[github-143]: https://github.com/JuliaImages/ImageTransformations.jl/pull/143 +[github-138]: https://github.com/JuliaImages/ImageTransformations.jl/pull/138 +[github-132]: https://github.com/JuliaImages/ImageTransformations.jl/pull/132 +[github-127]: https://github.com/JuliaImages/ImageTransformations.jl/pull/127 +[github-126]: https://github.com/JuliaImages/ImageTransformations.jl/pull/126 +[github-116]: https://github.com/JuliaImages/ImageTransformations.jl/pull/116 +[github-base-8]: https://github.com/JuliaImages/ImageBase.jl/pull/8 +[github-base-4]: https://github.com/JuliaImages/ImageBase.jl/pull/4 +[github-base-3]: https://github.com/JuliaImages/ImageBase.jl/pull/3 + + +[ImageBase.jl]: https://github.com/JuliaImages/ImageBase.jl + + +[badge-breaking]: https://img.shields.io/badge/BREAKING-red.svg +[badge-deprecation]: https://img.shields.io/badge/deprecation-orange.svg +[badge-feature]: https://img.shields.io/badge/feature-green.svg +[badge-enhancement]: https://img.shields.io/badge/enhancement-blue.svg +[badge-bugfix]: https://img.shields.io/badge/bugfix-purple.svg +[badge-security]: https://img.shields.io/badge/security-black.svg +[badge-experimental]: https://img.shields.io/badge/experimental-lightgrey.svg +[badge-maintenance]: https://img.shields.io/badge/maintenance-gray.svg + + From b954fa6c277cf0aadf66842c159f3948404984c9 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Thu, 19 Aug 2021 16:59:12 +0800 Subject: [PATCH 3/5] [compat] use ColorTypes.nan for HSV types --- src/compat.jl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/compat.jl b/src/compat.jl index 6bab659..aa6f200 100644 --- a/src/compat.jl +++ b/src/compat.jl @@ -6,8 +6,13 @@ @inline isnothing(x) = x === nothing end -# FIXME: upstream https://github.com/JuliaGraphics/ColorVectorSpace.jl/issues/75 -@inline _nan(::Type{HSV{Float16}}) = HSV{Float16}(NaN16,NaN16,NaN16) -@inline _nan(::Type{HSV{Float32}}) = HSV{Float32}(NaN32,NaN32,NaN32) -@inline _nan(::Type{HSV{Float64}}) = HSV{Float64}(NaN,NaN,NaN) -@inline _nan(::Type{T}) where {T} = nan(T) +if hasmethod(nan, Tuple{Type{HSV{Float32},}}) + # requires ColorTypes v0.11 and ColorVectorSpace v0.9.4 + # https://github.com/JuliaGraphics/ColorVectorSpace.jl/issues/75 + @inline _nan(::Type{T}) where T = nan(T) +else + @inline _nan(::Type{HSV{Float16}}) = HSV{Float16}(NaN16,NaN16,NaN16) + @inline _nan(::Type{HSV{Float32}}) = HSV{Float32}(NaN32,NaN32,NaN32) + @inline _nan(::Type{HSV{Float64}}) = HSV{Float64}(NaN,NaN,NaN) + @inline _nan(::Type{T}) where {T} = nan(T) +end From 71efff6ab99e49daf6dec457ae4e452a88268b7d Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Thu, 19 Aug 2021 17:02:43 +0800 Subject: [PATCH 4/5] trivial code cleanup --- src/ImageTransformations.jl | 3 --- src/autorange.jl | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/ImageTransformations.jl b/src/ImageTransformations.jl index 5d621c5..e9835b3 100644 --- a/src/ImageTransformations.jl +++ b/src/ImageTransformations.jl @@ -8,10 +8,7 @@ using Interpolations, AxisAlgorithms using OffsetArrays using ColorVectorSpace -import Base: eltype, size, length using Base: tail, Indices -using Base.Cartesian -using .ColorTypes: AbstractGray, TransparentGray, TransparentRGB # these two symbols previously live in ImageTransformations import ImageBase: restrict, restrict! diff --git a/src/autorange.jl b/src/autorange.jl index 71b9a66..afbdf7e 100644 --- a/src/autorange.jl +++ b/src/autorange.jl @@ -54,12 +54,12 @@ struct CornerIterator{I<:CartesianIndex} end CornerIterator(R::CartesianIndices) = CornerIterator(first(R), last(R)) -eltype(::Type{CornerIterator{I}}) where {I} = I +Base.eltype(::Type{CornerIterator{I}}) where {I} = I Base.Iterators.IteratorSize(::Type{CornerIterator{I}}) where {I<:CartesianIndex{N}} where {N} = Base.Iterators.HasShape{N}() # in 0.6 we could write: 1 .+ (iter.stop.I .- iter.start.I .!= 0) -size(iter::CornerIterator{CartesianIndex{N}}) where {N} = ntuple(d->iter.stop.I[d]-iter.start.I[d]==0 ? 1 : 2, Val(N))::NTuple{N,Int} -length(iter::CornerIterator) = prod(size(iter)) +Base.size(iter::CornerIterator{CartesianIndex{N}}) where {N} = ntuple(d->iter.stop.I[d]-iter.start.I[d]==0 ? 1 : 2, Val(N))::NTuple{N,Int} +Base.length(iter::CornerIterator) = prod(size(iter)) @inline function Base.iterate(iter::CornerIterator{<:CartesianIndex}) if any(map(>, iter.start.I, iter.stop.I)) From bdd857a25f146ad8ab59245721af432e53dd9d84 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Thu, 19 Aug 2021 18:12:56 +0800 Subject: [PATCH 5/5] apply suggestions --- CHANGELOG.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b3f5ea..30dac1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,12 @@ ## Version `v0.9.0` -This version introduces changes internal `warp` and `invwarpedview` implementation thus users can expect some numerical differences. This version introduce a lot of API -deprecations. +This release contains numerous enhancements as well as quite a few deprecations. There are also +internal changes that may cause small numerical differences from previous versions; these may be +most obvious at the borders of the image, where decisions about inbounds/out-of-bounds can determine +whether a "fill-value" is used instead of interpolation. -- ![BREAKING][badge-breaking] Previously, `SubArray` passed to `invwarpedview` will use out-of-domain values to build a better result on the boundary. This is considered a too strong assumption and thus removed. ([#138][github-138]) +- ![BREAKING][badge-breaking] Previously, `SubArray` passed to `invwarpedview` will use out-of-domain values to build a better result on the border. This violated the array abstraction and has therefore been removed. ([#138][github-138]) - ![BREAKING][badge-breaking] Rounding for numerical stability in `warp` is now applied to the corner points instead of to the transformation coefficients. ([#143][github-143]) - ![Deprecation][badge-deprecation] `degree` and `fill` arguments are deprecated in favor of their keyword versions `method` and `fillvalue`. ([#116][github-116]) - ![Deprecation][badge-deprecation] `invwarpedview` is deprecated in favor of `InvWarpedView`. ([#116][github-116], [#138][github-138]) @@ -13,9 +15,9 @@ deprecations. - ![Enhancement][badge-enhancement] `restrict`/`restrict!` are moved to more lightweight package [ImageBase.jl]. ([#127][github-127]) - ![Enhancement][badge-enhancement] `imresize` now works on transparent colorant types(e.g., `ARGB`). ([#126][github-126]) - ![Enhancement][badge-enhancement] `restrict` now works on 0-argument colorant types(e.g., `ARGB32`). ([ImageBase#3][github-base-3]) -- ![Bugfix][badge-bugfix] Interpolations v0.13.3 compatibility. ([#132][github-132]) +- ![Bugfix][badge-bugfix] Interpolations v0.13.3 compatibility (though 0.13.4 is now required). ([#132][github-132]) - ![Bugfix][badge-bugfix] `restrict` on singleton dimension is now a no-op. ([ImageBase#8][github-base-8]) -- ![Bugfix][badge-bugfix] `restrict` on `OffsetArray` is now type stable. ([ImageBase#4][github-base-4]) +- ![Bugfix][badge-bugfix] `restrict` on `OffsetArray` always returns an `OffsetArray` result. ([ImageBase#4][github-base-4]) [github-143]: https://github.com/JuliaImages/ImageTransformations.jl/pull/143 [github-138]: https://github.com/JuliaImages/ImageTransformations.jl/pull/138