In this paper, we give a general criterion for elimination of imaginaries using an abstract independence relation. We also study germs of definable functions at certain well-behaved invariant types. Finally we apply these results to prove the elimination of imaginaries in bounded pseudo p-adically closed fields.