An image processing device (100, 200) comprising: a local mean image generating section (110, 210) configured to generate a local mean image of an input image; a binarization image generating section (120, 220) configured to generate a binarization image of the input image, where pixels corresponding to high frequency regions in the input image have a first grey scale and pixels corresponding to low frequency regions in said image have a second grey scale; a ternarization image generating section (130, 230) configured to divide, based on comparison between the input image and the local mean image, regions having the first grey scale in the binarization image into regions having the first grey scale and regions having a third grey scale, so as to generate a ternarization image of the input image; a filling section (140, 240) configured to recognize connected regions having the second grey scale in the ternarization image, to fill the connected regions with the first grey scale when a ratio of an amount of pixels having the first grey scale to that of pixels having the third grey scale at boundaries of the connected regions is greater than a predetermined threshold, and to fill the connected regions with the third grey scale when a ratio of an amount of pixels having the third grey scale to that of pixels having the first grey scale at boundaries of the connected regions is greater than the predetermined threshold, wherein the filling section performs the filling under a condition that the area of the connected regions is less than a predetermined threshold and/or a consistency of grey scale of the connected regions reaches a predetermined criterion; and a recognizing section configured to recognize strokes and/or lines in the input image according to the ratio of the amount of pixels having the first grey scale to the amount of pixels having the third grey scale at the boundary of a connected region which is consisted by pixels having the first grey scale and pixels having the third grey scale in the filled ternarization image. a local mean image generating section (110, 210) configured to generate a local mean image of an input image; a binarization image generating section (120, 220) configured to generate a binarization image of the input image, where pixels corresponding to high frequency regions in the input image have a first grey scale and pixels corresponding to low frequency regions in said image have a second grey scale; a ternarization image generating section (130, 230) configured to divide, based on comparison between the input image and the local mean image, regions having the first grey scale in the binarization image into regions having the first grey scale and regions having a third grey scale, so as to generate a ternarization image of the input image; a filling section (140, 240) configured to recognize connected regions having the second grey scale in the ternarization image, to fill the connected regions with the first grey scale when a ratio of an amount of pixels having the first grey scale to that of pixels having the third grey scale at boundaries of the connected regions is greater than a predetermined threshold, and to fill the connected regions with the third grey scale when a ratio of an amount of pixels having the third grey scale to that of pixels having the first grey scale at boundaries of the connected regions is greater than the predetermined threshold, wherein the filling section performs the filling under a condition that the area of the connected regions is less than a predetermined threshold and/or a consistency of grey scale of the connected regions reaches a predetermined criterion; and a recognizing section configured to recognize strokes and/or lines in the input image according to the ratio of the amount of pixels having the first grey scale to the amount of pixels having the third grey scale at the boundary of a connected region which is consisted by pixels having the first grey scale and pixels having the third grey scale in the filled ternarization image.