October 2018
Intermediate to advanced
472 pages
10h 57m
English
First, we need to install OpenCV, which we do with this simple pip command:
pip install opencv-python
Then we will import it along with other modules for visualizations and matrix operations:
import cv2import matplotlibfrom matplotlib import colorsfrom matplotlib import pyplot as pltimport numpy as npfrom __future__ import division
Also, let's define some helper functions that will help us to plot the images and the contours:
# Defining some helper functiondef show(image): # Figure size in inches plt.figure(figsize=(15, 15)) # Show image, with nearest neighbour interpolation plt.imshow(image, interpolation='nearest') def show_hsv(hsv): rgb = cv2.cvtColor(hsv, cv2.COLOR_HSV2BGR) show(rgb) def show_mask(mask): plt.figure(figsize=(10, ...
Read now
Unlock full access