Skip to content

Commit

Permalink
Merge pull request #835 from stweil/3.05
Browse files Browse the repository at this point in the history
3.05: Backports from master branch
  • Loading branch information
zdenop authored Apr 23, 2017
2 parents ed31db6 + b66ff1f commit 555305f
Show file tree
Hide file tree
Showing 14 changed files with 585 additions and 642 deletions.
26 changes: 13 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ language: cpp

notifications:
email: false

sudo: required

os:
- linux
#- osx
- osx

branches:
only:
- master
#branches:
#only:
#- master

addons:
apt:
Expand All @@ -24,17 +24,17 @@ addons:
before_install:
- if [[ $TRAVIS_OS_NAME == linux ]]; then LINUX=true; fi
- if [[ $TRAVIS_OS_NAME == osx ]]; then OSX=true; fi

- if [[ $OSX ]]; then brew update; fi

- export LEPT_VER=1.73
#- if [[ $OSX ]]; then brew update; fi

- export LEPT_VER=1.74.1

install:
- if [[ $OSX ]]; then brew install icu4c pango; brew link --force gettext; fi
- if [[ $OSX ]]; then export ICU_ROOT=/usr/local/opt/icu4c ; fi
- wget https://www.cmake.org/files/v3.6/cmake-3.6.1-Linux-x86_64.sh
- sudo sh cmake-3.6.1-Linux-x86_64.sh --skip-license --prefix=/usr
- wget -O leptonica.zip https://github.com/DanBloomberg/leptonica/archive/v$LEPT_VER.zip
#- if [[ $OSX ]]; then brew install icu4c pango; brew link --force gettext; fi
#- if [[ $OSX ]]; then export ICU_ROOT=/usr/local/opt/icu4c ; fi
- if [[ $LINUX ]]; then wget https://www.cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.sh; fi
- if [[ $LINUX ]]; then sudo sh cmake-3.7.2-Linux-x86_64.sh --skip-license --prefix=/usr; fi
- wget -O leptonica.zip https://github.com/DanBloomberg/leptonica/archive/$LEPT_VER.zip
- unzip leptonica.zip -d .
- cmake -Hleptonica-$LEPT_VER -Bleptonica-$LEPT_VER/build
- make -C leptonica-$LEPT_VER/build
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ set(VERSION_MAJOR 3)
set(VERSION_MINOR 05)
set(VERSION_PLAIN ${VERSION_MAJOR}.${VERSION_MINOR})

set(MINIMUM_LEPTONICA_VERSION 1.71)
set(MINIMUM_LEPTONICA_VERSION 1.74)

if(NOT EXISTS ${PROJECT_SOURCE_DIR}/.cppan)
if (NOT Leptonica_DIR AND NOT MSVC)
Expand Down
4 changes: 2 additions & 2 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ in this distribution is now licensed under the Apache License:
Other Dependencies and Licenses:
================================

