【发布时间】:2020-12-22 00:02:28
【问题描述】:
我想计算图像每一行的像素变化(这意味着从黑色到白色或从白色到黑色的任何变化), 如下图: Example of letter A
我写了这段代码,但是第二部分是错误的:
change = [0 for k in range(test.shape[0])]
total = []
for x in range(test.shape[0]-1):
change[x]=0
for y in range(test.shape[1]-1):
if test[x,y+1] != test[x,y]:
change[x] = change[x] + 1
elif test[x+1,y+1] != test[x+1, y]:
change[x] = change[x] + 1
total.append(change[x])
【问题讨论】:
-
您想获取每行的更改计数吗?
-
@Mike67 是的
标签: python image image-processing pixel image-segmentation