擅长:python、mysql、java
<p>什么是<code>rgb</code>?可以使用空列表(或元组)再现错误</p>
<pre><code>In [101]: xy = [0,0]
...: data = np.zeros( (43,21,2), dtype=np.uint8 )
In [102]: data[xy[0],xy[1]]
Out[102]: array([0, 0], dtype=uint8)
In [103]: data[xy[0],xy[1]]=1
In [104]: data[xy[0],xy[1]]=[]
Traceback (most recent call last):
File "<ipython-input-104-70fa3a2584fa>", line 1, in <module>
data[xy[0],xy[1]]=[]
ValueError: cannot copy sequence with size 0 to array axis with dimension 2
</code></pre>
<p>3元素元组也不起作用:</p>
<pre><code>In [113]: data[xy[0],xy[1]]=(58,129,22)
Traceback (most recent call last):
File "<ipython-input-113-b469af2ddad0>", line 1, in <module>
data[xy[0],xy[1]]=(58,129,22)
ValueError: cannot copy sequence with size 3 to array axis with dimension 2
</code></pre>