[SciPy-User] Focal Majority

Nyberg, Bjorn Johan bjorn.nyberg.10 at aberdeen.ac.uk
Mon Feb 20 17:14:29 EST 2012


Hi Everyone,
I have an interesting problem and I was hoping I could get some ideas here. I want to apply a focal majority within a moving 3 x 3 window whereby if there is a majority (any type of majority i.e. more than 5 cells having the same value), assign the center cell a value of 1 otherwise assign a value of 0. Now I realize in scipy and numpy there are options with convolutions methods but I am not entirely certain of how to apply a condition statement that I would require into the window calculations.

Thanks
Nyberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20120220/73ae979d/attachment.html>


More information about the SciPy-User mailing list