ColorJitter
ColorJitter
can be used to adjust the contrast and brightness of an input image.
using Augmentor
using ImageShow, ImageCore
img_in = testpattern(RGB, ratio=0.5)
mosaicview(
img_in,
augment(img_in, ColorJitter(1.2, 0.3)),
augment(img_in, ColorJitter(0.75, -0.2));
fillvalue=colorant"white", nrow=1, npad=10
)
References
Augmentor.ColorJitter
— TypeColorJitter <: ColorOperation
Description
Adjusts the brightness and contrast of an image according to the formula α * image[i] + β * M
, where M
is either mean(image)
or the maximum intensity value.
Usage
ColorJitter()
ColorJitter(α, β; [usemax])
Arguments
α
:Real
orAbstractVector
ofReal
that denote the coefficient(s) for contrast adjustment. Defaults to0.8:0.1:1.2
.β
:Real
orAbstractVector
ofReal
that denote the coefficient(s) for brightness adjustment. Defaults to-0.2:0.1:0.2
.usemax::Bool
: Optional. Iftrue
, the brightness will be adjusted by the maximum intensity value; otherwise, the image mean will be used. Defaults totrue
.
Examples
using Augmentor
img = testpattern()
# use exactly 1.2 for contrast, and one of 0.5 and 0.8 for brightness
augment(img, ColorJitter(1.2, [0.5, 0.8]))
# pick the coefficients randomly from the specified ranges
augment(img, ColorJitter(0.8:0.1:2.0, 0.5:0.1:1.1))
This page was generated using DemoCards.jl and Literate.jl.