1. An apparatus for processing image data, comprising: a memory; and a processing unit coupled to the memory, the processing unit being configured to obtain a set of weighting coefficients to be used in calculating replacement pixel values associated with defective sensing elements of a detector array, the set of weighting coefficients including at least one negative weighting coefficient, obtain information identifying one or more defective sensing elements of the detector array, receive image data of an image from the detector array, calculate a weighted average of pixel values from sensing elements adjacent to a first defective sensing element of the detector array using at least some of the weighting coefficients, and assign the weighted average to be a replacement pixel value for the first defective sensing element.