Method for enhancing monochrome text image
A method for enhancing text image is applicable to a digital image containing monochrome text. The method is first to label text pixels and to-be-determined pixels according to grayscales of the image pixels. Then, to identify some mostly-be text pixels, smooth them into text pixels; and look for text edge pixels from the rest of the to-be-determined pixels, and fill the text pixels to enhance contrast of text and background. The zigzags are thus removed and the text clearness is improved.
1 . An image enhancement method, applicable to monochrome text image in a digital image, for improving clearness of text, comprising steps of:
labeling text pixels and to-be-determined pixels in said image according to grayscales of image pixels;
searching mostly-be text pixels from said to-be-determined pixels, and smoothing said mostly-be text pixels into text pixels;
searching edge pixels from the rest of said to-be-determined pixels, and filling said edge pixels; and
filling said text pixels.
2 . The method according to claim 1 further comprises a step of filling the rest of to-be-determined pixels with background pixels.
3 . The method according to claim 1 wherein said step of searching mostly-be text pixels from to-be-determined pixels further comprises steps of:
fetching surrounding adjacent pixels of a to-be-determined pixel;
counting the number of continuous text pixels in said surrounding adjacent pixels; and
determining if said to-be-determined pixel is a mostly-be text pixel according to said counted number.
4 . The method according to claim 3 wherein said step of determining a mostly-be text pixel is based on a counted number larger than 5.
5 . The method according to claim 1 wherein said step of searching edge pixels from the rest of to-be-determined pixels further comprises steps of:
labeling a target pixel according to grayscale of a to-be-determined pixel;
surrounding said target pixel, defining extending lines in 8 directions;
fetching grayscale values of multiple continuous pixels adjacent to said target pixel in a line of two opposite directions;
determining styles of said multiple continuous adjacent pixels in said two opposite directions according to said grayscales; and
deciding if said target pixel is an edge pixel according to said determination.
6 . The method according to claim 5 wherein said step of deciding a target pixel as an edge pixel is based on having multiple continuous adjacent text pixels in one direction of a line and having multiple continuous adjacent background pixels in opposite direction of said line.
7 . The method according to claim 5 wherein said step of fetching grayscales of multiple continuous adjacent pixels in a line is to fetch two pixels adjacent to said target pixel in each direction of said line.
8 . The method according to claim 1 wherein said step of filling edge pixels is to fill said edge pixels with text pixels.
9 . The method according to claim 1 wherein said step of filling edge pixels is to fill said edge pixels with background pixels.
10 . The method according to claim 1 wherein said step of filling edge pixels is to fill said edge pixels partially with background pixels and partially with text pixels.