revised mean filter and made thresh_w_mean output a figure for visualization