Flip
FlipX
/FlipY
can be used to flip the input image horizontally/vertically.
using Augmentor
using ImageShow, ImageCore
img_in = testpattern(RGB, ratio=0.5)
mosaicview(
img_in,
augment(img_in, FlipX()),
augment(img_in, FlipY());
fillvalue=colorant"white", nrow=1, npad=10
)
To perform a random flip, you can also pass the probablity to the constructor. For example, FlipX(0.5)
flips the image with half chance.
References
Augmentor.FlipX
— TypeFlipX <: Augmentor.AffineOperation
Description
Reverses the x-order of each pixel row. Another way of describing it would be that it mirrors the image on the y-axis, or that it mirrors the image horizontally.
If created using the parameter p
, the operation will be lifted into Either(p=>FlipX(), 1-p=>NoOp())
, where p
denotes the probability of applying FlipX
and 1-p
the probability for applying NoOp
. See the documentation of Either
for more information.
Usage
FlipX()
FlipX(p)
Arguments
p::Number
: Optional. Probability of applying the operation. Must be in the interval [0,1].
See also
Examples
julia> using Augmentor
julia> img = [200 150; 50 1]
2×2 Matrix{Int64}:
200 150
50 1
julia> img_new = augment(img, FlipX())
2×2 Matrix{Int64}:
150 200
1 50
Augmentor.FlipY
— TypeFlipY <: Augmentor.AffineOperation
Description
Reverses the y-order of each pixel column. Another way of describing it would be that it mirrors the image on the x-axis, or that it mirrors the image vertically.
If created using the parameter p
, the operation will be lifted into Either(p=>FlipY(), 1-p=>NoOp())
, where p
denotes the probability of applying FlipY
and 1-p
the probability for applying NoOp
. See the documentation of Either
for more information.
Usage
FlipY()
FlipY(p)
Arguments
p::Number
: Optional. Probability of applying the operation. Must be in the interval [0,1].
See also
Examples
julia> using Augmentor
julia> img = [200 150; 50 1]
2×2 Matrix{Int64}:
200 150
50 1
julia> img_new = augment(img, FlipY())
2×2 Matrix{Int64}:
50 1
200 150
This page was generated using DemoCards.jl and Literate.jl.