mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-23 18:49:08 +08:00
More minor fixes from issues and cleanup
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@974 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
parent
4c72deea6c
commit
91d2265429
@ -1004,7 +1004,6 @@ bool TessBaseAPI::ProcessPages(const char* filename,
|
||||
if (npages > 0) {
|
||||
pixDestroy(&pix);
|
||||
for (; page < npages; ++page) {
|
||||
|
||||
// only use opencl if compiled w/ OpenCL and selected device is opencl
|
||||
#ifdef USE_OPENCL
|
||||
if ( od.selectedDeviceIsOpenCL() ) {
|
||||
|
@ -22,6 +22,12 @@
|
||||
#include "config_auto.h"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#endif // _WIN32
|
||||
#include <iostream>
|
||||
|
||||
#include "allheaders.h"
|
||||
#include "baseapi.h"
|
||||
#include "basedir.h"
|
||||
@ -30,14 +36,6 @@
|
||||
#include "tprintf.h"
|
||||
#include "openclwrapper.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#endif // _WIN32
|
||||
|
||||
/**********************************************************************
|
||||
* main()
|
||||
*
|
||||
@ -128,8 +126,8 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
if (output == NULL && noocr == false) {
|
||||
fprintf(stderr, "Usage:\n %s imagename|stdin outputbase|stdout [options...] "
|
||||
"[configfile...]\n\n", argv[0]);
|
||||
fprintf(stderr, "Usage:\n %s imagename|stdin outputbase|stdout "
|
||||
"[options...] [configfile...]\n\n", argv[0]);
|
||||
|
||||
fprintf(stderr, "OCR options:\n");
|
||||
fprintf(stderr, " --tessdata-dir /path\tspecify location of tessdata"
|
||||
|
@ -139,7 +139,7 @@ int OtsuThreshold(Pix* src_pix, int left, int top, int width, int height,
|
||||
}
|
||||
#ifdef USE_OPENCL
|
||||
}
|
||||
#endif // USE_OPENCL
|
||||
#endif // USE_OPENCL
|
||||
delete[] histogramAllChannels;
|
||||
|
||||
if (!any_good_hivalue) {
|
||||
|
@ -33,10 +33,10 @@ using std::unordered_set;
|
||||
#endif
|
||||
#else // _MSC_VER
|
||||
#include <memory>
|
||||
#define std::unique_ptr SmartPtr
|
||||
#define SmartPtr std::unique_ptr
|
||||
#define HAVE_UNIQUE_PTR
|
||||
#endif // _MSC_VER
|
||||
#elif (defined(__GNUC__) && (((__GNUC__ == 3) && ( __GNUC_MINOR__ > 0)) || \
|
||||
#elif (defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ > 0)) || \
|
||||
__GNUC__ >= 4)) // gcc
|
||||
// hash_set is deprecated in gcc
|
||||
#include <ext/hash_map>
|
||||
@ -61,7 +61,7 @@ using __gnu_cxx::hash_set;
|
||||
template<class T> class SmartPtr {
|
||||
public:
|
||||
SmartPtr() : ptr_(NULL) {}
|
||||
SmartPtr(T* ptr) : ptr_(ptr) {}
|
||||
explicit SmartPtr(T* ptr) : ptr_(ptr) {}
|
||||
~SmartPtr() {
|
||||
delete ptr_;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ UNICHAR::UNICHAR(const char* utf8_str, int len) {
|
||||
int total_len = 0;
|
||||
int step = 0;
|
||||
if (len < 0) {
|
||||
for (len = 0; utf8_str[len] != 0 && len < UNICHAR_LEN; ++len);
|
||||
for (len = 0; len < UNICHAR_LEN && utf8_str[len] != 0; ++len);
|
||||
}
|
||||
for (total_len = 0; total_len < len; total_len += step) {
|
||||
step = utf8_step(utf8_str + total_len);
|
||||
|
@ -397,8 +397,9 @@ bool MasterTrainer::LoadXHeights(const char* filename) {
|
||||
int total_xheight = 0;
|
||||
int xheight_count = 0;
|
||||
while (!feof(f)) {
|
||||
if (fscanf(f, "%1024s %d\n", buffer, &xht) != 2)
|
||||
if (fscanf(f, "%1023s %d\n", buffer, &xht) != 2)
|
||||
continue;
|
||||
buffer[1023] = '\0';
|
||||
fontinfo.name = buffer;
|
||||
if (!fontinfo_table_.contains(fontinfo)) continue;
|
||||
int fontinfo_id = fontinfo_table_.get_index(fontinfo);
|
||||
|
@ -45,7 +45,7 @@ class CubeLineSegmenter {
|
||||
}
|
||||
int ColumnCnt() {
|
||||
if (init_ == false && Init() == false) {
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
return columns_->n;
|
||||
}
|
||||
@ -58,7 +58,7 @@ class CubeLineSegmenter {
|
||||
}
|
||||
int LineCnt() {
|
||||
if (init_ == false && Init() == false) {
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return line_cnt_;
|
||||
|
@ -32,7 +32,7 @@
|
||||
Public Code
|
||||
----------------------------------------------------------------------------**/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void *Emalloc(size_t Size) {
|
||||
void *Emalloc(int Size) {
|
||||
/*
|
||||
** Parameters:
|
||||
** Size
|
||||
@ -67,7 +67,7 @@ void *Emalloc(size_t Size) {
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void *Erealloc(void *ptr, size_t size) {
|
||||
void *Erealloc(void *ptr, int size) {
|
||||
void *Buffer;
|
||||
|
||||
if (size < 0 || (size == 0 && ptr == NULL))
|
||||
|
@ -30,9 +30,9 @@
|
||||
/**----------------------------------------------------------------------------
|
||||
Public Function Prototypes
|
||||
----------------------------------------------------------------------------**/
|
||||
void *Emalloc(size_t Size);
|
||||
void *Emalloc(int Size);
|
||||
|
||||
void *Erealloc(void *ptr, size_t size);
|
||||
void *Erealloc(void *ptr, int size);
|
||||
|
||||
void Efree(void *ptr);
|
||||
|
||||
|
@ -1 +1,2 @@
|
||||
tessedit_create_hocr 1
|
||||
tessedit_create_hocr 1
|
||||
tessedit_pageseg_mode 1
|
||||
|
@ -577,7 +577,6 @@ void LineFinder::GetLineMasks(int resolution, Pix* src_pix,
|
||||
Pix** pix_hline, Pix** pix_non_hline,
|
||||
Pix** pix_intersections, Pix** pix_music_mask,
|
||||
Pixa* pixa_display) {
|
||||
|
||||
Pix* pix_closed = NULL;
|
||||
Pix* pix_hollow = NULL;
|
||||
|
||||
@ -593,7 +592,7 @@ void LineFinder::GetLineMasks(int resolution, Pix* src_pix,
|
||||
// only use opencl if compiled w/ OpenCL and selected device is opencl
|
||||
#ifdef USE_OPENCL
|
||||
if (OpenclDevice::selectedDeviceIsOpenCL()) {
|
||||
//OpenCL pixGetLines Operation
|
||||
// OpenCL pixGetLines Operation
|
||||
int clStatus = OpenclDevice::initMorphCLAllocations(pixGetWpl(src_pix),
|
||||
pixGetHeight(src_pix),
|
||||
src_pix);
|
||||
@ -617,9 +616,9 @@ void LineFinder::GetLineMasks(int resolution, Pix* src_pix,
|
||||
if (pixa_display != NULL)
|
||||
pixaAddPix(pixa_display, pix_solid, L_CLONE);
|
||||
pix_hollow = pixSubtract(NULL, pix_closed, pix_solid);
|
||||
|
||||
|
||||
pixDestroy(&pix_solid);
|
||||
|
||||
|
||||
// Now open up in both directions independently to find lines of at least
|
||||
// 1 inch/kMinLineLengthFraction in length.
|
||||
if (pixa_display != NULL)
|
||||
@ -627,7 +626,7 @@ void LineFinder::GetLineMasks(int resolution, Pix* src_pix,
|
||||
*pix_vline = pixOpenBrick(NULL, pix_hollow, 1, min_line_length);
|
||||
*pix_hline = pixOpenBrick(NULL, pix_hollow, min_line_length, 1);
|
||||
|
||||
pixDestroy(&pix_hollow);
|
||||
pixDestroy(&pix_hollow);
|
||||
#ifdef USE_OPENCL
|
||||
}
|
||||
#endif
|
||||
|
@ -111,7 +111,7 @@ extern double_VAR_H (textord_xheight_error_margin, 0.1, "Accepted variation");
|
||||
extern INT_VAR_H (textord_lms_line_trials, 12, "Number of linew fits to do");
|
||||
extern BOOL_VAR_H (textord_new_initial_xheight, TRUE,
|
||||
"Use test xheight mechanism");
|
||||
extern BOOL_VAR_H (textord_debug_blob, FALSE, "Print test blob information");
|
||||
extern BOOL_VAR_H(textord_debug_blob, FALSE, "Print test blob information");
|
||||
|
||||
inline void get_min_max_xheight(int block_linesize,
|
||||
int *min_height, int *max_height) {
|
||||
|
@ -624,6 +624,7 @@ bool LanguageModel::AddViterbiStateEntry(
|
||||
tprintf("Language model components early pruned this entry\n");
|
||||
}
|
||||
delete ngram_info;
|
||||
delete dawg_info;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user