[Numpy-discussion] adaptive thresholding: get adacent cells for each pixel

stephen emslie stephenemslie at gmail.com
Fri Jun 9 20:34:36 CDT 2006

I'm just starting with numpy (via scipy) and I'm wanting to perform
adaptive thresholding
(http://www.cee.hw.ac.uk/hipr/html/adpthrsh.html) on an image.
Basically that means that I need to get a threshold for each pixel by
examining the pixels around it. In numpy this translates to finding
the adjacent cells for each cell (not including the value of the cell
we are examining) and getting the mean, or median of those cells.

I've written something that works, but is terribly slow. How would
someone with more experience get the adjacent cells for each cell
minus the cell being examined?

Stephen Emslie

More information about the Numpy-discussion mailing list