Answers for "convert to grayscale image python"

5

cv2 grayscale

gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
Posted by: Guest on February-29-2020
2

Image to grayscale using python

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg

def rgb2gray(rgb):
    return np.dot(rgb[...,:3], [0.299, 0.587, 0.144])

img = mpimg.imread('img.png')

gray = rgb2gray(img)

plt.imshow(gray, cmap='gray')

plt.savefig('greyscale.png')
plt.show()
Posted by: Guest on July-22-2021
1

convert image to grayscale opencv

img_gray_mode = cv2.imread(path, cv2.IMREAD_GRAYSCALE)
Posted by: Guest on May-23-2020
0

rgb to grayscale python

from PIL import Image
img = Image.open('image.png').convert('LA')
img.save('greyscale.png')
Posted by: Guest on March-20-2021

Code answers related to "convert to grayscale image python"

Python Answers by Framework

Browse Popular Code Answers by Language