A novel natural image noise level estimation based on flat patches and local statistics