/
flip.jl
37 lines (28 loc) · 876 Bytes
/
flip.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# ---
# title: Flip
# cover: flip.gif
# description: flip the input image horizontally or vertically
# ---
# [`FlipX`](@ref)/[`FlipY`](@ref) 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
#md # ```@docs
#md # FlipX
#md # FlipY
#md # ```
## save covers #src
using ImageMagick #src
using FileIO #src
include(joinpath("..", "assets", "utilities.jl")) #src
cover = make_gif(testpattern(RGB, ratio=0.5), Either(FlipX(), FlipY()), 4) #src
ImageMagick.save("flip.gif", cover; fps=1) #src