# 将横向不含255的排除 print(nuary.shape) new_array = [] for i inrange(nuary.shape[0]): if255in nuary[i]: new_array.append(nuary[i]) nuary = numpy.array(new_array)
# 纵向分割图片 img_list = [[[] for _ inrange(26)] for _ inrange(7)] xuhao = -1 l = 0 for i inrange(nuary.shape[1]): if255in nuary[:,i]: if i-l==1: xuhao = xuhao+1 for n inrange(26): print(xuhao) print(n) img_list[xuhao][n].append(nuary[n,i]) pass else: l = i # 清除空数组 img_list.remove([])