作者:timer_open | 来源:互联网 | 2023-06-13 15:38
读取像素返回值图像.item(位置参数)灰度图像,返回灰度值BGR图像,返回值为B,G,R的值pimg.item(88,142)print(p)blueimg.item(78,12
读取像素
返回值 = 图像.item(位置参数)
灰度图像,返回灰度值
BGR 图像,返回值为 B,G,R 的值
p = img.item(88, 142)
print(p)
blue = img.item(78, 125, 0)
green = img.item(78, 125, 1)
red = img.item(78, 125, 2)
修改像素
图像名:itemset(位置,新值)
# 灰度图像
img.itemset((88, 99), 255)
# BGR 图像
img.itemset((88, 99, 0), 255)
img.itemset((88, 99, 1), 255)
img.itemset((88, 99, 2), 255)
python