Automatic correction for atmospheric degradation in infrared images