1. An inspection method for inspecting a device mounted on a substrate, comprising: generating a shape template of the device; acquiring height information of each pixel by projecting grating pattern light onto the substrate through a projecting section; generating a contrast map corresponding to the height information of each pixel; and comparing the contrast map with the shape template.