我需要找到图像中的所有红色像素,并创建只包含红色像素的图像。目前,我一直在研究matplotlib,因为我对它非常陌生。
def find_red_pixels(map, upper_threshold=100, lower_threshold =50):
"""Finds all red pixels of the "map" image and outputs a binary image file "map-red-pixels.jpg" """
red_map = []
for row in map:
for pixel in row:
print(pixel)
我是图片处理方面的新手,尝试了这个方法,但我不理解输出为像素的值[0.0.01]等代表什么意思。有没有更简单的方法?
upper_threshold=100, lower_threshold=50
参数的意图;以捕获所有红色值大于0.5的像素。 - CDJB