The method of wireless power transmission is an important method in powering wireless medical devices in vivo, but the efficiency is still low, especially when the devices move freely in random positions and orientations. Aiming at powering an endoscopic capsule, a method for improving efficiency of wireless power transmission is proposed, which is based on electromagnetic localization and synthesis of magnetic field vector. By analysing the model and experimenting in vitro, the proposed method is verified, which can improve the efficiency of the wireless power transmission because of accurate localization of the capsule and synthesis of magnetic field vector.