1. A method for image processing using a computer processor, comprising: obtaining a mask of a connected component (CC) from an image; generating, by the computer processor, a first stroke width transform (SWT) image based on the mask; calculating a plurality of stroke width parameters for the mask based on the first SWT image; identifying a first hole in the CC of the mask; calculating a stroke width estimate for the first hole based on a plurality of stroke width values of a plurality of pixels in the first SWT image surrounding the first hole; generating a first comparison of the stroke width estimate for the first hole with a limit based on the plurality of stroke width parameters for the mask; and generating, by the computer processor, a revised mask by filling the first hole in response to the first comparison.