Appendix
1. Basics of Image Processing
Activity 1.01: Mirror Effect with a Twist
Solution:
- Let's start by importing the necessary libraries:
# Load modules
import cv2
import numpy as np
import matplotlib.pyplot as plt
- Next, let's specify the magic command for displaying images in a notebook:
%matplotlib inline
- Now, we can load the image and display it using Matplotlib.
Note
Before proceeding, ensure that you can change the path to the images (highlighted) based on where the image is saved in your system.
The code is as follows:
# Load image
img = cv2.imread("../data/lion.jpg")
plt.imshow(img[:,:,::-1])
plt.show()
The output is as follows:
Get The Computer Vision Workshop 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.