def __init__(self,
              probability: float,
              black_probability: float = 0,
              white_probability: float = 0):
     Operation.__init__(self, probability)
     self.black_offset = black_probability
     self.white_offset = 1 - white_probability
Example #2
0
 def __init__(self,
              probability,
              min_scale_x,
              max_scale_x,
              min_scale_y,
              max_scale_y,
              keep_size=False):
     """
     The scale is randomised in magnitude, in between :attr:`min_scale_x`
     and :attr:`max_scale_x` or :attr:`min_scale_y` to :attr:`max_scale_y`.
     :param probability: Controls the probability that the operation is
      performed when it is invoked in the pipeline.
     :param min_scale_x: The minimum scale in x direction.
     :param max_scale_x: The maximum scale in x direction.
     :param min_scale_y: The minimum scale in y direction.
     :param max_scale_y: The maximum scale in y direction.
     :param keepSize: Indicates whether to crop the rescaled image to original size.
     :type probability: Float
     :type min_scale_x: Float
     :type max_scale_x: Float
     :type min_scale_y: Float
     :type max_scale_y: Float
     :type max_scale_y: Bool
     """
     Operation.__init__(self, probability)
     self.min_scale_x = min_scale_x
     self.max_scale_x = max_scale_x
     self.min_scale_y = min_scale_y
     self.max_scale_y = max_scale_y
     self.keep_size = keep_size
 def __init__(self, probability, intensity_low=0.7, intensity_high=1.2):
     Operation.__init__(self, probability)
     # Init classes variables with default values
     # Default values treshold intent to create a optimal range
     # Imagens cant be too dark or too brigher
     self.intensity_low = intensity_low
     self.intensity_high = intensity_high
 def __init__(self,
              probability: float,
              max_filter_size: int = 7,
              blur_size: int = 3):
     Operation.__init__(self, probability)
     self.max_filter_size = max_filter_size
     self.blur_size = blur_size
 def __init__(self,
              probability: float,
              min_size: int = 0,
              max_size: int = 9,
              min_blend_range: int = 0,
              max_blend_range: int = 9):
     Operation.__init__(self, probability)
     self.size = (min_size, max_size)
     self.blend_range = (min_blend_range, max_blend_range)
Example #6
0
 def __init__(self,
              probability,
              max_erosion,
              max_dilation,
              pixels_mean=None):
     Operation.__init__(self, probability)
     self.max_erosion = max_erosion
     self.max_dilation = max_dilation
     self.pixels_mean = pixels_mean
Example #7
0
 def __init__(self,
              probability,
              blur_type="gaussian",
              radius=(0, 1),
              fixed_radius=None):
     Operation.__init__(self, probability)
     self.blur_type = blur_type
     self.radius = radius
     self.fixed_radius = fixed_radius
Example #8
0
 def __init__(self, probability, filter_type="mean", sizes=None, size=3):
     Operation.__init__(self, probability)
     self.filter_type = filter_type
     self.size = size
     self.sizes = sizes
     self.filters = {
         "median": ImageFilter.MedianFilter,
         "min": ImageFilter.MinFilter,
         "max": ImageFilter.MaxFilter,
         "mode": ImageFilter.ModeFilter,
     }
Example #9
0
 def __init__(self, probability):
     """
     As the aspect ratio is always kept constant, only a
     :attr:`scale_factor` is required for scaling the image.
     :param probability: Controls the probability that the operation is
      performed when it is invoked in the pipeline.
     :param scale_factor: The factor by which to scale, where 1.5 would
      result in an image scaled up by 150%.
     :type probability: Float
     :type scale_factor: Float
     """
     Operation.__init__(self, probability)
Example #10
0
    def __init__(self, probability, hue_shift, saturation_scale, saturation_shift, value_scale, value_shift):
        # Call the superclass's constructor (meaning you must
        # supply a probability value):
        Operation.__init__(self, probability)
        # Set your custom operation's member variables here as required:
        self.hue_shift = hue_shift
        self.saturation_scale = saturation_scale
        self.saturation_shift = saturation_shift
        self.value_scale = value_scale
        self.value_shift = value_shift

        self.rgb_to_hsv = np.vectorize(colorsys.rgb_to_hsv)
        self.hsv_to_rgb = np.vectorize(colorsys.hsv_to_rgb)
