Patent ID: 8731321

Claim:
An image processing device comprising: a line segment image generating section for generating a line segment image obtained by extracting contour line segments which are line segments contained in a contour of a subject in a captured image; a quadrilateral identifying section for (i) putting at least one virtual line segment in the line segment image generated by the line segment image generating section, (ii) selecting four line segments from a set which contains the at least one virtual line segment and the contour line segments, and (iii) identifying a quadrilateral defined by four straight lines containing respective selected four line segments; and an image correcting section for correcting a distortion in perspective transformation of the captured image based on the quadrilateral identified by the quadrilateral identifying section; a quadrilateral shaping section for changing a location of each of at least one side, which contains the respective at least one virtual line segment, of a quadrilateral identified by the quadrilateral identifying section, the location of each of the at least one side being changed such that each of the at least one side and its opposite side are located in parallel with each other, the image correcting section correcting the distortion in perspective transformation of the captured image based on the quadrilateral which has been shaped by the quadrilateral shaping section.