Converting grayscale images to binary images using Otsu's method is useful when you have only two classes in an input image and want to extract them without any manual threshold adjusting. In this recipe, you will learn how to do it.
Binarization of grayscale images using the Otsu algorithm
Getting ready
Before you proceed with this recipe, you will need to install the OpenCV 3.x Python API package and the matplotlib package.
How to do it...
To complete this recipe, we need to perform the following steps:
- Import the modules:
import cv2
import numpy as np
import matplotlib...