Tesseract uses Leptonica library (http://leptonica.com/) with a very weakly
restricted copyright license (http://leptonica.com/about-the-license.html)
Tesseract uses Leptonica library (http://leptonica.com/) which essentially
uses a BSD 2-clause license. (http://leptonica.com/about-the-license.html)
9 changes: 5 additions & 4 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Added new C API for orientation and script detection, removed the old one.
* Increased minimum autoconf version to 2.59.
* Removed dead code.
* Require Leptonica 1.74 or higher.
* Fixed many compiler warning.
* Fixed memory and resource leaks.
* Fixed some issues with the 'Cube' OCR engine.
Expand Down Expand Up @@ -63,7 +64,7 @@
text and truetype fonts.
* Added support for PDF output with searchable text.
* Removed entire IMAGE class and all code in image directory.
* Tesseract executable: support for output to stdout; limited support for one
* Tesseract executable: support for output to stdout; limited support for one
page images from stdin (especially on Windows)
* Added Renderer to API to allow document-level processing and output
of document formats, like hOCR, PDF.
Expand Down Expand Up @@ -148,12 +149,12 @@
* Added TessdataManager to combine data files into a single file.
* Some dead code deleted.
* VC++6 no longer supported. It can't cope with the use of templates.
* Many more languages added.
* Many more languages added.
* Doxygenation of most of the function header comments.
* Added man pages.
* Added bash completion script (issue 247: thanks to neskiem)
* Fix integer overview in thresholding (issue 366: thanks to Cyanide.Drake)
* Add Danish Fraktur support (issues 300, 360: thanks to
* Add Danish Fraktur support (issues 300, 360: thanks to
dsl602230@vip.cybercity.dk)
* Fix file pointer leak (issue 359, thanks to yukihiro.nakadaira)
* Fix an error using user-words (Issue 345: thanks to max.markin)
Expand All @@ -162,7 +163,7 @@
* Fix an automake error (Issue 318, thanks to ichanjz)
* Fix a Win32 crash on fileFormatIsTiff() (Issues 304, 316, 317, 330, 347,
349, 352: thanks to nguyenq87, max.markin, zdenop)
* Fixed a number of errors in newer (stricter) versions of VC++ (Issues
* Fixed a number of errors in newer (stricter) versions of VC++ (Issues
301, among others)

2009-06-30 - V2.04
Expand Down
2 changes: 1 addition & 1 deletion api/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ endif
libtesseract_api_la_SOURCES = baseapi.cpp capi.cpp renderer.cpp pdfrenderer.cpp

lib_LTLIBRARIES += libtesseract.la
libtesseract_la_LDFLAGS = $(OPENCL_LDFLAGS)
libtesseract_la_LDFLAGS = $(LEPTONICA_LIBS) $(OPENCL_LDFLAGS)
libtesseract_la_SOURCES =
# Dummy C++ source to cause C++ linking.
# see http://www.gnu.org/s/hello/manual/automake/Libtool-Convenience-Libraries.html#Libtool-Convenience-Libraries
Expand Down
5 changes: 0 additions & 5 deletions api/pdfrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,6 @@ bool TessPDFRenderer::imageToPDFObj(Pix *pix,
L_COMP_DATA *cid = NULL;
const int kJpegQuality = 85;

// TODO(jbreiden) Leptonica 1.71 doesn't correctly handle certain
// types of PNG files, especially if there are 2 samples per pixel.
// We can get rid of this logic after Leptonica 1.72 is released and
// has propagated everywhere. Bug discussion as follows.
// https://code.google.com/p/tesseract-ocr/issues/detail?id=1300
int format, sad;
findFileFormat(filename, &format);
if (pixGetSpp(pix) == 4 && format == IFF_PNG) {
Expand Down
5 changes: 0 additions & 5 deletions ccmain/equationdetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,6 @@ void EquationDetect::IdentifySeedParts() {
}

float EquationDetect::ComputeForegroundDensity(const TBOX& tbox) {
#if LIBLEPT_MINOR_VERSION < 69 && LIBLEPT_MAJOR_VERSION <= 1
// This will disable the detector because no seed will be identified.
return 1.0f;
#else
Pix *pix_bi = lang_tesseract_->pix_binary();
int pix_height = pixGetHeight(pix_bi);
Box* box = boxCreate(tbox.left(), pix_height - tbox.top(),
Expand All @@ -640,7 +636,6 @@ float EquationDetect::ComputeForegroundDensity(const TBOX& tbox) {
boxDestroy(&box);

return fract;
#endif
}

bool EquationDetect::CheckSeedFgDensity(const float density_th,
Expand Down
50 changes: 12 additions & 38 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -411,53 +411,27 @@ AC_CHECK_TYPES([mbstate_t],,, [#include "wchar.h"])
# Test auxiliary packages
# ----------------------------------------

# Check location of leptonica/liblept headers.
AC_MSG_CHECKING([for leptonica])
AC_ARG_VAR([LIBLEPT_HEADERSDIR], [Leptonica headers directory])

have_lept=no
if test "$LIBLEPT_HEADERSDIR" = "" ; then
LIBLEPT_HEADERSDIR="/usr/local/include /usr/include /opt/local/include/leptonica"
fi
for incd in $LIBLEPT_HEADERSDIR
do
for lept in . leptonica liblept
do
if test -r "$incd/$lept/allheaders.h" ; then
CPPFLAGS="$CPPFLAGS -I$incd/$lept"
have_lept=yes
fi
done
done

if test "$have_lept" = yes ; then
AC_MSG_RESULT(yes)
AC_CHECK_LIB([lept], [l_generateCIDataForPdf], [],
[AC_MSG_ERROR([leptonica library with pdf support (>= 1.71) is missing])])
PKG_CHECK_MODULES([LEPTONICA], [lept >= 1.74], [have_lept=true], [have_lept=false])
if $have_lept; then
CPPFLAGS="$CPPFLAGS $LEPTONICA_CFLAGS"
else
AC_MSG_ERROR([leptonica not found])
AC_MSG_ERROR([Leptonica 1.74 or higher is required. Try to install libleptonica-dev package.])
fi

AC_MSG_CHECKING([leptonica headers version >= 1.74])
AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM([#include "allheaders.h"],
[#if (LIBLEPT_MAJOR_VERSION >= 1) && (LIBLEPT_MINOR_VERSION >= 74)
int i = 0;
#else
#error You need to upgrade your leptonica library!
#endif])],
[AC_MSG_RESULT(yes)],
[AC_MSG_FAILURE([leptonica 1.74 or higher is required])])

AM_CONDITIONAL([ENABLE_TRAINING], true)

# Check location of icu headers
have_icu=false
AC_CHECK_HEADERS([unicode/uchar.h], [have_icu=true], [have_icu=false])
if !($have_icu); then
PKG_CHECK_MODULES([ICU_UC], [icu-uc], [have_icu_uc=true], [have_icu_uc=false])
PKG_CHECK_MODULES([ICU_I18N], [icu-i18n], [have_icu_i18n=true], [have_icu_i18n=false])
if !($have_icu_uc && $have_icu_i18n); then
AC_CHECK_HEADERS([unicode/uchar.h], [have_icu=true], [have_icu=false])
if !($have_icu); then
AC_MSG_WARN([Training tools WILL NOT be built because of missing icu library.])
AC_MSG_WARN([Try to install libicu-devel package.])
AM_CONDITIONAL([ENABLE_TRAINING], false)
else
ICU_UC_LIBS="-licui18n -licuuc"
fi
fi

# Check location of pango headers
Expand Down
8 changes: 5 additions & 3 deletions opencl/oclkernels.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _OCL_KERNEL_H_
#define _OCL_KERNEL_H_

#ifndef TESSERACT_OPENCL_OCLKERNELS_H_
#define TESSERACT_OPENCL_OCLKERNELS_H_

#ifndef USE_EXTERNAL_KERNEL
#define KERNEL( ... )# __VA_ARGS__ "\n"
// Double precision is a default of spreadsheets
Expand Down Expand Up @@ -1210,5 +1212,5 @@ KERNEL(
; // close char*

#endif // USE_EXTERNAL_KERNEL
#endif //_OCL_KERNEL_H_
#endif // TESSERACT_OPENCL_OCLKERNELS_H_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Loading

0 comments on commit 555305f

Please sign in to comment.