Image additions with Augly:

Below are a few working examples I used to test some of Augly’s image magnification features. If you want to try this in Colab, we need to install Libmagic and Augly first

!pip install augly!apt-get install libmagic-dev!pip install python-magicimport augly.image as imaugs

Now we are ready to use Augly, but before that we need to upload a sample image. Let’s do that

from skimage import datacamera = data.astronaut()

Since Augly works with the PIL format, this is converted to –

from PIL import Imagecamera_pil = Image.fromarray(camera)
Figure 1: Original image loaded with Skimage. [This image is available here and has no known copyright restrictions.]

So, this is our original picture. By the way, he is Eileen Collins and he was elected an astronaut in 1992 and he first piloted the space shuttle STS-63 in 1995.

Let’s start with relatively simple addition operations, such as changing perspective

aug_perspective = imaugs.PerspectiveTransform(sigma=20.0)camera_pil_perspective = aug_perspective(camera_pil)
Perspective change in Figure 1 (image created by the author)

Here sigma refers to the standard deviation of the distribution of target coordinates, and higher sigma value, the stronger the change is.

We can also change the aspect ratio randomly as below –

aug_aspect = imaugs.RandomAspectRatio()camera_pil_aspect = aug_aspect(camera_pil)
Randomly change the aspect ratio in Figure 1 (image created by the author)

We can also increase the image by increasing the saturation –

aug_saturation = imaugs.Saturation(factor=5.0)camera_pil_sat = aug_saturation(camera_pil)
Increasing the saturation of the original image in Figure 1 (Creator of the image)


Please enter your comment!
Please enter your name here