Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
393 B
2
Indexable
Never
import numpy as np
import matplotlib.pyplot as plt

img1 = plt.imread('test.jpg')
img = np.zeros([120, 300, 3], dtype=np.uint8)
h, w = img1.shape[:2]
img2 = np.copy(img1)

for x in range(w):
    for y in range(h):
        color = (img1[y, x]) + (255 + 0 + 255) / 255
        img2[y, x] = color

# create show image from function rgb2gray
plt.imshow(img2, cmap='gray')
plt.show()