Weighted median filtering implemented.