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)camera_pil.show()
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)camera_pil_perspective.show()
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)camera_pil_aspect.show()
We can also increase the image by increasing the saturation –
aug_saturation = imaugs.Saturation(factor=5.0)camera_pil_sat = aug_saturation(camera_pil)camera_pil_sat.show()