Rotating images

Rotation is another must-know technique when working with any type of image. We will start by initializing the required libraries and loading the image from disk. We will also be using the CoordinateTransformations package from the JuliaImages collection to define a rotation transformation:

  using Images, CoordinateTransformations  img = load("sample-images/cats-3061372_640.jpg");  tfm = LinearMap(RotMatrix(-pi/4))  img = warp(img, tfm)  imshow(img)

This results in the img variable being updated with a new image, which is shown as follows:

For ease of use, please refer to the following table:

Degree Formula
-30o -pi/6

Get Hands-On Computer Vision with Julia now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.