Majority Focal Statistics Classification

Discussion created by bjebn on Feb 19, 2012
Latest reply on Feb 19, 2012 by curtvprice
Hi Everyone,
I have an interesting problem that I was hoping that I could get some ideas here on the forums. I want to apply a technique similar to that of the focal statistics majority method however, instead of assigning the value of the center cell that of the majority value I want to assign a predefined number. In other words, if in a 3x3 window, 5 cells that have a value of 4 assign the center cell a value of 1, 5 cells have a value of 8 assign the center cell a value of 1, however if there is no majority (i.e greater than 50%) assign a value of 0. I've heard that Focal Statistics or a moving window might be possible in Numpy? Any ideas on where to start?