#include <stdio.h>
#include <stdlib.h>
#include "allheaders.h"
Функции | |
l_int32 | pixGetRegionsBinary (PIX *pixs, PIX **ppixhm, PIX **ppixtm, PIX **ppixtb, l_int32 debug) |
PIX * | pixGenHalftoneMask (PIX *pixs, PIX **ppixtext, l_int32 *phtfound, l_int32 debug) |
PIX * | pixGenTextlineMask (PIX *pixs, PIX **ppixvws, l_int32 *ptlfound, l_int32 debug) |
PIX * | pixGenTextblockMask (PIX *pixs, PIX *pixvws, l_int32 debug) |
Input: pixs (1 bpp, assumed to be 150 to 200 ppi) &pixtext (<optional return>=""> text part of pixs) &htfound (<optional return>=""> 1 if the mask is not empty) debug (flag: 1 for debug output) Return: pixd (halftone mask), or null on error
Input: pixs (1 bpp, textline mask, assumed to be 150 to 200 ppi) pixvws (vertical white space mask) debug (flag: 1 for debug output) Return: pixd (textblock mask), or null on error
Notes: (1) Both the input masks (textline and vertical white space) and the returned textblock mask are at the same resolution. (2) The result is somewhat noisy, in that small "blocks" of text may be included. These can be removed by post-processing, using, e.g., pixSelectBySize(pix, 60, 60, 4, L_SELECT_IF_EITHER, L_SELECT_IF_GTE, NULL);
Input: pixs (1 bpp, assumed to be 150 to 200 ppi) &pixvws (<return> vertical whitespace mask) &tlfound (<optional return>=""> 1 if the mask is not empty) debug (flag: 1 for debug output) Return: pixd (textline mask), or null on error
Notes: (1) The input pixs should be deskewed. (2) pixs should have no halftone pixels. (3) Both the input image and the returned textline mask are at the same resolution.
l_int32 pixGetRegionsBinary | ( | PIX * | pixs, | |
PIX ** | ppixhm, | |||
PIX ** | ppixtm, | |||
PIX ** | ppixtb, | |||
l_int32 | debug | |||
) |
Input: pixs (1 bpp, assumed to be 300 to 400 ppi) &pixhm (<optional return>=""> halftone mask) &pixtm (<optional return>=""> textline mask) &pixtb (<optional return>=""> textblock mask) debug (flag: set to 1 for debug output) Return: 0 if OK, 1 on error
Notes: (1) It is best to deskew the image before segmenting. (2) The debug flag enables a number of outputs. These are included to show how to generate and save/display these results.