A technique was previously developed, based on magnetic field measurements, to localize hypodermic and sewing needles lost in the human body, with the purpose of surgical extraction. The measurements are performed using a SQUID magnetometer, which detects the magnetic field associated with the remanent magnetization of the needle. The technique allowed easy surgical localization of the needles with good precision in all sir clinical cases studied so far. The procedure greatly decreases the surgery time for foreign body extraction, and also reduces the generally high odds of failure, This paper presents an improvement of the original algorithm, which is now independent of any constant magnetic field component, thus overcoming the main experimental difficulty usually found, namely that a SQUID system does not measure absolute fields.