题目

现提供一幅RGB模式的彩色位图,左框中的程序实现将其中每个像素的颜色值进行调整,使之成为一幅黑白图像。请阅读右框中的程序,程序运行的结果是: 。 from PIL import Image import numpy as np import matplotlib. pyplot as plt #打开图像并转化成数字矩阵 img-np. array(Image. open(hjpg. convert(L)) #图像尺寸分别赋值 rows, cols=img. shape #调整每个像素的RGB值 for i in range(rows): for j in range(cols): if (img[ij]<=128): img[i, j]=0 else: img[i, j]=1 #生成新的图像并显示 plt. 一间教室的面积为50m2,它的百万分之一是 cm2.
信息技术 试题推荐