The presence of metals in patient causes streaking artifacts in X-ray CT and has long been recognized as a problem that limits various applications of CT imaging. Accurate localization of metals in CT images is a critical step for metal artifacts reduction in CT imaging and many practical applications of CT images. The purpose of this work is to develop a method of auto-determination of the shape and location of metallic object(s) in the image space. The proposed method is based on the fact that when a metal object is present in a patient, a CT image can be divided into two prominent components: high density metal and low density normal tissues. This prior knowledge is incorporated into an objective function as the regularization term whose role is to encourage the solution to take a form of two intensity levels. The function is minimized by using a Gauss-Seidel iterative algorithm. A computer simulation study and four experimental studies are performed to evaluate the proposed approach. Both simulation and experimental studies show that the presented algorithm works well even in the presence of complicated shaped metal objects. For a hexagonally shaped metal embedded in a water phantom, for example, it is found that the accuracy of metal reconstruction is within sub-millimeter. The algorithm is of practical importance for imaging patients with implanted metals.