1. A method of generating an image by using an image capturing device, the method comprising: generating an imperfect image by focusing an object and capturing the object while the object is focused, the imperfect image excluding data corresponding to one or more pixel sensors; generating a defocused image by defocusing the object, the defocused image including the data corresponding to the one or more pixel sensors, the data corresponding to the one or more pixel sensors being generated by using neighboring pixel sensors around the one or more pixel sensors; extracting the data corresponding to the one or more pixel sensors based on data included in the generated imperfect image and data included in the generated defocused image; and generating a final image by reflecting the extracted data to at least one of the generated imperfect image and the generated defocused image.