The open circuit voltage (OCV) is an essential variable for accurate state of charge (SoC) estimation of lithium ion batteries in electric vehicles (EVs). OCV test must be performed periodically to calibrate the OCV-SoC relationship after battery aging. Furthermore, due to pronounced hysteresis effects and wide flat regions in the OCV-SoC curves of LiFePO4 batteries, the traditional OCV tests often take three to five days to obtain data on one or more fully charge and discharge cycles, which are time-consuming and become unreliable under changing driving cycles and operating conditions. In addition, the OCV-SoC relationship determined in a certain aging stage cannot be used for the full life cycle and whole operating conditions. In this paper, the OCV-SoC relationship is extracted from any existing current-voltage measurements by using an H infinity filter within several seconds, which is verified under constant current conditions and dynamic conditions. Our results show that the estimated OCV can result in accurate SoC estimation with a maximum error of 1%.