A one-dimensional inverse problem arising in infrared thermography for the detection and characterization of buried objects is introduced. Mathematically, the problem is to reconstruct a piecewise constant coefficient of a scalar heat equation in a finite rod from measurements taken at one of its extremities. The problem is posed in the well known least-squares setting and solved by a quasi-Newton method. The contributions of this article include: (i) the parameterization of a piecewise constant function by a small number of unknown parameters which represent its constant values and locations of discontinuities; (ii) the application of the adjoint field technique in the calculation of the gradient of a discretized objective function and (iii) the application of the considered inverse problem in the detection and characterization of buried objects. Numerical results illustrate the good performance of the proposed algorithm.