1. An X-ray imaging apparatus comprising: an X-ray generator configured to generate and emit X-rays; an X-ray detector configured to detect the X-rays and count a number of photons having energy equal to or greater than threshold energy of the X-ray detector, per pixel, among photons contained in the detected X-rays; and a controller configured to: extract corrected threshold energy corresponding to target threshold energy mapped to each pixel, and calculate corrected X-ray data corresponding to the corrected threshold energy per pixel from a plurality of X-ray data acquired based on a plurality of images of a target object obtained by using a plurality of approximate energies equal or approximate to the target threshold energy as the threshold energy of the X-ray detector.