High-order median filtering