Leptonica 1.68
C Image Processing Library

finditalic.c File Reference

Identifies italic words. More...

#include <stdio.h>
#include <stdlib.h>
#include "allheaders.h"

Go to the source code of this file.


l_int32 pixItalicWords (PIX *pixs, BOXA *boxaw, PIX *pixw, BOXA **pboxa, l_int32 debugflag)


static const char * str_ital1 = "o x "
static const char * str_ital2 = "o x "
static const char * str_ital3 = "x "

Detailed Description

Identifies italic words.

  Locate italic words.  This is an example of the use of
  hit-miss binary morphology with binary reconstruction (filling
  from a seed into a mask).
  Example: use with prog/italics.png

    l_int32   pixItalicWords()

Definition in file finditalic.c.

Function Documentation

l_int32 pixItalicWords ( PIX pixs,
BOXA boxaw,
PIX pixw,
BOXA **  pboxa,
l_int32  debugflag 


Input: pixs (1 bpp) boxaw (<optional> word bounding boxes; can be NULL) pixw (<optional> word box mask; can be NULL) &boxa (<return> boxa of italian words) debugflag (1 for debug output; 0 otherwise) Return: 0 if OK, 1 on error

Notes: (1) You can input the bounding boxes for the words in one of two forms: as bounding boxes () or as a word mask with the word bounding boxes filled (). For example, to compute , you can use pixWordMaskByDilation(). (2) Alternatively, you can set both of these inputs to NULL, in which case the word mask is generated here. This is done by dilating and closing the input image to connect letters within a word, while leaving the words separated. The parameters are chosen under the assumption that the input is 10 to 12 pt text, scanned at about 300 ppi.

Definition at line 92 of file finditalic.c.

References boxaDestroy(), boxaWrite(), ERROR_INT, IFF_PNG, L_SET_PIXELS, NULL, pixaCreate(), pixaDestroy(), pixaDisplay(), pixClone(), pixClose(), pixConnComp(), pixConvertTo32(), pixCreateTemplate(), L_Dewarp::pixd, pixDestroy(), pixHMT(), pixMaskBoxa(), pixMorphSequence(), pixOpen(), pixRenderBoxaArb(), pixSaveTiledOutline(), pixSeedfillBinary(), pixWrite(), PROCNAME, selCreateFromString(), selDestroy(), str_ital1, str_ital2, and str_ital3.

Variable Documentation

const char* str_ital1 = "o x " [static]

Definition at line 35 of file finditalic.c.

Referenced by pixItalicWords().

const char* str_ital2 = "o x " [static]

Definition at line 49 of file finditalic.c.

Referenced by pixItalicWords().

const char* str_ital3 = "x " [static]

Definition at line 63 of file finditalic.c.

Referenced by pixItalicWords().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines