1. An imaging device comprising: an imaging processor that captures a plurality of secondary images of the same object at different in-focus positions by driving a photographing lens; a distance information detector that detects distance information of the objects captured in each area of an image based on the contrast in each of the areas in each of the secondary images; a primary image capturing processor that further captures the same image of the object as a primary image; and an image processor that carries out image processing on the primary image based on the distance information.