Leptonica
1.54
|
l_int32 recogCreateDid | ( | L_RECOG * | recog, |
PIX * | pixs | ||
) |
Input: recog pixs (of 1 bpp image to match) Return: 0 if OK, 1 on error
Input: recog (with LUT's pre-computed) pixs (typically of multiple touching characters, 1 bpp) nlevels (of templates; 2 for now) &pixdb (<optional return>=""> debug result; can be null) Return: 0 if OK, 1 on error
l_int32 recogDestroyDid | ( | L_RECOG * | recog | ) |
Input: recog Return: 0 if OK, 1 on error
Notes: (1) As the signature indicates, this is owned by the recog, and can only be destroyed using this function.
l_int32 recogDidExists | ( | L_RECOG * | recog | ) |
Input: recog Return: 1 if recog->did exists; 0 if not or on error.
L_RDID* recogGetDid | ( | L_RECOG * | recog | ) |
Input: recog Return: did (still owned by the recog), or null on error
Notes: (1) This also makes sure the arrays are defined.
static l_int32 recogGetWindowedArea | ( | L_RECOG * | recog, |
l_int32 | index, | ||
l_int32 | x, | ||
l_int32 * | pdely, | ||
l_int32 * | pwsum | ||
) | [static] |
Input: recog index (of template) x (pixel position of left hand edge of template) &dely (<return> y shift of template relative to pix1) &wsum (<return> number of fg pixels in window of pixs) Return: 0 if OK, 1 on error
Notes: (1) This is called after the best path has been found through the trellis, in order to produce a correlation that can be used to evaluate the confidence we have in the identification. The correlation is |1 & 2|^2 / (|1| * |2|). |1 & 2| is given by the count array, |2| is found from nasum_u[], and |1| is wsum returned from this function.
static l_int32 recogMakeDecodingArray | ( | L_RECOG * | recog, |
l_int32 | index, | ||
l_int32 | debug | ||
) | [static] |
Input: recog index (of averaged template) debug (1 for debug output; 0 otherwise) Return: 0 if OK, 1 on error
Notes: (1) Generates the bit-and sum array for a character template along pixs. (2) The values are saved in the scoring arrays at the left edge of the template as it is positioned on pixs.
l_int32 recogMakeDecodingArrays | ( | L_RECOG * | recog, |
PIX * | pixs, | ||
l_int32 | debug | ||
) |
Input: recog (with LUT's pre-computed) pixs (typically of multiple touching characters, 1 bpp) debug (1 for debug output; 0 otherwise) Return: 0 if OK, 1 on error
Notes: (1) Generates the bit-and sum arrays for each character template along pixs. These are used in the dynamic programming step. (2) Previous arrays are destroyed and the new arrays are allocated. (3) The values are saved in the scoring arrays at the left edge of the template. They are used in the viterbi process at the setwidth position (which is near the RHS of the template as it is positioned on pixs) in the generated trellis.
static l_int32 recogRescoreDidResult | ( | L_RECOG * | recog, |
PIX ** | ppixdb | ||
) | [static] |
Input: recog (with LUT's pre-computed) &pixdb (<optional return>=""> debug result; can be null) Return: 0 if OK, 1 on error
Notes: (1) This does correlation matching with all templates using the viterbi path segmentation.
l_int32 recogRunViterbi | ( | L_RECOG * | recog, |
PIX ** | ppixdb | ||
) |
Input: recog (with LUT's pre-computed) &pixdb (<optional return>=""> debug result; can be null) Return: 0 if OK, 1 on error
Notes: (1) This is recursive, in that (a) we compute the score successively at all pixel positions x, (b) to compute the score at x in the trellis, for each template we look backwards to (x - setwidth) to get the score if that template were to be printed with its setwidth location at x. We save at x the template and score that maximizes the sum of the score at (x - setwidth) and the log-likelihood for the template to be printed with its LHS there.
l_int32 recogSetChannelParams | ( | L_RECOG * | recog, |
l_int32 | nlevels | ||
) |
Input: recog nlevels Return: 0 if OK, 1 on error
Notes: (1) This converts the independent bit-flip probabilities in the "channel" into log-likelihood coefficients on image sums. These coefficients are only defined for the non-background template levels. Thus for nlevels = 2 (one fg, one bg), only beta[1] and gamma[1] are used. For nlevels = 4 (three fg templates), we use beta[1-3] and gamma[1-3].
static PIX * recogShowPath | ( | L_RECOG * | recog, |
l_int32 | select | ||
) | [static] |
Input: recog (with LUT's pre-computed) select (0 for Viterbi; 1 for rescored) Return: pix (debug output), or null on error)
static l_int32 recogTransferRchToDid | ( | L_RECOG * | recog, |
l_int32 | x, | ||
l_int32 | y | ||
) | [static] |
Input: recog (with rch and did defined) x (left edge of extracted region, relative to decoded line) y (top edge of extracted region, relative to input image) Return: 0 if OK, 1 on error
Notes: (1) This is used to transfer the results for a single character match to the rescored did arrays.
const l_float32 DefaultAlpha2[] = {0.95, 0.9} [static] |
const l_float32 DefaultAlpha4[] = {0.95, 0.9, 0.75, 0.25} [static] |
const l_float32 SetwidthFraction = 0.95 [static] |