← Back to all transforms

RandomCropFromBorders

Description

Randomly crops parts of the image from the borders without resizing at the end. The cropped regions are defined
    as fractions of the original image dimensions, specified for each side of the image (left, right, top, bottom).

    Args:
        crop_left (float): Fraction of the width to randomly crop from the left side. Must be in the range [0.0, 1.0].
                            Default is 0.1.
        crop_right (float): Fraction of the width to randomly crop from the right side. Must be in the range [0.0, 1.0].
                            Default is 0.1.
        crop_top (float): Fraction of the height to randomly crop from the top side. Must be in the range [0.0, 1.0].
                          Default is 0.1.
        crop_bottom (float): Fraction of the height to randomly crop from the bottom side.
                             Must be in the range [0.0, 1.0]. Default is 0.1.
        p (float): Probability of applying the transform. Default is 1.

    Targets:
        image, mask, bboxes, keypoints

    Image types:
        uint8, float32
    

Parameters

  • p: float (default: 1)
  • crop_left: float (default: 0.1)
  • crop_right: float (default: 0.1)
  • crop_top: float (default: 0.1)
  • crop_bottom: float (default: 0.1)

Targets

  • Image
  • Mask
  • BBoxes
  • Keypoints

Try it out

Original Image (width = 484, height = 733):

Original

Transformed Image:

Transform not yet applied