1
に画像を変換し、私は次のように画像のpixelMatrixにいくつかの操作をやろうとしている:はPILとTkinterのを使用して、他の
start = Image.open("gua.jpg")
sta = start.load()
i,j = start.size
current = np.zeros((i,j,3))
for ix in range(i):
for jx in range(j):
current[ix,jx] = [elem*0.5 for elem in sta[ix,jx]]
current = np.asarray(current)
current = Image.fromarray(current, "RGB")
out = ImageTk.PhotoImage(current)
panel.configure(image = out)
panel.image = out
しかし、私はちょうど私のマトリックスに画像のpixelMatrixからの情報を渡す場合でも、 (current[ix,jx] = sta[ix,jx]
)、私の結果はランダムですが、何が間違っていますか?
ありがとうございました!
P.S:私は問題なくout = ImageTk.PhotoImage(start)
を行うことができます。
do 'current = np.asarray(current)' 'current'は実際にどのように見えますか?ループの中で 'print sta [ix、jx]、現在の[ix、jx]'という出力を出力します: (私はそれが本当に大きくなるだろうと知っています) –
'[128. 128. 120.]' は、配列にキャストした後に得られます。 '... [[179. 179. 177.] [174. 174. 172 。] [167 167 165] ...、 [73 68 64] [84 70 67] [153 133 132] ... ' –
あなたは何を期待していますか?私は何をしたいのですか? –