IQM_Vis.transforms package
Submodules
IQM_Vis.transforms.additive_noise module
noise transformations
- class IQM_Vis.transforms.additive_noise.Gaussian_noise(acceptable_percent=0.9, max_iter=50, reject_low_noise=False, **kwargs)[source]
Bases:
IQM_Vis.transforms.additive_noise._base_noise
Add Gaussian noise to image. Image is clipped to the range (0, 1)
- Parameters
image (np.array) – image to have Gaussian noise added
std (float) – Standard deviation of the Gaussian noise. (Defaults to 0)
- Returns
adjusted image
- Return type
image (np.array)
- class IQM_Vis.transforms.additive_noise.noise_hypersphere(acceptable_percent=0.9, max_iter=50, reject_low_noise=False, **kwargs)[source]
Bases:
IQM_Vis.transforms.additive_noise._base_noise
Add random noise on a hypersphere with radius epsilon. Image is clipped to the range (0, 1)
- Parameters
image (np.array) – image to have noise added
std (float) – epsilon of the hypersphere radius of noise. (Defaults to 0)
- Returns
adjusted image
- Return type
image (np.array)
IQM_Vis.transforms.affine module
affine (geometric) transformations
- IQM_Vis.transforms.affine.rotation(image, angle=0)[source]
Rotate an image around its centre. Uses skimage.transform.rotate. Areas that are rotated beyond the image are filled in with black pixel values
- Parameters
image (np.array) – image to be rotated
angle (float) – amount of rotation in degrees (Defaults to 0)
- Returns
rotated image
- Return type
image (np.array)
- IQM_Vis.transforms.affine.x_shift(image, x_shift=0)[source]
Translate image horizontally
- Parameters
image (np.array) – image to be shifted
x_shift (float) – shift proportion of the image in the range (-1, 1). (Defaults to 0)
- Returns
shifted image
- Return type
image (np.array)
- IQM_Vis.transforms.affine.y_shift(image, y_shift=0)[source]
Translate image vertically
- Parameters
image (np.array) – image to be shifted
y_shift (float) – shift proportion of the image in the range (-1, 1). (Defaults to 0)
- Returns
shifted image
- Return type
image (np.array)
- IQM_Vis.transforms.affine.zoom_image(image, scale_factor=1)[source]
digital zoom of image
- Parameters
image (np.array) – image to be zoomed
scale_factor (float) – the percentage to zoom in by (for square zoom only). 0.5 = 2x zoom out 1 = normal size 2 = 2x zoom in (Defaults to 1)
- Returns
zoomed image
- Return type
image (np.array)
IQM_Vis.transforms.effects module
Sample image transformations to get the user started with
- IQM_Vis.transforms.effects.binary_threshold(image, threshold=100)[source]
conver image to binary at a given threshold
- Parameters
image (np.array) – image to be thresholded
threshold (int) – threshold value in the range (1, 255) (Defaults to 100)
- Returns
thresholded image (float32 in range 0, 1)
- Return type
image (np.array)
- IQM_Vis.transforms.effects.blur(image, kernel_size=1)[source]
Gaussian Blur on an image
- Parameters
image (np.array) – image to be rotated
kernel_size (int) – size of the convolutional kernel, will be converted to an odd number. 1 is no blur. (Defaults to 1)
- Returns
rotated image
- Return type
image (np.array)
- IQM_Vis.transforms.effects.brightness(image, value=0)[source]
Adjust image brightness. Image is clipped to the range (0, 1)
- Parameters
image (np.array) – image to have its brightness adjusted
value (float) – value to adjust all pixels by in the range (-1, 1). (Defaults to 0)
- Returns
adjusted image
- Return type
image (np.array)
- IQM_Vis.transforms.effects.brightness_hsv(image, b=0)[source]
adjust the brightness of an image
- Parameters
image (np.array) – image to have brightness adjusted
b (float) – amount of brightness to adjust by. (Defaults to 0).
- Returns
image with brightness adjusted
- Return type
image (np.array)
- IQM_Vis.transforms.effects.contrast(image, contrast=1.0)[source]
adjust the contrast of an image
- Parameters
image (np.array) – image to have contrast adjusted
contrast (float) – amount of contrast to adjust by. Values less that 1 will decrease contrast, Values higher than 1 will increase the contrast. (Defaults to 1.0).
- Returns
image with contrast adjusted
- Return type
image (np.array)
- IQM_Vis.transforms.effects.hue(image, h=0)[source]
adjust the hue of an image
- Parameters
image (np.array) – image to have hue adjusted
h (float) – amount of hue to adjust by. (Defaults to 0).
- Returns
image with hue adjusted
- Return type
image (np.array)
- IQM_Vis.transforms.effects.jpeg_compression(image, compression=101)[source]
encode image using jpeg then decode
- Parameters
image (np.array) – image to be compressed
compression (int) – amount of jpeg compression, higher is better quality. 101 returns identity image. (Defaults to 101)
- Returns
jpeg compressed image
- Return type
image (np.array)