Patent ID: 8581996

Claim:
An imaging device comprising: a movable stage capable of moving in two different directions while mounting an object to be inspected; a camera which is arranged in face-to-face relation to the movable stage, photographs the object to be inspected, and generates a moving picture image made of a plurality of continuous frame images; a focal position change unit which changes a focal position of the camera; a still image obtaining unit which controls the camera and the focal position change unit, and obtains not less than two still images different in focal position; an omnifocal image generation unit which combines the still images, and generates an omnifocal image that is deeper in depth than an actual field of view of the camera; a height shape data generation unit which generates height shape data of the object to be inspected based on a focusing position in each pixel of the omnifocal image; a focal position control unit which obtains the focusing position corresponding to at least a part of the omnifocal image from the height shape data, and controls the focal position change unit so that the focal position of the frame image, photographed in different X-Y position from the omnifocal image, substantially coincides with the focusing position; a live positioning unit which includes a feature quantity extraction unit and a relative position determination unit, wherein the feature quantity extraction unit which extracts feature quantity from the frame image obtained by controlling the focal position change unit, and the omnifocal image or a reference image that is an image extracted based on a plurality of still images constituting the omnifocal image and the relative position determination unit which determines a relative position in X-Y direction between the frame image and the reference image by comparing the feature quantity; a live image display unit which updates a display position of the frame image with respect to the omnifocal image based on a determination result of the relative position, and displays the moving picture image on the omnifocal image; and a mosaic image generation unit which obtains a new omnifocal image corresponding to the frame image displayed as the moving picture image by the live image display unit, and generates a mosaic image with coupled to the omnifocal image, wherein the mosaic image generation unit includes a retention positioning section which operates to determine a relative position between the new omnifocal image and the mosaic image by performing a matching process with higher accuracy than the live positioning unit and an image coupling section which operates to assemble the omnifocal image and the mosaic image based on a determination result by the retention positioning section to generate a new mosaic image.