crumpets.augmentation_cpu module

crumpets.augmentation_cpu.add_blur(im, sigma)[source]

A Function that takes a numpy array that contains an Image and information about the desired blur and blurs the image. It uses cv2 to blur the image, for more information about the sigma parameter have a look into the cv2 documentation. cv.GaussianBlur

Parameters
  • im – the numpy array that contains the Image data

  • sigma – the sigma of the gaussian blur

crumpets.augmentation_cpu.add_gamma(im, color, gamma_gray, gamma_color, contrast, _base_lut=None, _pos_contrast_lut=None, _neg_contrast_lut=None)[source]

A Function that takes a numpy array that contains an Image and information about the desired gamma values and takes those gamma values to apply gamma correction to the images.

Parameters
  • im – the numpy array that contains the Image data

  • color – flag that indicates if gamma_color should be used

  • gamma_gray – gray parameter of the gamma correction

  • gamma_color – color parameter of the gamma correction

  • contrast – contrast parameter of the gamma correction

  • _base_lut – a lookup table that can be precomputed. Defaults to None. None indicates that the default lookup

table should be used. The default lookup table is computed only once and then cached. :param _pos_contrast_lut: similar to base_lut, just for the positive part of the contrast :param _neg_contrast_lut: see positive… contrast is treated asymmetrically to give better results

crumpets.augmentation_cpu.add_noise_other(im, strength)[source]

A Function that takes a numpy array that contains an Image and information about the desired noise and takes those values to add noise to the images.

Parameters
  • im – the numpy array that contains the Image data

  • strength – strength of the noise

crumpets.augmentation_cpu.add_noise_rgb(im, strength)[source]

A Function that takes a numpy array that contains an Image and information about the desired rgb noise and takes those values to add noise to the images. This function adds rgb noise, that mimics the noise of a camera sensor, what means that green has less noise.

Parameters
  • im – the numpy array that contains the Image data

  • strength – strength of the noise