A CdTe double-sided strip detector (CdTe-DSD) is an ideal device for imaging and spectroscopic measure- ments in the hard X-ray range above 10 keV. Recent development enables us to realize an imager with a detection area of ~10 cm${^2}$. An energy resolution of 1-2 keV (FWHM) and a position resolution of a few hundred {mu}m are available from the detector. This type of imager has been long awaited for non-destructive elemental analysis, especially by using negative muons, because energies of characteristic X-rays from muonic atoms are about 200 time higher than those from normal atoms. With the method that uses negative muons, hard X-ray information gives the spatial distribution of elements in samples at a certain depth defined by the initial momentum of the muon beam. In order to study three-dimensional imaging capability of the method, we have developed a compact imaging system based on CdTe-DSD and a {phi}3 mm pinhole collimator as the first prototype. We conducted experiments with samples which consist of layers of Al, BN and LiF irradiated by negative muon beams in MUSE/J-PARC and successfully reconstruct hard X-ray images of muonic X-rays from B, N and F at various depths.