update bilateral filter to allow general use