In this recipe, you will learn how to work with binary images, including how to apply binary element-wise operations.
Image masks and binary operations
Getting ready
You need to have OpenCV 3.x installed with Python API support and, additionally, the matplotlib package.
How to do it...
The steps for this recipe are as follows:
- Import all the packages:
import cv2
import numpy as np
import matplotlib.pyplot as plt
- Create a binary image with a circle mask:
circle_image = np.zeros((500, 500), np.uint8)
cv2.circle(circle_image, (250, 250), 100, 255, -1)
- Create a binary image...