Example #11
0
 def __init__(self, probability, max_translate_x, max_translate_y):
     """
     The translation is randomised in magnitude, from 0 to the
     :attr:`max_translate_x` or 0 to :attr:`max_translate_y` where the
     direction is randomised. The translation axis is also randomised
     :param probability: Controls the probability that the operation is
      performed when it is invoked in the pipeline.
     :param max_translate_x: The maximum translation in x direction.
     :param max_translate_y: The maximum translation in y direction.
     :type probability: Float
     :type max_translate_x: Integer
     :type max_translate_y: Integer
     """
     Operation.__init__(self, probability)
     self.max_translate_x = max_translate_x
     self.max_translate_y = max_translate_y
Example #12
0
 def __init__(self,
              probability,
              max_shear_left,
              max_shear_right,
              keep_size=False):
     """
     The shearing is randomised in magnitude, from 0 to the
     :attr:`max_shear_left` or 0 to :attr:`max_shear_right` where the
     direction is randomised. The shear axis is also randomised
     i.e. if it shears up/down along the y-axis or
     left/right along the x-axis.
     :param probability: Controls the probability that the operation is
      performed when it is invoked in the pipeline.
     :param max_shear_left: The maximum shear to the left.
     :param max_shear_right: The maximum shear to the right.
     :type probability: Float
     :type max_shear_left: Integer
     :type max_shear_right: Integer
     """
     Operation.__init__(self, probability)
     self.max_shear_left = max_shear_left
     self.max_shear_right = max_shear_right
     self.keep_size = keep_size
 def __init__(self,
              probability: float,
              random_color_probability: float = 0):
     Operation.__init__(self, probability)
     self.randomColor_offset = random_color_probability * 255
Example #14
0
 def __init__(self, probability, margin):
     Operation.__init__(self, probability)
     self.margin = margin
Example #15
0
 def __init__(self, probability, width, height):
     Operation.__init__(self, probability)
     self.width = width
     self.height = height
Example #16
0
 def __init__(self, probability: float, mean: float, sigma: float):
     Operation.__init__(self, probability)
     self.mean = mean
     self.sigma = sigma
Example #17
0
 def __init__(self, probability: float, prop: float):
     Operation.__init__(self, probability)
     self.prop = prop
Example #18
0
 def __init__(self, probability, blur=1, threshold=128):
     Operation.__init__(self, probability)
     self.blur = blur
     self.threshold = threshold
 def __init__(self, probability, manipulation):
     # Call the superclass's constructor (meaning you must
     # supply a probability value):
     Operation.__init__(self, probability)
     # Set your custom operation's member variables here as required:
     self.manipulation = manipulation
Example #20
0
 def __init__(self, probability, num_of_folds):
     Operation.__init__(self, probability)
Example #21
0
 def __init__(self, probability, max_horizontal_loss, max_vertical_loss):
     Operation.__init__(self, probability)
     self.max_horizontal_loss = max_horizontal_loss
     self.max_vertical_loss = max_vertical_loss
Example #22
0
 def __init__(self, probability, mean, std):
     Operation.__init__(self, probability)
     self.mean = mean
     self.std = std
 def __init__(self, probability, blur_type='mean'):
     Operation.__init__(self, probability)
Example #24
0
 def __init__(self, probability, prop):
     Operation.__init__(self, probability)
     self.prop = prop
 def __init__(self, probability, noise_type='gauss'):
     Operation.__init__(self, probability)
Example #26
0
 def __init__(self, probability):
     # Call the superclass's constructor (meaning you must
     # supply a probability value):
     Operation.__init__(self, probability)
Example #27
0
 def __init__(self, probability):
     Operation.__init__(self, probability)
Example #28
0
 def __init__(self, probability, mean, sigma):
     Operation.__init__(self, probability)
     self.mean = mean
     self.sigma = sigma