1. An image processing device comprising: a pattern output part that superimposes a pattern having a predetermined shape and a nearly black area on a part of an image and outputs the image to a light modulator; a pattern detection part that detects the pattern from a pattern image formed by imaging of the image containing the pattern and the nearly black area projected on a projected surface; a line detection part that detects at least two lines of each side of a frame, based on a taken image of at least a part of the frame of the projected surface within the nearly black area in the pattern image, a total number of lines detected for the frame being at least eight lines; a coordinate conversion factor calculation part that calculates a coordinate conversion factor for conversion of coordinates in the taken image into coordinates in the light modulator based on coordinates of the pattern in the light modulator and coordinates of the pattern detected from the pattern image; a correction value calculation part that obtains an apex of the frame based on the detected line and the coordinate conversion factor, and calculates a correction value for trapezoidal distortion correction based on the apex; and a distortion correction part that performs trapezoidal distortion correction based on the correction value.