From 4d89e5cecbf115d6b25976f12ac7a32c92a5bfc0 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Thu, 19 Aug 2021 18:15:46 +0800 Subject: [PATCH] ImageTransformations v0.9.0 (#122) --- CHANGELOG.md | 56 +++++++++++++++++++++++++++++++++++++ Project.toml | 2 +- src/ImageTransformations.jl | 3 -- src/autorange.jl | 6 ++-- src/compat.jl | 15 ++++++---- 5 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..30dac1e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,56 @@ +# ImageTransformations + +## Version `v0.9.0` + +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 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]) +- ![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 (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` 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 +[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 + + 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" 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)) 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