1. A method for inspection, comprising: capturing an optical image of one or more features on a surface of a sample; irradiating an area of the sample containing at least one of the features with an X-ray beam; measuring an intensity of X-ray fluorescence emitted from the sample in response to the irradiating X-ray beam; processing the optical image so as to extract geometrical parameters of the at least one of the features and to compute a correction factor responsively to the geometrical parameters; and applying the correction factor to the measured intensity in order to derive a property of the at least one of the features.