Ошибка типа: неподдерживаемый тип (ы) операнда для *: 'JpegImageFile' и 'float' - PullRequest
0 голосов
/ 06 мая 2018

Я пытался запустить этот код, он показывает ошибку-

Traceback (most recent call last):
  File "C:\Python36-32\test1.py", line 13, in <module>
    img_tinted = img * [1, 0.95, 0.9]
TypeError: unsupported operand type(s) for *: 'JpegImageFile' and 'float'

Здесь Img_tinted должен изменить соотношение RGB изображения.

from scipy.misc import imread, imsave, imresize

# Read an JPEG image into a numpy array
img = imread('assets/cat.jpg')
print(img.dtype, img.shape)  # Prints "uint8 (400, 248, 3)"

img_tinted = img * [1, 0.95, 0.9]

# Resize the tinted image to be 300 by 300 pixels.
img_tinted = imresize(img_tinted, (300, 300))

# Write the tinted image back to disk
imsave('assets/cat_tinted.jpg', img_tinted)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...