Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/algorithms/gamma_correction.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

"""
```
GammaCorrection <: AbstractHistogramAdjustmentAlgorithm
GammaCorrection <: AbstractIntensityAdjustmentAlgorithm
GammaCorrection(; gamma = 1)

adjust_histogram([T,] img, f::GammaCorrection)
adjust_histogram!([out,] img, f::GammaCorrection)
adjust_intensity([T,] img, f::GammaCorrection)
adjust_intensity!([out,] img, f::GammaCorrection)
```

Returns a gamma corrected image.
Expand Down Expand Up @@ -36,7 +36,7 @@ tool.

# Options

Various options for the parameters of the `adjust_histogram` function and the
Various options for the parameters of the `adjust_intensity` function and the
`Gamma` type are described in more detail below.

## Choices for `img`
Expand Down Expand Up @@ -65,7 +65,7 @@ intensities = 0.0:(1.0/n):1.0
img = repeat(intensities, inner=(20,20))'

# Brighten the dark tones.
imgadj = adjust_histogram( img, GammaCorrection(gamma = 1/2))
imgadj = adjust_intensity( img, GammaCorrection(gamma = 1/2))

# Display the original and adjusted image.
imshow(img)
Expand All @@ -75,7 +75,7 @@ imshow(imgadj)
# References
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)
"""
@with_kw struct GammaCorrection{T <: Real} <: AbstractHistogramAdjustmentAlgorithm
@with_kw struct GammaCorrection{T <: Real} <: AbstractIntensityAdjustmentAlgorithm
gamma::T = 1.0
end

Expand Down
35 changes: 18 additions & 17 deletions src/deprecations.jl
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
using Base: depwarn

function adjust_histogram(img::Union{GenericGrayImage, AbstractArray{<:Color3}},
f::LinearStretching,
f::Union{LinearStretching, GammaCorrection},
args...; kwargs...)

depwarn("adjust_histogram(img, LinearStretching()) is deprecated, use adjust_intensity(img, LinearStretching()) instead", :adjust_histogram)
algo = typeof(f)
depwarn("adjust_histogram(img, $algo) is deprecated, use adjust_intensity(img, $algo) instead", :adjust_histogram)
return adjust_intensity(img, f, args...;kwargs...)
end

function adjust_histogram(type::Type{T},
img,
f::LinearStretching,
f::Union{LinearStretching, GammaCorrection},
args...; kwargs...) where T

depwarn("adjust_histogram(::Type{T}, img, LinearStretching()) is deprecated, use adjust_intensity(::Type{T}, img, LinearStretching()) instead", :adjust_histogram)
algo = typeof(f)
depwarn("adjust_histogram(::Type{T}, img, $algo) is deprecated, use adjust_intensity(::Type{T}, img, $algo) instead", :adjust_histogram)
return adjust_intensity(type, img, f, args...;kwargs...)
end

function adjust_histogram(img::AbstractArray{T},
f::LinearStretching,
f::Union{LinearStretching, GammaCorrection},
args...; kwargs...) where T <: Colorant
depwarn("adjust_histogram!(img, LinearStretching()) is deprecated, use adjust_intensity(img, LinearStretching()) instead", :adjust_histogram)
algo = typeof(f)
depwarn("adjust_histogram!(img, $algo) is deprecated, use adjust_intensity(img, $algo) instead", :adjust_histogram)
return adjust_intensity(img, f, args...; kwargs...)
end

function adjust_histogram(type::Type{T},
img_sequence::Vector{<:AbstractArray},
f::LinearStretching,
f::Union{LinearStretching, GammaCorrection},
args...; kwargs...) where T

depwarn("adjust_histogram!(::Type{T}, img_sequence, LinearStretching()) is deprecated, use adjust_intensity(::Type{T}, img_sequence, LinearStretching()) instead", :adjust_histogram)
algo = typeof(f)
depwarn("adjust_histogram!(::Type{T}, img_sequence, $algo) is deprecated, use adjust_intensity(::Type{T}, img_sequence, $algo) instead", :adjust_histogram)
return adjust_histogram!(type, img_sequence, f, args...; kwargs...)
end

function adjust_histogram!(img::Union{GenericGrayImage, AbstractArray{<:Color3}},
f::LinearStretching,
f::Union{LinearStretching, GammaCorrection},
args...; kwargs...)

depwarn("adjust_histogram!(img, LinearStretching()) is deprecated, use adjust_intensity!(img, LinearStretching()) instead", :adjust_histogram!)
algo = typeof(f)
depwarn("adjust_histogram!(img, $algo) is deprecated, use adjust_intensity!(img, $algo) instead", :adjust_histogram!)
return adjust_intensity!(img, f, args...; kwargs...)
end

function adjust_histogram!(out_sequence::Vector{T},
img_sequence,
f::LinearStretching,
f::Union{LinearStretching, GammaCorrection},
args...; kwargs...) where T <: Union{GenericGrayImage, AbstractArray{<:Color3}}

depwarn("adjust_histogram!(out_sequence, img_sequence, LinearStretching()) is deprecated, use adjust_intensity!(out_sequence, img_sequence, LinearStretching()) instead", :adjust_histogram!)
algo = typeof(f)
depwarn("adjust_histogram!(out_sequence, img_sequence, $algo) is deprecated, use adjust_intensity!(out_sequence, img_sequence, $algo) instead", :adjust_histogram!)
return adjust_intensity(out_sequence, img_sequence, f, args...; kwargs...)
end