1. A pattern matching device, comprising: a dilated image generating unit that generates a dilated image based on a resultant image obtained by logical operation between a first image pattern and a second image pattern, and a comparing unit that compares the first image pattern with the second image pattern, based on a ratio of overlap between the first image pattern and the dilated image generated by the dilated image generating unit, and a ratio of overlap between the second image pattern and the dilated image generated by the dilated image generating unit.