March 2018
Beginner to intermediate
306 pages
9h 54m
English
import cv2import numpy as npimport matplotlib.pyplot as plt
image = cv2.imread('../data/BnW.png', 0)
_, contours, hierarchy = cv2.findContours(image, cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE)
image_external = np.zeros(image.shape, image.dtype)for i in range(len(contours)): if hierarchy[0][i][3] == -1: cv2.drawContours(image_external, contours, i, 255, -1)
image_internal = np.zeros(image.shape, image.dtype)for i in range(len(contours)): if hierarchy[0][i][3] != -1: cv2.drawContours(image_internal, contours, ...
Read now
Unlock full access