mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-27 20:59:36 +08:00
show page 0 for multipage tiff;
Windows: use binary mode for fopen (issue 70); autotools: fixed cutil/Makefile.am, improved tessdata/Makefile.am; git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@604 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
parent
4abdfdb8fe
commit
7ec3dca968
@ -440,7 +440,7 @@ Boxa* TessBaseAPI::GetComponentImages(PageIteratorLevel level,
|
||||
void TessBaseAPI::DumpPGM(const char* filename) {
|
||||
if (tesseract_ == NULL)
|
||||
return;
|
||||
FILE *fp = fopen(filename, "w");
|
||||
FILE *fp = fopen(filename, "wb");
|
||||
Pix* pix = tesseract_->pix_binary();
|
||||
int width = pixGetWidth(pix);
|
||||
int height = pixGetHeight(pix);
|
||||
@ -644,7 +644,7 @@ bool TessBaseAPI::ProcessPages(const char* filename,
|
||||
if (npages > 0) {
|
||||
for (; page < npages && (pix = pixReadTiff(filename, page)) != NULL;
|
||||
++page) {
|
||||
if (page > 0)
|
||||
if (page >= 0)
|
||||
tprintf(_("Page %d\n"), page);
|
||||
char page_str[kMaxIntSize];
|
||||
snprintf(page_str, kMaxIntSize - 1, "%d", page);
|
||||
@ -665,7 +665,7 @@ bool TessBaseAPI::ProcessPages(const char* filename,
|
||||
pixDestroy(&pix);
|
||||
} else {
|
||||
// The file is not an image file, so try it as a list of filenames.
|
||||
FILE* fimg = fopen(filename, "r");
|
||||
FILE* fimg = fopen(filename, "rb");
|
||||
if (fimg == NULL) {
|
||||
tprintf(_("File %s cannot be opened!\n"), filename);
|
||||
return false;
|
||||
@ -742,7 +742,7 @@ bool TessBaseAPI::ProcessPage(Pix* pix, int page_index, const char* filename,
|
||||
}
|
||||
if (failed && retry_config != NULL && retry_config[0] != '\0') {
|
||||
// Save current config variables before switching modes.
|
||||
FILE* fp = fopen(kOldVarsFile, "w");
|
||||
FILE* fp = fopen(kOldVarsFile, "wb");
|
||||
PrintVariables(fp);
|
||||
fclose(fp);
|
||||
// Switch to alternate mode for retry.
|
||||
|
@ -110,7 +110,7 @@ int main(int argc, char **argv) {
|
||||
tesseract::TessBaseAPI::Version());
|
||||
|
||||
|
||||
FILE* fin = fopen(image, "r");
|
||||
FILE* fin = fopen(image, "rb");
|
||||
if (fin == NULL) {
|
||||
printf("Cannot open input file: %s\n", image);
|
||||
exit(2);
|
||||
@ -134,7 +134,7 @@ int main(int argc, char **argv) {
|
||||
api.GetBoolVariable("tessedit_create_boxfile", &output_box);
|
||||
STRING outfile = output;
|
||||
outfile += output_hocr ? ".html" : output_box ? ".box" : ".txt";
|
||||
FILE* fout = fopen(outfile.string(), "w");
|
||||
FILE* fout = fopen(outfile.string(), "wb");
|
||||
if (fout == NULL) {
|
||||
tprintf(_("Cannot create output file %s\n"), outfile.string());
|
||||
exit(1);
|
||||
|
@ -325,7 +325,7 @@ void ParamsEditor::WriteParams(char *filename,
|
||||
FILE *fp; // input file
|
||||
char msg_str[255];
|
||||
// if file exists
|
||||
if ((fp = fopen (filename, "r")) != NULL) {
|
||||
if ((fp = fopen (filename, "rb")) != NULL) {
|
||||
fclose(fp);
|
||||
sprintf (msg_str, "Overwrite file " "%s" "? (Y/N)", filename);
|
||||
int a = sv_window_->ShowYesNoDialog(msg_str);
|
||||
@ -333,7 +333,7 @@ void ParamsEditor::WriteParams(char *filename,
|
||||
}
|
||||
|
||||
|
||||
fp = fopen (filename, "w"); // can we write to it?
|
||||
fp = fopen (filename, "wb"); // can we write to it?
|
||||
if (fp == NULL) {
|
||||
sv_window_->AddMessage("Cant write to file " "%s" "", filename);
|
||||
return;
|
||||
|
@ -69,13 +69,13 @@ void Tesseract::read_config_file(const char *filename, bool init_only) {
|
||||
path += "configs/";
|
||||
path += filename;
|
||||
FILE* fp;
|
||||
if ((fp = fopen(path.string(), "r")) != NULL) {
|
||||
if ((fp = fopen(path.string(), "rb")) != NULL) {
|
||||
fclose(fp);
|
||||
} else {
|
||||
path = datadir;
|
||||
path += "tessconfigs/";
|
||||
path += filename;
|
||||
if ((fp = fopen(path.string(), "r")) != NULL) {
|
||||
if ((fp = fopen(path.string(), "rb")) != NULL) {
|
||||
fclose(fp);
|
||||
} else {
|
||||
path = filename;
|
||||
@ -148,7 +148,7 @@ bool Tesseract::init_tesseract_lang_data(
|
||||
}
|
||||
|
||||
if (((STRING &)tessedit_write_params_to_file).length() > 0) {
|
||||
FILE *params_file = fopen(tessedit_write_params_to_file.string(), "w");
|
||||
FILE *params_file = fopen(tessedit_write_params_to_file.string(), "wb");
|
||||
if (params_file != NULL) {
|
||||
ParamUtils::PrintParams(params_file, this->params());
|
||||
fclose(params_file);
|
||||
|
@ -57,7 +57,7 @@ bool TesseractCubeCombiner::LoadCombinerNet() {
|
||||
".tesseract_cube.nn";
|
||||
|
||||
// Return false if file does not exist
|
||||
FILE *fp = fopen(net_file_name.c_str(), "r");
|
||||
FILE *fp = fopen(net_file_name.c_str(), "rb");
|
||||
if (fp == NULL)
|
||||
return false;
|
||||
else
|
||||
|
@ -49,7 +49,7 @@ bool read_unlv_file( //print list of sides
|
||||
BLOCK_IT block_it = blocks; //block iterator
|
||||
|
||||
name += UNLV_EXT; //add extension
|
||||
if ((pdfp = fopen (name.string (), "r")) == NULL) {
|
||||
if ((pdfp = fopen (name.string (), "rb")) == NULL) {
|
||||
return false; //didn't read one
|
||||
}
|
||||
else {
|
||||
|
@ -35,7 +35,7 @@ FILE* OpenBoxFile(const STRING& fname) {
|
||||
|
||||
filename += ".box";
|
||||
FILE* box_file = NULL;
|
||||
if (!(box_file = fopen(filename.string(), "r"))) {
|
||||
if (!(box_file = fopen(filename.string(), "rb"))) {
|
||||
CANTOPENFILE.error("read_next_box", TESSEXIT,
|
||||
"Cant open box file %s",
|
||||
filename.string());
|
||||
|
@ -58,7 +58,7 @@ bool ParamUtils::ReadParamsFile(const char *file, bool init_only,
|
||||
nameoffset = 0;
|
||||
}
|
||||
|
||||
fp = fopen(file + nameoffset, "r");
|
||||
fp = fopen(file + nameoffset, "rb");
|
||||
if (fp == NULL) {
|
||||
tprintf("read_params_file: Can't open %s\n", file + nameoffset);
|
||||
return true;
|
||||
|
@ -128,7 +128,8 @@ bool TessdataManager::CombineDataFiles(
|
||||
kTessdataFileSuffixes[i], &type, &text_file));
|
||||
STRING filename = language_data_path_prefix;
|
||||
filename += kTessdataFileSuffixes[i];
|
||||
file_ptr[i] = fopen(filename.string(), text_file ? "r" : "rb");
|
||||
// file_ptr[i] = fopen(filename.string(), text_file ? "r" : "rb");
|
||||
file_ptr[i] = fopen(filename.string(), "rb");
|
||||
if (file_ptr[i] != NULL) {
|
||||
offset_table[type] = ftell(output_file);
|
||||
CopyFile(file_ptr[i], output_file, text_file, -1);
|
||||
@ -181,7 +182,8 @@ bool TessdataManager::OverwriteComponents(
|
||||
// Open the files with the new components.
|
||||
for (i = 0; i < num_new_components; ++i) {
|
||||
TessdataTypeFromFileName(component_filenames[i], &type, &text_file);
|
||||
file_ptr[type] = fopen(component_filenames[i], text_file ? "r" : "rb");
|
||||
// file_ptr[type] = fopen(component_filenames[i], text_file ? "r" : "rb");
|
||||
file_ptr[type] = fopen(component_filenames[i], "rb");
|
||||
}
|
||||
|
||||
// Write updated data to the output traineddata file.
|
||||
|
@ -64,7 +64,7 @@ const char *format, ... //special message
|
||||
va_end(args);
|
||||
|
||||
if (debugfp == NULL && strlen (debug_file.string ()) > 0)
|
||||
debugfp = fopen (debug_file.string (), "w");
|
||||
debugfp = fopen (debug_file.string (), "wb");
|
||||
else if (debugfp != NULL && strlen (debug_file.string ()) == 0) {
|
||||
fclose(debugfp);
|
||||
debugfp = NULL;
|
||||
|
@ -226,7 +226,7 @@ class UNICHARSET {
|
||||
// Opens the file indicated by filename and saves unicharset to that file.
|
||||
// Returns true if the operation is successful.
|
||||
bool save_to_file(const char * const filename) const {
|
||||
FILE* file = fopen(filename, "w+");
|
||||
FILE* file = fopen(filename, "w+b");
|
||||
if (file == NULL) return false;
|
||||
bool result = save_to_file(file);
|
||||
fclose(file);
|
||||
@ -241,7 +241,7 @@ class UNICHARSET {
|
||||
// from the given file. The previous data is lost.
|
||||
// Returns true if the operation is successful.
|
||||
bool load_from_file(const char* const filename, bool skip_fragments) {
|
||||
FILE* file = fopen(filename, "r");
|
||||
FILE* file = fopen(filename, "rb");
|
||||
if (file == NULL) return false;
|
||||
bool result = load_from_file(file, skip_fragments);
|
||||
fclose(file);
|
||||
|
@ -91,7 +91,7 @@ void LearnBlob(const FEATURE_DEFS_STRUCT &FeatureDefs, const STRING& filename,
|
||||
// the name of the file is the name of the image plus TRAIN_SUFFIX
|
||||
if (FeatureFile == NULL) {
|
||||
Filename += TRAIN_SUFFIX;
|
||||
FeatureFile = Efopen(Filename.string(), "w");
|
||||
FeatureFile = Efopen(Filename.string(), "wb");
|
||||
cprintf("TRAINING ... Font name = %s\n", CurrFontName.string());
|
||||
}
|
||||
|
||||
|
@ -78,16 +78,16 @@ FEATURE_SET Classify::ExtractPicoFeatures(TBLOB *Blob) {
|
||||
iterate(RemainingOutlines) {
|
||||
Outline = (MFOUTLINE) first_node (RemainingOutlines);
|
||||
/*---------Debug--------------------------------------------------*
|
||||
OFile = fopen ("f:/ims/debug/pfOutline.logCPP", "r");
|
||||
OFile = fopen ("f:/ims/debug/pfOutline.logCPP", "rb");
|
||||
if (OFile == NULL)
|
||||
{
|
||||
OFile = Efopen ("f:/ims/debug/pfOutline.logCPP", "w");
|
||||
OFile = Efopen ("f:/ims/debug/pfOutline.logCPP", "wb");
|
||||
WriteOutline(OFile, Outline);
|
||||
}
|
||||
else
|
||||
{
|
||||
fclose (OFile);
|
||||
OFile = Efopen ("f:/ims/debug/pfOutline.logCPP", "a");
|
||||
OFile = Efopen ("f:/ims/debug/pfOutline.logCPP", "ab");
|
||||
}
|
||||
WriteOutline(OFile, Outline);
|
||||
fclose (OFile);
|
||||
@ -97,16 +97,16 @@ FEATURE_SET Classify::ExtractPicoFeatures(TBLOB *Blob) {
|
||||
if (classify_norm_method == baseline)
|
||||
NormalizePicoX(FeatureSet);
|
||||
/*---------Debug--------------------------------------------------*
|
||||
File = fopen ("f:/ims/debug/pfFeatSet.logCPP", "r");
|
||||
File = fopen ("f:/ims/debug/pfFeatSet.logCPP", "rb");
|
||||
if (File == NULL)
|
||||
{
|
||||
File = Efopen ("f:/ims/debug/pfFeatSet.logCPP", "w");
|
||||
File = Efopen ("f:/ims/debug/pfFeatSet.logCPP", "wb");
|
||||
WriteFeatureSet(File, FeatureSet);
|
||||
}
|
||||
else
|
||||
{
|
||||
fclose (File);
|
||||
File = Efopen ("f:/ims/debug/pfFeatSet.logCPP", "a");
|
||||
File = Efopen ("f:/ims/debug/pfFeatSet.logCPP", "ab");
|
||||
}
|
||||
WriteFeatureSet(File, FeatureSet);
|
||||
fclose (File);
|
||||
|
@ -52,7 +52,7 @@ bool CachedFile::Open() {
|
||||
return true;
|
||||
}
|
||||
|
||||
fp_ = fopen(file_name_.c_str(), "r");
|
||||
fp_ = fopen(file_name_.c_str(), "rb");
|
||||
if (fp_ == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ CharSampSet * CharSampSet::FromCharDumpFile(string file_name) {
|
||||
FILE *fp;
|
||||
unsigned int val32;
|
||||
// open the file
|
||||
fp = fopen(file_name.c_str(), "r");
|
||||
fp = fopen(file_name.c_str(), "rb");
|
||||
if (fp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -123,7 +123,7 @@ FILE *CharSampSet::CreateCharDumpFile(string file_name) {
|
||||
FILE *fp;
|
||||
unsigned int val32;
|
||||
// create the file
|
||||
fp = fopen(file_name.c_str(), "w");
|
||||
fp = fopen(file_name.c_str(), "wb");
|
||||
if (!fp) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ bool ConvNetCharClassifier::LoadFoldingSets(const string &data_file_path,
|
||||
fold_file_name += ".cube.fold";
|
||||
|
||||
// folding sets are optional
|
||||
FILE *fp = fopen(fold_file_name.c_str(), "r");
|
||||
FILE *fp = fopen(fold_file_name.c_str(), "rb");
|
||||
if (fp == NULL) {
|
||||
return true;
|
||||
}
|
||||
@ -320,7 +320,7 @@ bool ConvNetCharClassifier::LoadNets(const string &data_file_path,
|
||||
char_net_file += ".cube.nn";
|
||||
|
||||
// neural network is optional
|
||||
FILE *fp = fopen(char_net_file.c_str(), "r");
|
||||
FILE *fp = fopen(char_net_file.c_str(), "rb");
|
||||
if (fp == NULL) {
|
||||
return true;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ bool CubeTuningParams::Load(string tuning_params_file) {
|
||||
|
||||
// Save the parameters to a file
|
||||
bool CubeTuningParams::Save(string file_name) {
|
||||
FILE *params_file = fopen(file_name.c_str(), "w");
|
||||
FILE *params_file = fopen(file_name.c_str(), "wb");
|
||||
if (params_file == NULL) {
|
||||
fprintf(stderr, "Cube ERROR (CubeTuningParams::Save): error opening file "
|
||||
"%s for write.\n", file_name.c_str());
|
||||
|
@ -267,7 +267,7 @@ unsigned char *CubeUtils::GetImageData(Pix *pix, int left, int top,
|
||||
// read file contents to a string
|
||||
bool CubeUtils::ReadFileToString(const string &file_name, string *str) {
|
||||
str->clear();
|
||||
FILE *fp = fopen(file_name.c_str(), "r");
|
||||
FILE *fp = fopen(file_name.c_str(), "rb");
|
||||
if (fp == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ bool HybridNeuralNetCharClassifier::LoadFoldingSets(
|
||||
fold_file_name += ".cube.fold";
|
||||
|
||||
// folding sets are optional
|
||||
FILE *fp = fopen(fold_file_name.c_str(), "r");
|
||||
FILE *fp = fopen(fold_file_name.c_str(), "rb");
|
||||
if (fp == NULL) {
|
||||
return true;
|
||||
}
|
||||
@ -316,7 +316,7 @@ bool HybridNeuralNetCharClassifier::LoadNets(const string &data_file_path,
|
||||
hybrid_net_file += ".cube.hybrid";
|
||||
|
||||
// neural network is optional
|
||||
FILE *fp = fopen(hybrid_net_file.c_str(), "r");
|
||||
FILE *fp = fopen(hybrid_net_file.c_str(), "rb");
|
||||
if (fp == NULL) {
|
||||
return true;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
SUBDIRS =
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/ccutil
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/ccutil -I$(top_srcdir)/viewer
|
||||
|
||||
include_HEADERS = \
|
||||
bitvec.h callcpp.h const.h cutil.h cutil_class.h danerror.h efio.h \
|
||||
|
@ -92,7 +92,7 @@ FILE *open_file(const char *filename, const char *mode) {
|
||||
bool exists_file(const char *filename) {
|
||||
bool exists = false;
|
||||
FILE *f = NULL;
|
||||
if ((f = fopen(filename, "r")) != NULL) {
|
||||
if ((f = fopen(filename, "rb")) != NULL) {
|
||||
fclose(f);
|
||||
exists = true;
|
||||
}
|
||||
|
@ -1,65 +1,6 @@
|
||||
datadir = @datadir@/tessdata
|
||||
data_DATA = ara.cube.bigrams \
|
||||
ara.cube.fold \
|
||||
ara.cube.lm \
|
||||
ara.cube.nn \
|
||||
ara.cube.params \
|
||||
ara.cube.size \
|
||||
ara.cube.word-freq \
|
||||
ara.traineddata \
|
||||
eng.cube.bigrams \
|
||||
eng.cube.lm \
|
||||
eng.cube.params \
|
||||
eng.cube.word-freq \
|
||||
eng.traineddata \
|
||||
eng.cube.fold \
|
||||
eng.cube.nn \
|
||||
eng.cube.size \
|
||||
eng.tesseract_cube.nn \
|
||||
bul.traineddata \
|
||||
cat.traineddata \
|
||||
ces.traineddata \
|
||||
chi_sim.traineddata \
|
||||
chi_tra.traineddata \
|
||||
dan.traineddata \
|
||||
dan-frak.traineddata \
|
||||
deu.traineddata \
|
||||
ell.traineddata \
|
||||
fin.traineddata \
|
||||
fra.traineddata \
|
||||
heb.traineddata \
|
||||
hin.cube.bigrams \
|
||||
hin.cube.lm \
|
||||
hin.cube.params \
|
||||
hin.cube.word-freq \
|
||||
hin.tesseract_cube.nn \
|
||||
hin.traineddata \
|
||||
hrv.traineddata \
|
||||
hun.traineddata \
|
||||
ind.traineddata \
|
||||
ita.traineddata \
|
||||
jpn.traineddata \
|
||||
kor.traineddata \
|
||||
lav.traineddata \
|
||||
lit.traineddata \
|
||||
nld.traineddata \
|
||||
nor.traineddata \
|
||||
osd.traineddata \
|
||||
pol.traineddata \
|
||||
por.traineddata \
|
||||
ron.traineddata \
|
||||
rus.traineddata \
|
||||
slk.traineddata \
|
||||
slk-frak.traineddata \
|
||||
slv.traineddata \
|
||||
spa.traineddata \
|
||||
srp.traineddata \
|
||||
swe.traineddata \
|
||||
tgl.traineddata \
|
||||
tha.traineddata \
|
||||
tur.traineddata \
|
||||
ukr.traineddata \
|
||||
vie.traineddata
|
||||
data_DATA = *.traineddata \
|
||||
*.cube.*
|
||||
|
||||
SUBDIRS = configs tessconfigs
|
||||
|
||||
|
@ -2028,7 +2028,7 @@ void TableFinder::WriteToPix(const FCOORD& reskew) {
|
||||
|
||||
BOXA* table_array = boxaCreate(num_boxes);
|
||||
// text file containing detected table bounding boxes
|
||||
FILE* fptr = fopen("tess-table.txt", "w");
|
||||
FILE* fptr = fopen("tess-table.txt", "wb");
|
||||
GridSearch<ColSegment, ColSegment_CLIST, ColSegment_C_IT>
|
||||
table_search(&table_grid_);
|
||||
table_search.StartFullSearch();
|
||||
|
@ -155,7 +155,7 @@ int main (
|
||||
int num_fonts = 0;
|
||||
while ((PageName = GetNextFilename(argc, argv)) != NULL) {
|
||||
printf("Reading %s ...\n", PageName);
|
||||
TrainingPage = Efopen(PageName, "r");
|
||||
TrainingPage = Efopen(PageName, "rb");
|
||||
ReadTrainingSamples(FeatureDefs, PROGRAM_FEATURE_TYPE,
|
||||
100, 1.0f / 64.0f, 0.0f, NULL, TrainingPage, &CharList);
|
||||
fclose(TrainingPage);
|
||||
@ -238,7 +238,7 @@ void WriteNormProtos (
|
||||
}
|
||||
strcat (Filename, "normproto");
|
||||
printf ("\nWriting %s ...", Filename);
|
||||
File = Efopen (Filename, "w");
|
||||
File = Efopen (Filename, "wb");
|
||||
fprintf(File,"%0d\n",Clusterer->SampleSize);
|
||||
WriteParamDesc(File,Clusterer->SampleSize,Clusterer->ParamDesc);
|
||||
iterate(LabeledProtoList)
|
||||
|
@ -370,10 +370,10 @@ void WriteTrainingSamples (
|
||||
|
||||
/* if file does not exist, create a new one with an appropriate
|
||||
header; otherwise append samples to the existing file */
|
||||
File = fopen (Filename, "r");
|
||||
File = fopen (Filename, "rb");
|
||||
if (File == NULL)
|
||||
{
|
||||
File = Efopen (Filename, "w");
|
||||
File = Efopen (Filename, "wb");
|
||||
WriteOldParamDesc(
|
||||
File,
|
||||
FeatureDefs.FeatureDesc[ShortNameToFeatureType(
|
||||
@ -382,7 +382,7 @@ void WriteTrainingSamples (
|
||||
else
|
||||
{
|
||||
fclose (File);
|
||||
File = Efopen (Filename, "a");
|
||||
File = Efopen (Filename, "ab");
|
||||
}
|
||||
|
||||
// append samples onto the file
|
||||
|
@ -225,7 +225,7 @@ int main (int argc, char **argv) {
|
||||
|
||||
// Populate fontinfo_table with font properties.
|
||||
if (InputFontInfoFile != NULL) {
|
||||
FILE* f = fopen(InputFontInfoFile, "r");
|
||||
FILE* f = fopen(InputFontInfoFile, "rb");
|
||||
if (f == NULL) {
|
||||
fprintf(stderr, "Failed to load font_properties\n");
|
||||
} else {
|
||||
@ -292,7 +292,7 @@ int main (int argc, char **argv) {
|
||||
delete[] short_name;
|
||||
}
|
||||
|
||||
TrainingPage = Efopen (PageName, "r");
|
||||
TrainingPage = Efopen (PageName, "rb");
|
||||
LIST char_list = NIL_LIST;
|
||||
ReadTrainingSamples(FeatureDefs, PROGRAM_FEATURE_TYPE,
|
||||
0, 1.0f / 128.0f, 1.0f / 64.0f, &unicharset_training,
|
||||
@ -371,11 +371,7 @@ int main (int argc, char **argv) {
|
||||
strcat (Filename, "/");
|
||||
}
|
||||
strcat (Filename, "inttemp");
|
||||
#ifdef __UNIX__
|
||||
OutFile = Efopen (Filename, "w");
|
||||
#else
|
||||
OutFile = Efopen (Filename, "wb");
|
||||
#endif
|
||||
classify->WriteIntTemplates(OutFile, IntTemplates, unicharset_training);
|
||||
fclose (OutFile);
|
||||
strcpy (Filename, "");
|
||||
@ -425,7 +421,7 @@ void WriteMicrofeat(
|
||||
strcat (Filename, "/");
|
||||
}
|
||||
strcat (Filename, "Microfeat");
|
||||
File = Efopen (Filename, "w");
|
||||
File = Efopen (Filename, "wb");
|
||||
printf ("\nWriting Merged %s ...", Filename);
|
||||
iterate(ClassList)
|
||||
{
|
||||
@ -516,7 +512,7 @@ void InitXHeights(const char *filename,
|
||||
int xheights[]) {
|
||||
for (int i = 0; i < fontinfo_table.size(); ++i) xheights[i] = -1;
|
||||
if (filename == NULL) return;
|
||||
FILE *f = fopen(filename, "r");
|
||||
FILE *f = fopen(filename, "rb");
|
||||
if (f == NULL) {
|
||||
fprintf(stderr, "Failed to load font xheights from %s\n", filename);
|
||||
return;
|
||||
@ -542,7 +538,7 @@ void AddSpacingInfo(const char *filename,
|
||||
const UNICHARSET &unicharset,
|
||||
const int xheights[],
|
||||
UnicityTable<FontInfo> *fontinfo_table) {
|
||||
FILE* fontinfo_file = fopen(filename, "r");
|
||||
FILE* fontinfo_file = fopen(filename, "rb");
|
||||
if (fontinfo_file == NULL) return;
|
||||
tprintf("Reading spacing from %s ...\n", filename);
|
||||
int scale = kBlnXHeight / xheights[fontinfo_id];
|
||||
|
@ -134,7 +134,7 @@ int main(int argc, char** argv) {
|
||||
for (; tessoptind < argc; ++tessoptind) {
|
||||
printf("Extracting unicharset from %s\n", argv[tessoptind]);
|
||||
|
||||
FILE* box_file = fopen(argv[tessoptind], "r");
|
||||
FILE* box_file = fopen(argv[tessoptind], "rb");
|
||||
if (box_file == NULL) {
|
||||
printf("Cannot open box file %s\n", argv[tessoptind]);
|
||||
return -1;
|
||||
|
@ -91,7 +91,7 @@ int main(int argc, char** argv) {
|
||||
} else if (argc == 7) {
|
||||
// Place words of different lengths in separate Dawgs.
|
||||
char str[CHARS_PER_LINE];
|
||||
FILE *word_file = fopen(wordlist_filename, "r");
|
||||
FILE *word_file = fopen(wordlist_filename, "rb");
|
||||
if (word_file == NULL) {
|
||||
tprintf("Failed to open wordlist file %s\n", wordlist_filename);
|
||||
exit(1);
|
||||
|
@ -95,5 +95,5 @@ void create_fxdebug_win() { //make gradients win
|
||||
// DEBUG_XPOS,DEBUG_YPOS,
|
||||
// DEBUG_XSIZE,DEBUG_YSIZE);
|
||||
// else
|
||||
// fx_debug=fopen(fx_debugfile.string(),"w");
|
||||
// fx_debug=fopen(fx_debugfile.string(),"wb");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user