v Enhance Contrast Of Greyscale Image - Machine Learning

Enhance Contrast Of Greyscale Image

Preliminaries

# Load image
import cv2
import numpy as np
from matplotlib import pyplot as plt

Load Image As Greyscale

# Load image as grayscale
image = cv2.imread('images/plane_256x256.jpg', cv2.IMREAD_GRAYSCALE)

Enhance Image

# Enhance image
image_enhanced = cv2.equalizeHist(image)

View Image

# Show image
plt.imshow(image_enhanced, cmap='gray'), plt.axis("off")
plt.show()

png