CropSize

Source code notebook

Crop centered window to given size

using Augmentor
using ImageShow, ImageCore

img_in = testpattern(RGB, ratio=0.5)
img_out = augment(img_in, CropSize(70, 70)) # crop out a square window

mosaicview(img_in, img_out; nrow=1, npad=10)

RCropSize is a random version that randomly choose a crop center – not necessarily the center of the input image.

augment(img_in, CropSize(70, 70))

Reference

Augmentor.CropSizeType
CropSize <: Augmentor.ImageOperation

Description

Crops out the area of the specified pixel size around the center of the input image.

For example the operation CropSize(10, 50) would denote a crop for a rectangle of height 10 and width 50 around the center of the input image.

Usage

CropSize(size)

CropSize(size...)

Arguments

  • size : NTuple or Vararg of Int that denote the output size in pixel for each dimension.

See also

CropRatio, Crop, CropNative, augment

Examples

using Augmentor
img = testpattern()

# cropped around center of rotated image
augment(img, Rotate(45) |> CropSize(300, 400))
source
Augmentor.RCropSizeType
RCropSize <: Augmentor.ImageOperation

Description

Crops out an area of predefined size at some random position of the given image.

For example the operation RCropSize(128, 64) denotes a random crop with height 128 and width 64. RCropSize(64) denotes a square shaped crop of size 64.

Usage

RCropSize(height, width)

RCropSize(width)

Arguments

  • height::Number : Height of cropped region
  • width::Number : Width of cropped region

See also

RCropRatio, CropRatio, CropSize, Crop, CropNative, augment

Examples

using Augmentor
img = testpattern()

# crop a randomly placed square of size 100
augment(img, RCropSize(100))
source

This page was generated using DemoCards.jl and Literate.jl.