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
13 changes: 10 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
name = "ImageContrastAdjustment"
uuid = "f332f351-ec65-5f6a-b3d1-319c6670881a"
authors = ["Dr. Zygmunt L. Szpak <zygmunt.szpak@gmail.com>"]
version = "0.3.10"
authors = ["Dr. Zygmunt L. Szpak <zygmunt.szpak@gmail.com> and contributors"]
version = "0.4.0"

[deps]
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
ImageTransformations = "02fcd773-0e25-5acc-982a-7f6622650795"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

[compat]
ImageCore = "0.9.3"
ImageTransformations = "0.8.1, 0.9"
IntervalSets = "0.5.3"
Parameters = "0.12"
Reexport = "1.2.2"
StatsBase = "0.33"
julia = "1"

[extras]
ImageFiltering = "6a3955dd-da59-5b1f-98d4-e7296123deb5"
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990"

[targets]
test = ["Test", "ImageFiltering", "TestImages", "ImageMagick", "LinearAlgebra"]
test = ["Test", "ImageFiltering", "TestImages", "ImageMagick", "ImageIO", "LinearAlgebra"]
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
ImageContrastAdjustment = "f332f351-ec65-5f6a-b3d1-319c6670881a"
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
ImageShow = "4e3cecfd-b093-5904-9786-8bbb286a6a31"
Expand Down
11 changes: 11 additions & 0 deletions docs/src/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ adjust_histogram!
build_histogram
```

## Adjunt Types
```@docs
Percentiles
MinMax
```

## Algorithms

```@docs
Expand Down Expand Up @@ -48,3 +54,8 @@ Matching
```@docs
MidwayEqualization
```

### PiecewiseLinearStretching
```@docs
PiecewiseLinearStretching
```
25 changes: 25 additions & 0 deletions src/ImageContrastAdjustment.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ using ImageCore
using ImageTransformations: imresize
# Where possible we avoid a direct dependency to reduce the number of [compat] bounds
using ImageCore.MappedArrays
using IntervalSets
using Parameters: @with_kw # Same as Base.@kwdef but works on Julia 1.0
using Reexport
using StatsBase: percentile
@reexport using IntervalSets

# TODO: port HistogramAdjustmentAPI to ImagesAPI
include("HistogramAdjustmentAPI/HistogramAdjustmentAPI.jl")
Expand All @@ -14,6 +18,23 @@ import .HistogramAdjustmentAPI: AbstractHistogramAdjustmentAlgorithm,
# TODO Relax this to all image color types
const GenericGrayImage = AbstractArray{<:Union{Number, AbstractGray}}

# Temporary definition which will be moved to ImageCore.
"""
Percentiles(p₁, p₂, p₃, ..., pₙ)
Specifies a length-n list of [percentiles](https://en.wikipedia.org/wiki/Percentile).
"""
struct Percentiles{T} <: Real
p::T
end
Percentiles(args...) = Percentiles(tuple(args...))
"""
MinMax()
A type that can be used to signal to [`PiecewiseLinearStretching`](@ref) that it should
use the mininum and maximum value in an image as it source or destination interval.
"""
struct MinMax end


include("core.jl")
include("build_histogram.jl")
include("algorithms/common.jl")
Expand All @@ -24,6 +45,7 @@ include("algorithms/contrast_stretching.jl")
include("algorithms/gamma_correction.jl")
include("algorithms/matching.jl")
include("algorithms/midway_equalization.jl")
include("algorithms/piecewise_linear_stretching.jl")
include("compat.jl")

export
Expand All @@ -35,6 +57,9 @@ export
GammaCorrection,
LinearStretching,
ContrastStretching,
PiecewiseLinearStretching,
Percentiles,
MinMax,
build_histogram,
adjust_histogram,
adjust_histogram!
Expand Down
Loading