查找 RGB 图像中的裁剪像素
Find clipped pixels in a RGB image
我有一张图片 image.png,我想找到所有被剪裁的像素。这是我目前所拥有的:
for i in range(1,width):
for j in range(1, height):
r,g,b = image.getpixel((i,j))
If( ): # I don't know what should be the condition here
# do something else
我使用 Python、Tkinter、Pil.
谢谢
如果 'clipped' 你的意思是饱和,那么你可能想根据像素的强度创建一个阈值。有几个方程式试图确定这一点,但我推荐 Grayscale equations 中的一个。查看 ATSC 中使用的方程式:
I=.2126*r+.7152*g+.0722*b
然后算出你考虑的 I 值的范围是什么 'clipped'。
我有一张图片 image.png,我想找到所有被剪裁的像素。这是我目前所拥有的:
for i in range(1,width):
for j in range(1, height):
r,g,b = image.getpixel((i,j))
If( ): # I don't know what should be the condition here
# do something else
我使用 Python、Tkinter、Pil.
谢谢
如果 'clipped' 你的意思是饱和,那么你可能想根据像素的强度创建一个阈值。有几个方程式试图确定这一点,但我推荐 Grayscale equations 中的一个。查看 ATSC 中使用的方程式:
I=.2126*r+.7152*g+.0722*b
然后算出你考虑的 I 值的范围是什么 'clipped'。