v Save Images - Machine Learning

Save Images

Preliminaries

# Load library
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.jpg', cv2.IMREAD_GRAYSCALE)

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

png

Save Image

# Save image
cv2.imwrite('images/plane_new.jpg', image)
True