Skip to content

Geometric

Processors for geometric image transformations

[source]

RandomFlipBoxesLeftRight

paz.processors.geometric.RandomFlipBoxesLeftRight()

Flips image and implemented labels horizontally.


[source]

ToImageBoxCoordinates

paz.processors.geometric.ToImageBoxCoordinates()

Convert normalized box coordinates to image-size box coordinates.


[source]

ToNormalizedBoxCoordinates

paz.processors.geometric.ToNormalizedBoxCoordinates()

Convert image-size box coordinates to normalized box coordinates.


[source]

RandomSampleCrop

paz.processors.geometric.RandomSampleCrop(probability=0.5, max_trials=50)

Crops image while adjusting the normalized corner form bounding boxes.

Arguments

  • probability: Float between ''[0, 1]''.

[source]

RandomTranslation

paz.processors.geometric.RandomTranslation(delta_scale=[0.25, 0.25], fill_color=None)

Applies a random translation to image and labels

Arguments

  • delta_scale: List with two elements having the normalized deltas. e.g. ''[.25, .25]''.

fill_color: List of three integers indicating the color values e.g. ''[0, 0, 0]''.


[source]

RandomRotation

paz.processors.geometric.RandomRotation(rotation_range=30, fill_color=None, probability=0.5)

Randomly rotate an images

Arguments

  • rotation_range: Int. indicating the max and min values in degrees of the uniform distribution [-range, range] from which the angles are sampled.
  • fill_color: ''None'' or List of three integers indicating the color values e.g. [0, 0, 0]. If None mean channel values of the image will be calculated as fill values.
  • probability: Float between 0 and 1.

[source]

RandomKeypointTranslation

paz.processors.geometric.RandomKeypointTranslation(delta_scale=[0.2, 0.2], fill_color=None, probability=0.5)

Applies a random translation to image and keypoints.

Arguments

  • delta_scale: List with two elements having the normalized deltas. e.g. ''[.25, .25]''.
  • fill_color: ''None'' or List of three integers indicating the color values e.g. ''[0, 0, 0]''. If ''None'' mean channel values of the image will be calculated as fill values.
  • probability: Float between ''[0, 1]''.

[source]

RandomKeypointRotation

paz.processors.geometric.RandomKeypointRotation(rotation_range=30, fill_color=None, probability=0.5)

Randomly rotate an images with its corresponding keypoints.

Arguments

  • rotation_range: Int. indicating the max and min values in degrees of the uniform distribution ''[-range, range]'' from which the angles are sampled.
  • fill_color: ''None'' or List of three integers indicating the color values e.g. ''[0, 0, 0]''. If ''None'' mean channel values of the image will be calculated as fill values.

[source]

GetTransformationSize

paz.processors.geometric.GetTransformationSize(input_size, multiple)

Calculate the transformation size for the imgae. The size is tuple of length two indicating the x, y values.

Arguments

  • image: Numpy array

[source]

GetTransformationScale

paz.processors.geometric.GetTransformationScale(scaling_factor)

Calculate the transformation scale for the imgae. The scale is a numpy array of size two indicating the width and height scale.

Arguments

  • image: Numpy array
  • size: Numpy array of length 2

[source]

GetSourceDestinationPoints

paz.processors.geometric.GetSourceDestinationPoints(scaling_factor)

Returns the source and destination points for affine transformation.

Arguments

  • center: Numpy array of shape (2,). Center coordinates of image
  • scale: Numpy array of shape (2,). Scale of width and height of image
  • size: List of length 2. Size of image

[source]

GetImageCenter

paz.processors.geometric.GetImageCenter(offset=0.5)

Calculate the center of the image and add an offset to the center.

Arguments

  • image: Numpy array
  • offset: Float

[source]

WarpAffine

paz.processors.geometric.WarpAffine()

Applies an affine transformation to an image

Arguments

  • image: Numpy array
  • transform: Numpy array. Transformation matrix
  • size: Numpy array. Transformation size