Skip to content

Commit 426e964

Browse files
committed
Adds deprecations for adjust_histogram(img, LinearStretching()) variants
1 parent 42795dd commit 426e964

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

src/ImageContrastAdjustment.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ include("algorithms/gamma_correction.jl")
2727
include("algorithms/matching.jl")
2828
include("algorithms/midway_equalization.jl")
2929
include("compat.jl")
30+
include("deprecations.jl")
3031

3132
export
3233
# main types and functions

src/algorithms/linear_stretching.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
"""
33
```
4-
LinearStretching <: AbstractHistogramAdjustmentAlgorithm
4+
LinearStretching <: AbstractIntensityAdjustmentAlgorithm
55
LinearStretching(; [src_minval], [src_maxval],
66
dst_minval=0, dst_maxval=1,
77
no_clamp=false)
@@ -91,7 +91,7 @@ LinearStretching((0.1, 0.9) => nothing)
9191
1. W. Burger and M. J. Burge. *Digital Image Processing*. Texts in Computer Science, 2016. [doi:10.1007/978-1-4471-6684-9](https://doi.org/10.1007/978-1-4471-6684-9)
9292
9393
"""
94-
@with_kw struct LinearStretching{T} <: AbstractHistogramAdjustmentAlgorithm
94+
@with_kw struct LinearStretching{T} <: AbstractIntensityAdjustmentAlgorithm
9595
src_minval::T = nothing
9696
src_maxval::T = nothing
9797
dst_minval::T = 0.0f0

src/deprecations.jl

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using Base: depwarn
2+
3+
function adjust_histogram(img::Union{GenericGrayImage, AbstractArray{<:Color3}},
4+
f::LinearStretching,
5+
args...; kwargs...)
6+
7+
depwarn("adjust_histogram(img, LinearStretching()) is deprecated, use adjust_intensity(img, LinearStretching()) instead", :adjust_histogram)
8+
return adjust_intensity(img, f, args...;kwargs...)
9+
end
10+
11+
function adjust_histogram(type::Type{T},
12+
img,
13+
f::LinearStretching,
14+
args...; kwargs...) where T
15+
16+
depwarn("adjust_histogram(::Type{T}, img, LinearStretching()) is deprecated, use adjust_intensity(::Type{T}, img, LinearStretching()) instead", :adjust_histogram)
17+
return adjust_intensity(type, img, f, args...;kwargs...)
18+
end
19+
20+
function adjust_histogram(img::AbstractArray{T},
21+
f::LinearStretching,
22+
args...; kwargs...) where T <: Colorant
23+
depwarn("adjust_histogram!(img, LinearStretching()) is deprecated, use adjust_intensity(img, LinearStretching()) instead", :adjust_histogram)
24+
return adjust_intensity(img, f, args...; kwargs...)
25+
end
26+
27+
function adjust_histogram(type::Type{T},
28+
img_sequence::Vector{<:AbstractArray},
29+
f::LinearStretching,
30+
args...; kwargs...) where T
31+
32+
depwarn("adjust_histogram!(::Type{T}, img_sequence, LinearStretching()) is deprecated, use adjust_intensity(::Type{T}, img_sequence, LinearStretching()) instead", :adjust_histogram)
33+
return adjust_histogram!(type, img_sequence, f, args...; kwargs...)
34+
end
35+
36+
function adjust_histogram!(img::Union{GenericGrayImage, AbstractArray{<:Color3}},
37+
f::LinearStretching,
38+
args...; kwargs...)
39+
40+
depwarn("adjust_histogram!(img, LinearStretching()) is deprecated, use adjust_intensity!(img, LinearStretching()) instead", :adjust_histogram!)
41+
return adjust_intensity!(img, f, args...; kwargs...)
42+
end
43+
44+
function adjust_histogram!(out_sequence::Vector{T},
45+
img_sequence,
46+
f::LinearStretching,
47+
args...; kwargs...) where T <: Union{GenericGrayImage, AbstractArray{<:Color3}}
48+
49+
depwarn("adjust_histogram!(out_sequence, img_sequence, LinearStretching()) is deprecated, use adjust_intensity!(out_sequence, img_sequence, LinearStretching()) instead", :adjust_histogram!)
50+
return adjust_intensity(out_sequence, img_sequence, f, args...; kwargs...)
51+
end

0 commit comments

Comments
 (0)