Inversion of second-difference operators with application to infrared astronomy