擅长:python、mysql、java
<p>没有其他方法可以相应地处理正负变化:</p>
<pre><code>non = lambda s: s if s<0 else None
mom = lambda s: max(0,s)
ox, oy = 100, 20
shift_lena = numpy.zeros_like(lena)
shift_lena[mom(oy):non(oy), mom(ox):non(ox)] = lena[mom(-oy):non(-oy), mom(-ox):non(-ox)]
</code></pre>