Skip to content

Commit

Permalink
add remaining docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Evizero committed May 26, 2017
1 parent 2f214e9 commit 6905395
Show file tree
Hide file tree
Showing 8 changed files with 601 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/operations/crop.jl
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Arguments
--------------
- **`size`** : `NTuple` or `Vararg` of `Int` that denote the
output size for each dimension.
output size in pixel for each dimension.
Examples
--------------
Expand Down
106 changes: 104 additions & 2 deletions src/operations/flip.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,58 @@
# TODO: implement methods for n-dim arrays

"""
FlipX <: Augmentor.AffineOperation
Description
--------------
Reverses the x-order of each pixel row. Another way of describing
it would be to mirror the image on the y-axis, or to mirror 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`](@ref). See the documentation of
[`Either`](@ref) for more information.
Usage
--------------
FlipX()
FlipX(p)
Arguments
--------------
- **`p`** : Optional. Probability of applying the operation. Must
be in the interval [0,1].
Examples
--------------
```julia
julia> using Augmentor
julia> img = [200 150; 50 1]
2×2 Array{Int64,2}:
200 150
50 1
julia> img_new = augment(img, FlipX())
2×2 Array{Int64,2}:
150 200
1 50
```
see also
--------------
[`FlipY`](@ref), [`Either`](@ref), [`augment`](@ref)
"""
immutable FlipX <: AffineOperation end
FlipX(p) = Either(FlipX(), p)
FlipX(p::Number) = Either(FlipX(), p)

@inline supports_stepview(::Type{FlipX}) = true

Expand Down Expand Up @@ -31,8 +82,59 @@ end

# --------------------------------------------------------------------

"""
FlipY <: Augmentor.AffineOperation
Description
--------------
Reverses the y-order of each pixel column. Another way of
describing it would be to mirror the image on the x-axis, or to
mirror 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`](@ref). See the documentation of
[`Either`](@ref) for more information.
Usage
--------------
FlipY()
FlipY(p)
Arguments
--------------
- **`p`** : Optional. Probability of applying the operation. Must
be in the interval [0,1].
Examples
--------------
```julia
julia> using Augmentor
julia> img = [200 150; 50 1]
2×2 Array{Int64,2}:
200 150
50 1
julia> img_new = augment(img, FlipY())
2×2 Array{Int64,2}:
50 1
200 150
```
see also
--------------
[`FlipX`](@ref), [`Either`](@ref), [`augment`](@ref)
"""
immutable FlipY <: AffineOperation end
FlipY(p) = Either(FlipY(), p)
FlipY(p::Number) = Either(FlipY(), p)

@inline supports_stepview(::Type{FlipY}) = true

Expand Down
9 changes: 9 additions & 0 deletions src/operations/noop.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
NoOp <: Augmentor.AffineOperation
Identity transformation that does not do anything with the given
image but instead passes it along unchanged (without copying).
Usually used in combination with [`Either`](@ref) to denote a
"branch" that does not perform any computation.
"""
immutable NoOp <: AffineOperation end

@inline supports_eager(::Type{NoOp}) = false
Expand Down
43 changes: 43 additions & 0 deletions src/operations/resize.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
"""
Resize <: Augmentor.Operation
Description
--------------
Transforms the image into a fixed specified pixel size.
This operation does not take any measures to preserve aspect
ratio of the source image. Instead, the original image will
simply be resized to the given dimensions. This is useful when
one needs a set of images to all be of the exact same size.
Usage
--------------
Resize(; height=64, width=64)
Resize(size)
Resize(size...)
Arguments
--------------
- **`size`** : `NTuple` or `Vararg` of `Int` that denote the
output size in pixel for each dimension.
Examples
--------------
```julia
using Augmentor
img = testpattern()
augment(img, Resize(30, 40))
```
see also
--------------
[`CropSize`](@ref), [`augment`](@ref)
"""
immutable Resize{N} <: Operation
size::NTuple{N,Int}

Expand Down
Loading

0 comments on commit 6905395

Please sign in to comment.