  Optical absorption imaging has become a common technique for detecting the
density distribution of ultracold atoms. The defocus effect generally produces
artificial spatial structures in the obtained images, which confuses our
understanding of the quantum systems. Here we experimentally demonstrate one
method to optimize the optical imaging system by \emph{in-situ} imaging the
plugged hole in the cold atoms. The atoms confined in a magnetic trap are
cooled to tens of or several microkelvin by the radio-frequency evaporation
cooling, and then are plugged using a blue-detuned laser beam, forming a hole
in the center of the atomic cloud. We image the hole with a charge-coupled
device (CCD) and quantitatively analyze the artificial spatial structure due to
the defocus effect. Through minimizing the artificial structures by precisely
adjusting the CCD position, we can optimize the imaging system with an accuracy
of 0.1 mm. We also demonstrate the necessity of this method in probing rubidium
BEC with a time of flight (TOF) of 5 ms. Compared to other methods in focusing
the imaging system, the proposal demonstrated in this paper is simple and
efficient, particularly for experimentally extracting large-scale parameters
like atomic density, atomic number and the size of the atomic cloud.
