[SciPy-User] autocrop 2d array

Zachary Pincus zachary.pincus at yale.edu
Thu May 12 07:56:46 EDT 2011


If you can specify the problem a little more clearly (I'm not familiar with autocrop) maybe I could help. Are you looking for the smallest sub-array containing all of the non-zero values in the array? (That is, to trim off zero-valued borders?)

Zach


On May 12, 2011, at 7:30 AM, Christian K. wrote:

> Hi,
> 
> I need to strip 0-values from a ndarray, similar to the autocrop function in 
> image manipulation, i.e. I need to find the 0<->any steps in the ndarray. I 
> cannot think of a solution without looping but I am sure there must be one 
> based on clever indexing. Any ideas?
> 
> Thanks in advnace, Christian
> 
> 
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user




More information about the SciPy-User mailing list