Although different ion-atom collisions have been studied in various contexts, precise values of cross-sections for many atomic processes were seldom obtained. One of the main uncertainties originates from the value of target densities. In this paper, we describe a unique method to measure a target density precisely with a combination of physical vapor deposition and inductively coupled plasma optical emission spectrometry. This method is preliminarily applied to a charge transfer cross-section measurement in collisions between highly charged ions and magnesium vapor. The final relative uncertainty of the target density is less than 2.5%. This enables the precise studies of atomic processes in ion-atom collisions, even though in the trial test the deduction of precise capture cross-sections was limited by other systematic errors.