"Fossies" - the Fresh Open Source Software Archive

Member "tesseract-ocr/doc/html/blobclass_8h.html" (26 Oct 2012, 25464 Bytes) of package /linux/misc/old/tesseract-ocr-3.02.02-doc-html.tar.gz:

Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the tesseract-ocr-3.02.02-doc-html.tar.gz project site itself.

Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
blobclass.h File Reference
#include "featdefs.h"
#include "oldlist.h"
#include "blobs.h"

Go to the source code of this file.


#define EnableCharDisplay()   (DisplayCharacters = TRUE)
#define DisableCharDisplay()   (DisplayCharacters = FALSE)
#define EnableMatchDisplay()   (DisplayMatchList = TRUE)
#define DisableMatchDisplay()   (DisplayMatchList = FALSE)


void LearnBlob (const FEATURE_DEFS_STRUCT &FeatureDefs, const STRING &filename, TBLOB *Blob, const DENORM &denorm, const char *BlobText)
void LearnBlob (const FEATURE_DEFS_STRUCT &FeatureDefs, FILE *File, TBLOB *Blob, const DENORM &denorm, const char *BlobText, const char *FontName)

Macro Definition Documentation

#define DisableCharDisplay ( )    (DisplayCharacters = FALSE)

Definition at line 33 of file blobclass.h.

#define DisableMatchDisplay ( )    (DisplayMatchList = FALSE)

Definition at line 37 of file blobclass.h.

#define EnableCharDisplay ( )    (DisplayCharacters = TRUE)

Include Files and Type Defines —————————————————————————-

Definition at line 32 of file blobclass.h.

#define EnableMatchDisplay ( )    (DisplayMatchList = TRUE)

Definition at line 36 of file blobclass.h.

Function Documentation

void LearnBlob ( const FEATURE_DEFS_STRUCT FeatureDefs,
const STRING filename,
const DENORM denorm,
const char *  BlobText 

Public Function Prototypes —————————————————————————-

Public Code —————————————————————————-

Definition at line 52 of file blobclass.cpp.

** Parameters:
** Blob blob whose micro-features are to be learned
** Row row of text that blob came from
** BlobText text that corresponds to blob
** TextLength number of characters in blob
** Globals:
** imagefile base filename of the page being learned
** classify_font_name
** name of font currently being trained on
** Operation:
** Extract micro-features from the specified blob and append
** them to the appropriate file.
** Return: none
** Exceptions: none
** History: 7/28/89, DSJ, Created.
#define TRAIN_SUFFIX ".tr"
static FILE *FeatureFile = NULL;
STRING Filename(filename);
// If no fontname was set, try to extract it from the filename
STRING CurrFontName = classify_font_name;
if (CurrFontName == kUnknownFontName) {
// filename is expected to be of the form [lang].[fontname].exp[num]
// The [lang], [fontname] and [num] fields should not have '.' characters.
const char *basename = strrchr(filename.string(), '/');
const char *firstdot = strchr(basename ? basename : filename.string(), '.');
const char *lastdot = strrchr(filename.string(), '.');
if (firstdot != lastdot && firstdot != NULL && lastdot != NULL) {
CurrFontName = firstdot;
CurrFontName[lastdot - firstdot] = '\0';
// if a feature file is not yet open, open it
// the name of the file is the name of the image plus TRAIN_SUFFIX
if (FeatureFile == NULL) {
Filename += TRAIN_SUFFIX;
FeatureFile = Efopen(Filename.string(), "wb");
cprintf("TRAINING ... Font name = %s\n", CurrFontName.string());
LearnBlob(FeatureDefs, FeatureFile, Blob, denorm, BlobText,
} // LearnBlob
void LearnBlob ( const FEATURE_DEFS_STRUCT FeatureDefs,
FILE *  File,
const DENORM denorm,
const char *  BlobText,
const char *  FontName 

Definition at line 102 of file blobclass.cpp.

ASSERT_HOST(FeatureFile != NULL);
CharDesc = ExtractBlobFeatures(FeatureDefs, denorm, Blob);
if (CharDesc == NULL) {
cprintf("LearnBLob: CharDesc was NULL. Aborting.\n");
if (ValidCharDescription(FeatureDefs, CharDesc)) {
// label the features with a class name and font name
fprintf(FeatureFile, "\n%s %s\n", FontName, BlobText);
// write micro-features to file and clean up
WriteCharDescription(FeatureDefs, FeatureFile, CharDesc);
} else {
tprintf("Blob learned was invalid!\n");
} // LearnBlob