```
+
+**NOTE: This library currently requires the tessdata folder to
+be linked as a referenced folder instead of a symbolic group**. If Tesseract
+can't find a language file in your own project, it's probably because you
+created the tessdata folder as a symbolic group instead of a referenced folder.
+It should look like this if you did it correctly:
+
+![](https://cloud.githubusercontent.com/assets/817753/4598582/aeba675c-50ba-11e4-8d14-c7af9336b965.png)
+
+Note how the tessdata folder has a blue icon, indicating it was imported as a
+referenced folder instead of a symbolic group.
+
+Building From Source
+=================
+You can generate "TesseractOCR.framework" yourself by building the
+**TesseractOCRAggregate** target in "Tesseract OCR iOS.xcodeproj".
-
-Usage
+Example Usage
=======
### Objective-C
@@ -74,47 +92,52 @@ Usage
{
[super viewDidLoad];
- // language are used for recognition. Ex: eng. Tesseract will search for a eng.traineddata file in the dataPath directory; eng+ita will search for a eng.traineddata and ita.traineddata.
-
- //Like in the Template Framework Project:
- // Assumed that .traineddata files are in your "tessdata" folder and the folder is in the root of the project.
- // Assumed, that you added a folder references "tessdata" into your xCode project tree, with the ‘Create folder references for any added folders’ options set up in the «Add files to project» dialog.
- // Assumed that any .traineddata files is in the tessdata folder, like in the Template Framework Project
-
- //Create your tesseract using the initWithLanguage method:
- // Tesseract* tesseract = [[Tesseract alloc] initWithLanguage:@"eng+ita"];
-
- // set up the delegate to recieve tesseract's callback
- // self should respond to TesseractDelegate and implement shouldCancelImageRecognitionForTesseract: method
- // to have an ability to recieve callback and interrupt Tesseract before it finishes
-
- Tesseract* tesseract = [[Tesseract alloc] initWithLanguage:@"eng+ita"];
+ // Languages are used for recognition (e.g. eng, ita, etc.). Tesseract will
+ // search for the .traineddata language file in the tessdata directory. For
+ // example, specifying "eng+ita" will search for "eng.traineddata" and
+ // "ita.traineddata".
+
+ // Create your Tesseract object using the initWithLanguage method:
+ Tesseract* tesseract = [[Tesseract alloc] initWithLanguage:@"eng+ita"];
+
+ // Set up the delegate to receive Tesseract's callbacks.
+ // self should respond to TesseractDelegate and implement a
+ // "- (BOOL)shouldCancelImageRecognitionForTesseract:(Tesseract*)tesseract"
+ // method to receive a callback to decide whether or not to interrupt
+ // Tesseract before it finishes a recognition.
tesseract.delegate = self;
-
- [tesseract setVariableValue:@"0123456789" forKey:@"tessedit_char_whitelist"]; //limit search
- [tesseract setImage:[[UIImage imageNamed:@"image_sample.jpg"] blackAndWhite]]; //image to check
- [tesseract setRect:CGRectMake(20, 20, 100, 100)]; //optional: set the rectangle to recognize text in the image
+
+ // Optional: Limit the character set Tesseract should try to recognize from
+ [tesseract setVariableValue:@"0123456789" forKey:@"tessedit_char_whitelist"];
+
+ // See http://www.sk-spell.sk.cx/tesseract-ocr-en-variables for a complete
+ // (but not up-to-date) list of Tesseract variables.
+
+ // Specify the image Tesseract should recognize on
+ [tesseract setImage:[[UIImage imageNamed:@"image_sample.jpg"] blackAndWhite]];
+
+ // Optional: Limit the area of the image Tesseract should recognize on to a rectangle
+ [tesseract setRect:CGRectMake(20, 20, 100, 100)];
+
+ // Start the recognition
[tesseract recognize];
-
+
+ // Retrieve the recognized text
NSLog(@"%@", [tesseract recognizedText]);
-
- tesseract = nil; //deallocate and free all memory
}
- (BOOL)shouldCancelImageRecognitionForTesseract:(Tesseract*)tesseract
{
NSLog(@"progress: %d", tesseract.progress);
- return NO; // return YES, if you need to interrupt tesseract before it finishes
+ return NO; // return YES if you need to interrupt Tesseract before it finishes
}
```
-Set Tesseract variable key to value. See http://www.sk-spell.sk.cx/tesseract-ocr-en-variables for a complete (but not up-to-date) list.
-
-For instance, use tessedit_char_whitelist to restrict characters to a specific set.
-
-###Swift
-Make sure that you have used an Objective-c bridging header to include the library. Instructions on configuring a bridging header file can be found in the [Apple Developer Library](https://developer.apple.com/library/ios/documentation/swift/conceptual/buildingcocoaapps/MixandMatch.html#//apple_ref/doc/uid/TP40014216-CH10-XID_77).
+###Swift
+Make sure that you have used an Objective-C bridging header to include the
+library. Instructions on configuring a bridging header file can be found in the
+[Apple Developer Library](https://developer.apple.com/library/ios/documentation/swift/conceptual/buildingcocoaapps/MixandMatch.html#//apple_ref/doc/uid/TP40014216-CH10-XID_77).
**ViewController.swift**
@@ -122,7 +145,6 @@ Make sure that you have used an Objective-c bridging header to include the libra
import UIKit
class ViewController: UIViewController, TesseractDelegate {
-
override func viewDidLoad() {
super.viewDidLoad()
@@ -141,7 +163,7 @@ class ViewController: UIViewController, TesseractDelegate {
}
func shouldCancelImageRecognitionForTesseract(tesseract: Tesseract!) -> Bool {
- return false; // return true, if you need to interrupt tesseract before it finishes
+ return false; // return true if you need to interrupt tesseract before it finishes
}
}
```
@@ -149,83 +171,100 @@ class ViewController: UIViewController, TesseractDelegate {
Known Limitations
=================
-- Not OS X support. iOS simulators are supported only for 32bit version.
+- No OS X support.
+- Strict requirement on language files existing in a referenced "tessdata"
+ folder.
-Updates in this version
+Release Notes
=================
-### 3.1 Cocoapods
-
-### 3.03 (Thanks to [Kevin Conley](https://github.com/kevincon))
-- This update fixes the confidence value issue I reported in #56
-- fixed the memory leak
+### 3.1.1
+- Switched to [semantic versioning](http://semver.org/), as required by
+ CocoaPods
+- Fixed bug that affected support of x86_64 architectures (iOS 5S+ simulators)
+- Updated leptonica library from 1.70 to 1.71
+
+### 3.1 (Thanks to [Kevin Conley](https://github.com/kevincon))
+- Fixed confidence value issue reported in #56
+- Fixed the memory leak reported in #59
- Modified characterBoxes function to return characters in order
-- Removed unused lib files
- Added some null checks to fix a bug where no text is recognized
-- **Note**: Building the Tesseract OCR Aggregate product will yield a warning about how the Tesseract and Leptonica lib files don't work for the x86_64 architecture. However, everything still works in the simulator for iPhone 5 and lower, as well as on all physical devices. I guess because the libraries work okay with the i386 target.
- New implementation based off the [API examples for tesseract-ocr](https://code.google.com/p/tesseract-ocr/wiki/APIExample#Result_iterator_example)
### 2.3
-- Bug fixing.
-- CoreImage filters: use [img blackAndWhite];
to convert the UIImage to recognize into a RecognizeImageType
-- Rect: use [tesseract setRect:CGRectMake(20, 20, 100, 100)]
to define the rect where the text must be recognized
-
-### 2.23
-- There is no need to draw an image for tesseract.
-Instead it's possible just to get raw data from the input image.
-Such way is better, cause in the case of the grayscale input image, there is no need to draw it in RGB color space, increasing memory consumptions significantly.
-
-
-### 2.22
-- CocoaPods
-
-### 2.21
-- tesserackCallbackFunction: leak solved on iDevice.
-
-### The 2.2 is like 2.1...
-but shouldCancelImageRecognitionForTesseract works again! Thank you to Timo Formella!
-
-- Template project updated. Now with camera support.
-
-### New release 2.1
-
-- Fixed memory leaks. Moved all freeing memory job to dealloc. Thanks to frank4565.
-- Clear method is deprecated. Set tesseract = nil; to free all memory.
-- Free the utf8Text according to the comment in Tesseract that “The recognized text is returned as a char* which is coded as UTF8 and must be freed with the delete [] operator.”.
-- Template Framework Project updated.
-
-### New release 2.0 with 64 bit support.
-
-- The - (id)initWithDataPath:(NSString *)dataPath language:(NSString *)language method is now deprecated.
-- Bug fixing!
-- Removed tessdata folder from the framework project.
-- The tessdata folder (follow the Template Framework Project) is now linked with the "folder references" option into the Template Project. REQUIRED!!!
+- Bug fixes
+- CoreImage filters: use `[img blackAndWhite];` to convert a UIImage to
+ recognize into a RecognizeImageType
+- Rect: use `[tesseract setRect:CGRectMake(20, 20, 100, 100)]` to define a
+ rectangle where the text must be located to be recognized
+
+### 2.23
+- There is no need to draw an image for Tesseract anymore. Instead it's
+ possible just to get raw data from the input image. This is better because
+ in the case of a grayscale input image, there is no need to draw it in RGB
+ color space, which increases memory consumption significantly.
+
+### 2.22
+- Added support for CocoaPods
+
+### 2.21
+- tesserackCallbackFunction: leak fixed
+
+### 2.2
+- `shouldCancelImageRecognitionForTesseract` works again (thanks to Timo
+ Formella)
+- Template project updated, now with camera support
+
+### 2.1
+
+- Fixed memory leaks
+- Moved all freeing memory job to dealloc (thanks to @frank4565)
+- Clear method is deprecated. Set `tesseract = nil;` to free all memory
+- Free the utf8Text according to the comment in Tesseract that
+ “The recognized text is returned as a char* which is coded as UTF8 and must
+ be freed with the delete [] operator.”
+- Template Framework Project updated
+
+### 2.0
+
+- 64-bit support
+- The
+ `- (id)initWithDataPath:(NSString *)dataPath language:(NSString *)language`
+ method is now deprecated
+- Bug fixes
+- Removed tessdata folder from the framework project; the tessdata folder
+ (in the Template Framework Project) is now linked with the "folder
+ references" **REQUIRED!**
- Added delegate TesseractDelegate
-- arm64 support. Thanks to Cyril
-- Now you can compile yours libraries. Follow the README_howto_compile_libaries.md inside. Thanks to Simon Strangbaard
+- arm64 support (thanks to Cyril)
+- Now you can compile the tesseract/leptonica libraries; follow the
+ instructions in README_howto_compile_libaries.md (thanks to Simon
+ Strangbaard)
- Framework updated
-- Bugs fixed. Thanks to Simon Strangbaard
-- iOS7 libstdc++ issue solved (using libstdc++.6.0.9).
-- **Template Framework Project added.** It's the start point for use the Tesseract Framework. It's **iOS7** ready!
-- 11 october 2013, tesseract is up to date with last https://github.com/ldiqual/tesseract-ios version available.
-- Clear method updated:[tesseract clear]; //call Clear() end End() functions
+- Bugs fixed (thanks to Simon Strangbaard)
+- iOS7 libstdc++ issue solved (using libstdc++.6.0.9)
+- **Template Framework Project added.** It's the starting point for using the
+ Tesseract Framework. It's **iOS7** ready!
+- October 11, 2013: Tesseract is up-to-date with the
+ [last version available](https://github.com/ldiqual/tesseract-ios)
+- Clear method updated:`[tesseract clear]; //call Clear() end End() functions`
- XCode 5 ready!
-- Framework builded with the new Xcode 5.
-
-Dependencies
-=================
-
-Tesseract OCR iOS use UIKit, Foundation and CoreFoundation. They are already included in standard iOS Projects.
+- Framework built with the new Xcode 5
License
=================
-Tesseract OCR iOS and TesseractOCR.framework are under MIT License.
+Tesseract OCR iOS and TesseractOCR.framework are distributed under the MIT
+license (see LICENSE.md).
-Tesseract, powered by Google http://code.google.com/p/tesseract-ocr/, is under Apache License.
+Tesseract, maintained by Google (http://code.google.com/p/tesseract-ocr/), is
+distributed under the Apache 2.0 license (see
+http://www.apache.org/licenses/LICENSE-2.0).
-Author Infos
+Contributors
=================
-Daniele Galiotto - iOS Freelance Developer - **www.g8production.com**
+Daniele Galiotto (founder) - iOS Freelance Developer -
+**[www.g8production.com]()**
+Kevin Conley - Stanford Graduate Fellow - **[www.kevintechnology.com]()**
diff --git a/TesseractOCR/README_howto_compile_libaries.md b/TesseractOCR/README_howto_compile_libaries.md
index 9c7741b9..78d1b9a4 100644
--- a/TesseractOCR/README_howto_compile_libaries.md
+++ b/TesseractOCR/README_howto_compile_libaries.md
@@ -1,9 +1,10 @@
-# Compiling the .a files your self
+# Compiling the .a library files your self
-### Step 1 - Prerequisits
-In order to compile you need these tools:
-- Xcode 5.0.2 (5A3005)
+### Step 1 - Prerequisites
+First you need to install these tools:
+
+- Xcode 6.1 (6A1052d) with command line tools
- M4
- Autoconf
- Automake
@@ -11,23 +12,17 @@ In order to compile you need these tools:
### Step 2 - Download and unzip
-Download the source code for `leptonica-1.69` from the internet.
+Download the source code for `leptonica-1.71` from the Internet here: http://leptonica.org/source/leptonica-1.71.tar.gz.
Unzip it in this folder.
-Download the source code for `tesseract-3.02.02` from the internet.
+Download the source code for `tesseract-3.03` from the Internet here: https://tesseract-ocr.googlecode.com/archive/3.03-rc1.tar.gz.
Unzip it in this folder.
### Step 3 - Compile
-Run `build_dependencies.sh` from terminal, this compiles first leptonica and then tesseract.
-
-This creates, after few minutes, a folder named `dependencies`.
-
+Run `build_dependencies.sh` from the terminal. This first compiles leptonica and then tesseract for every architecture iOS/simulator uses (arm7 arm7s arm64 i386 x86_64), and then combines the resulting libs into one library file. It does this for both leptonica and tesseract, so the final results of the script are "libtesseract_all.a", "liblept.a", and "include" directories for both leptonica and tesseract. Finally, the script copies these results into the "lib" and "include" directories inside this directory.
-### Step 4 - Done
-Copy the file `dependencies/lib/liblept.a` and replace `lib/liblept.a`.
-Copy the file `dependencies/lib/libtesseract_all.a` and replace `lib/libtesseract_all.a`.
-Copy the folder `dependencies/include/leptonica` and replace `include/leptonica`.
-Copy the folder `dependencies/include/tesseract` and replace `include/tesseract`.
+### Step 4 - Build
+Finally, with `Tesseract OCR iOS.xcodeproj` open in Xcode, build the target "TesseractOCRAggregate". This will use the "lib" and "include" directories to create the Tesseract OCR iOS framework.
diff --git a/TesseractOCR/build_dependencies.sh b/TesseractOCR/build_dependencies.sh
index 188c3905..c9f0271e 100755
--- a/TesseractOCR/build_dependencies.sh
+++ b/TesseractOCR/build_dependencies.sh
@@ -1,227 +1,187 @@
#!/bin/sh
-# build.sh
-GLOBAL_OUTDIR="`pwd`/dependencies"
+# Written by @kevincon, based on @williamsodell's modifications to @gali8's
+# original build_dependencies.sh script.
+
+# See README_howto_compile_libaries.md for full instructions.
+
+GLOBAL_OUTDIR="`pwd`/build"
LOCAL_OUTDIR="./outdir"
-LEPTON_LIB="`pwd`/leptonica-1.69"
-TESSERACT_LIB="`pwd`/tesseract-3.02.02"
+LEPTON_LIB="`pwd`/leptonica-1.71"
+TESSERACT_LIB="`pwd`/tesseract-3.03"
IOS_BASE_SDK="7.0"
-IOS_DEPLOY_TGT="5.1.1"
-
-XCODE_DEVELOPER=/Applications/Xcode.app/Contents/Developer
-XCODETOOLCHAIN=$XCODE_DEVELOPER/Toolchains/XcodeDefault.xctoolchain
-SDK_IPHONEOS=$(xcrun --sdk iphoneos --show-sdk-path)
-SDK_IPHONESIMULATOR=$(xcrun --sdk iphonesimulator --show-sdk-path)
-
-setenv_all()
-{
- # Add internal libs
- export CFLAGS="$CFLAGS -I$GLOBAL_OUTDIR/include -L$GLOBAL_OUTDIR/lib"
-
- export CXX=`xcrun -find c++`
- export CC=`xcrun -find cc`
- export PATH="$XCODETOOLCHAIN/usr/bin:$PATH"
-
- export LD=`xcrun -find ld`
- export AR=`xcrun -find ar`
- export AS=`xcrun -find as`
- export NM=`xcrun -find nm`
- export RANLIB=`xcrun -find ranlib`
-
- export LDFLAGS="-L$SDKROOT/usr/lib/"
-
- export CPPFLAGS=$CFLAGS
- export CXXFLAGS=$CFLAGS
+IOS_DEPLOY_TGT="7.0"
+
+export CXX=`xcrun -find c++`
+export CC=`xcrun -find cc`
+
+export LD=`xcrun -find ld`
+export AR=`xcrun -find ar`
+export AS=`xcrun -find as`
+export NM=`xcrun -find nm`
+export RANLIB=`xcrun -find ranlib`
+
+XCODE_DEVELOPER_PATH=/Applications/Xcode.app/Contents/Developer
+XCODETOOLCHAIN_PATH=$XCODE_DEVELOPER_PATH/Toolchains/XcodeDefault.xctoolchain
+SDK_IPHONEOS_PATH=$(xcrun --sdk iphoneos --show-sdk-path)
+SDK_IPHONESIMULATOR_PATH=$(xcrun --sdk iphonesimulator --show-sdk-path)
+
+export PATH="$XCODETOOLCHAIN_PATH/usr/bin:$PATH"
+
+declare -a archs
+archs=(arm7 arm7s arm64 i386 x86_64)
+
+declare -a arch_name
+arch_names=(arm-apple-darwin7 arm-apple-darwin7s arm-apple-darwin64 i386-apple-darwin x86_64-apple-darwin)
+
+setenv_all() {
+# Add internal libs
+export CFLAGS="$CFLAGS -I$GLOBAL_OUTDIR/include -L$GLOBAL_OUTDIR/lib -Qunused-arguments"
+
+export LDFLAGS="-L$SDKROOT/usr/lib/"
+
+export CPPFLAGS=$CFLAGS
+export CXXFLAGS=$CFLAGS
}
-setenv_arm7()
-{
- unset SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
- export SDKROOT=$SDK_IPHONEOS
- export CFLAGS="-arch armv7 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
- setenv_all
+setenv_arm7() {
+unset DEVROOT SDKROOT CFLAGS CPP CXXCPP LDFLAGS CPPFLAGS CXXFLAGS
+
+export SDKROOT=$SDK_IPHONEOS_PATH
+
+export CFLAGS="-arch armv7 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
+
+setenv_all
}
-setenv_arm7s()
-{
- unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
- export SDKROOT=$SDK_IPHONEOS
- export CFLAGS="-arch armv7s -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
- setenv_all
+setenv_arm7s() {
+unset DEVROOT SDKROOT CFLAGS CPP CXXCPP LDFLAGS CPPFLAGS CXXFLAGS
+
+export SDKROOT=$SDK_IPHONEOS_PATH
+
+export CFLAGS="-arch armv7s -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
+
+setenv_all
}
-setenv_arm64()
-{
-unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
-export SDKROOT=$SDK_IPHONEOS
+setenv_arm64() {
+unset DEVROOT SDKROOT CFLAGS CPP CXXCPP LDFLAGS CPPFLAGS CXXFLAGS
+
+export SDKROOT=$SDK_IPHONEOS_PATH
+
export CFLAGS="-arch arm64 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
+
setenv_all
}
-setenv_i386()
-{
- unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
- export SDKROOT=$SDK_IPHONESIMULATOR
- export CFLAGS="-arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT"
- setenv_all
-}
+setenv_i386() {
+unset DEVROOT SDKROOT CFLAGS CPP CXXCPP LDFLAGS CPPFLAGS CXXFLAGS
-setenv_x86_64()
-{
- unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
- export SDKROOT=$SDK_IPHONESIMULATOR
- export CFLAGS="-arch x86_64 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT"
- setenv_all
-}
+export SDKROOT=$SDK_IPHONESIMULATOR_PATH
+
+export CFLAGS="-arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT"
-create_outdir_lipo()
-{
- for lib_i386 in `find $LOCAL_OUTDIR/i386 -name "lib*.a"`; do
- lib_arm7=`echo $lib_i386 | sed "s/i386/arm7/g"`
- lib_arm7s=`echo $lib_i386 | sed "s/i386/arm7s/g"`
- lib_arm64=`echo $lib_i386 | sed "s/i386/arm64/g"`
- lib=`echo $lib_i386 | sed "s/i386//g"`
- lib_x86_64=`echo $lib_i386 | sed "s/i386/x86_64/g"`
- xcrun -sdk iphoneos lipo -arch armv7 $lib_arm7 -arch armv7s $lib_arm7s -arch arm64 $lib_arm64 -arch x86_64 $lib_x86_64 -arch i386 $lib_i386 -create -output $lib
- done
+setenv_all
}
-merge_libfiles()
-{
- DIR=$1
- LIBNAME=$2
-
- cd $DIR
- for i in `find . -name "lib*.a"`; do
- $AR -x $i
- done
- $AR -r $LIBNAME *.o
- rm -rf *.o __*
- cd -
+setenv_x86_64() {
+unset DEVROOT SDKROOT CFLAGS CPP CXXCPP LDFLAGS CPPFLAGS CXXFLAGS
+
+export SDKROOT=$SDK_IPHONESIMULATOR_PATH
+
+export CFLAGS="-arch x86_64 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT"
+
+setenv_all
}
-build_leptonica()
-{
- #######################
- # LEPTONLIB
- #######################
- cd $LEPTON_LIB
- rm -rf $LOCAL_OUTDIR
- mkdir -p $LOCAL_OUTDIR/arm7 $LOCAL_OUTDIR/arm7s $LOCAL_OUTDIR/arm64 $LOCAL_OUTDIR/i386 $LOCAL_OUTDIR/x86_64
-
- make clean 2> /dev/null
- make distclean 2> /dev/null
- setenv_arm7
- ./configure --host=arm-apple-darwin7 --enable-shared=no --disable-programs --without-zlib --without-libpng --without-jpeg --without-giflib --without-libtiff
- make -j12
- cp -rvf src/.libs/lib*.a $LOCAL_OUTDIR/arm7
-
- make clean 2> /dev/null
- make distclean 2> /dev/null
- setenv_arm7s
- ./configure --host=arm-apple-darwin7s --enable-shared=no --disable-programs --without-zlib --without-libpng --without-jpeg --without-giflib --without-libtiff
- make -j12
- cp -rvf src/.libs/lib*.a $LOCAL_OUTDIR/arm7s
-
- make clean 2> /dev/null
- make distclean 2> /dev/null
- setenv_arm64
- ./configure --host=arm-apple-darwin64 --enable-shared=no --disable-programs --without-zlib --without-libpng --without-jpeg --without-giflib --without-libtiff
- make -j12
- cp -rvf src/.libs/lib*.a $LOCAL_OUTDIR/arm64
-
- make clean 2> /dev/null
- make distclean 2> /dev/null
- setenv_i386
- ./configure --enable-shared=no --disable-programs --without-zlib --without-libpng --without-jpeg --without-giflib --without-libtiff
- make -j12
- cp -rvf src/.libs/lib*.a $LOCAL_OUTDIR/i386
-
- make clean 2> /dev/null
- make distclean 2> /dev/null
- setenv_x86_64
- ./configure --host=x86_64-apple-darwin --enable-shared=no --disable-programs --without-zlib --without-libpng --without-jpeg --without-giflib --without-libtiff
- make -j12
- cp -rvf src/.libs/lib*.a $LOCAL_OUTDIR/x86_64
-
- create_outdir_lipo
- mkdir -p $GLOBAL_OUTDIR/include/leptonica && cp -rvf src/*.h $GLOBAL_OUTDIR/include/leptonica
- mkdir -p $GLOBAL_OUTDIR/lib && cp -rvf $LOCAL_OUTDIR/lib*.a $GLOBAL_OUTDIR/lib
- cd ..
+create_outdir_lipo() {
+for file in `find $LOCAL_OUTDIR/i386 -name "lib*.a"`; do
+lib_arm7=`echo $file | sed "s/i386/arm7/g"`
+lib_arm7s=`echo $file | sed "s/i386/arm7s/g"`
+lib_arm64=`echo $file | sed "s/i386/arm64/g"`
+lib_x86_64=`echo $file | sed "s/i386/x86_64/g"`
+lib_i386=`echo $file`
+lib=`echo $file | sed "s/i386//g"`
+xcrun -sdk iphoneos lipo -arch armv7s $lib_arm7s -arch armv7 $lib_arm7 -arch arm64 $lib_arm64 -arch i386 $lib_i386 -arch x86_64 $lib_x86_64 -create -output $lib
+done
}
-build_tesseract()
-{
- #######################
- # TESSERACT-OCR
- #######################
- cd $TESSERACT_LIB
- rm -rf $LOCAL_OUTDIR
- mkdir -p $LOCAL_OUTDIR/arm7 $LOCAL_OUTDIR/arm7s $LOCAL_OUTDIR/arm64 $LOCAL_OUTDIR/i386 $LOCAL_OUTDIR/x86_64
-
- make clean 2> /dev/null
- make distclean 2> /dev/null
- setenv_arm7
- bash autogen.sh
- ./configure --host=arm-apple-darwin7 --enable-shared=no LIBLEPT_HEADERSDIR=$GLOBAL_OUTDIR/include/
- make -j12
- for i in `find . -name "lib*.a" | grep -v arm`; do cp -rvf $i $LOCAL_OUTDIR/arm7; done
- merge_libfiles $LOCAL_OUTDIR/arm7 libtesseract_all.a
-
- make clean 2> /dev/null
- make distclean 2> /dev/null
- setenv_arm7s
- bash autogen.sh
- ./configure --host=arm-apple-darwin7s --enable-shared=no LIBLEPT_HEADERSDIR=$GLOBAL_OUTDIR/include/
- make -j12
- for i in `find . -name "lib*.a" | grep -v arm`; do cp -rvf $i $LOCAL_OUTDIR/arm7s; done
- merge_libfiles $LOCAL_OUTDIR/arm7s libtesseract_all.a
-
- make clean 2> /dev/null
- make distclean 2> /dev/null
- setenv_arm64
- bash autogen.sh
- ./configure --host=arm-apple-darwin64 --enable-shared=no LIBLEPT_HEADERSDIR=$GLOBAL_OUTDIR/include/
- make -j12
- for i in `find . -name "lib*.a" | grep -v arm`; do cp -rvf $i $LOCAL_OUTDIR/arm64; done
- merge_libfiles $LOCAL_OUTDIR/arm64 libtesseract_all.a
-
- make clean 2> /dev/null
- make distclean 2> /dev/null
- setenv_i386
- bash autogen.sh
- ./configure --enable-shared=no LIBLEPT_HEADERSDIR=$GLOBAL_OUTDIR/include/
- make -j12
- for i in `find . -name "lib*.a" | grep -v arm`; do cp -rvf $i $LOCAL_OUTDIR/i386; done
- merge_libfiles $LOCAL_OUTDIR/i386 libtesseract_all.a
-
- make clean 2> /dev/null
- make distclean 2> /dev/null
- setenv_x86_64
- bash autogen.sh
- ./configure --host=x86_64-apple-darwin --enable-shared=no LIBLEPT_HEADERSDIR=$GLOBAL_OUTDIR/include/
- make -j12
- for i in `find . -name "lib*.a" | grep -v arm | grep -v i386`; do cp -rvf $i $LOCAL_OUTDIR/x86_64; done
- merge_libfiles $LOCAL_OUTDIR/x86_64 libtesseract_all.a
-
- create_outdir_lipo
- mkdir -p $GLOBAL_OUTDIR/include/tesseract
- tess_inc=( api/apitypes.h api/baseapi.h ccmain/thresholder.h ccstruct/publictypes.h ccutil/errcode.h
- ccutil/genericvector.h ccutil/helpers.h ccutil/host.h ccutil/ndminx.h ccutil/ocrclass.h
- ccutil/platform.h ccutil/tesscallback.h ccutil/unichar.h )
- for i in "${tess_inc[@]}"; do
- cp -rvf $i $GLOBAL_OUTDIR/include/tesseract
- done
-
- mkdir -p $GLOBAL_OUTDIR/lib && cp -rvf $LOCAL_OUTDIR/lib*.a $GLOBAL_OUTDIR/lib
- make clean 2> /dev/null
- make distclean 2> /dev/null
- rm -rf $LOCAL_OUTDIR
- cd ..
+merge_libfiles() {
+DIR=$1
+LIBNAME=$2
+
+cd $DIR
+for i in `find . -name "lib*.a"`; do
+$AR -x $i
+done
+$AR -r $LIBNAME *.o
+rm -rf *.o __*
+cd -
}
-build_leptonica
-build_tesseract
+#######################
+# Start clean
+#######################
+
+rm -rf GLOBAL_OUTDIR lib include
+
+#######################
+# LEPTONLIB
+#######################
+cd $LEPTON_LIB
+rm -rf $LOCAL_OUTDIR
+
+for n in "${!archs[@]}"
+do
+mkdir -p "$LOCAL_OUTDIR/${archs[$n]}"
+make clean 2> /dev/null
+make distclean 2> /dev/null
+eval "setenv_${archs[$n]}"
+./configure --host="${arch_names[$n]}" --enable-shared=no --disable-programs --without-zlib --without-libpng --without-jpeg --without-giflib --without-libtiff
+make -j12
+cp -rvf src/.libs/lib*.a "$LOCAL_OUTDIR/${archs[$n]}"
+done
+
+create_outdir_lipo
+mkdir -p $GLOBAL_OUTDIR/include/leptonica && find ./ -name '*.h' -exec cp {} $GLOBAL_OUTDIR/include/leptonica/ \;
+mkdir -p $GLOBAL_OUTDIR/lib && cp -rvf $LOCAL_OUTDIR/lib*.a $GLOBAL_OUTDIR/lib
+cd ..
+
+
+#######################
+# TESSERACT-OCR
+#######################
+cd $TESSERACT_LIB
+rm -rf $LOCAL_OUTDIR
+
+for n in "${!archs[@]}"
+do
+mkdir -p "$LOCAL_OUTDIR/${archs[$n]}"
+make clean 2> /dev/null
+make distclean 2> /dev/null
+eval "setenv_${archs[$n]}"
+bash autogen.sh
+LIBLEPT_HEADERSDIR=$GLOBAL_OUTDIR/include ./configure --host="${arch_names[$n]}" --enable-shared=no
+make -j12
+for i in `find . -name "lib*.a" | grep -v $LOCAL_OUTDIR`; do cp -rvf $i "$LOCAL_OUTDIR/${archs[$n]}"; done
+merge_libfiles "$LOCAL_OUTDIR/${archs[$n]}" libtesseract_all.a
+done
+
+create_outdir_lipo
+
+mkdir -p $GLOBAL_OUTDIR/include/tesseract && find ./ -name '*.h' -exec cp {} $GLOBAL_OUTDIR/include/tesseract/ \;
+mkdir -p $GLOBAL_OUTDIR/lib && cp -rvf $LOCAL_OUTDIR/lib*.a $GLOBAL_OUTDIR/lib
+make clean 2> /dev/null
+make distclean 2> /dev/null
+cd ..
+
+#######################
+# Copying
+#######################
+
+cp -rf $GLOBAL_OUTDIR/include .
+mkdir -p lib
+cp -rf $GLOBAL_OUTDIR/lib/libtesseract_all.a $GLOBAL_OUTDIR/lib/liblept.a lib/
echo "Finished!"
diff --git a/TesseractOCR/include/leptonica/allheaders.h b/TesseractOCR/include/leptonica/allheaders.h
index aa850d6c..9d81ae86 100644
--- a/TesseractOCR/include/leptonica/allheaders.h
+++ b/TesseractOCR/include/leptonica/allheaders.h
@@ -29,7 +29,7 @@
#define LIBLEPT_MAJOR_VERSION 1
-#define LIBLEPT_MINOR_VERSION 70
+#define LIBLEPT_MINOR_VERSION 71
#include "alltypes.h"
@@ -126,10 +126,10 @@ LEPT_DLL extern void bbufferDestroy ( BBUFFER **pbb );
LEPT_DLL extern l_uint8 * bbufferDestroyAndSaveData ( BBUFFER **pbb, size_t *pnbytes );
LEPT_DLL extern l_int32 bbufferRead ( BBUFFER *bb, l_uint8 *src, l_int32 nbytes );
LEPT_DLL extern l_int32 bbufferReadStream ( BBUFFER *bb, FILE *fp, l_int32 nbytes );
+LEPT_DLL extern l_int32 bbufferExtendArray ( BBUFFER *bb, l_int32 nbytes );
LEPT_DLL extern l_int32 bbufferWrite ( BBUFFER *bb, l_uint8 *dest, size_t nbytes, size_t *pnout );
LEPT_DLL extern l_int32 bbufferWriteStream ( BBUFFER *bb, FILE *fp, size_t nbytes, size_t *pnout );
LEPT_DLL extern l_int32 bbufferBytesToWrite ( BBUFFER *bb, size_t *pnbytes );
-LEPT_DLL extern l_int32 bbufferReadStdin ( l_uint8 **pdata, size_t *pnbytes );
LEPT_DLL extern PIX * pixBilateral ( PIX *pixs, l_float32 spatial_stdev, l_float32 range_stdev, l_int32 ncomps, l_int32 reduction );
LEPT_DLL extern PIX * pixBilateralGray ( PIX *pixs, l_float32 spatial_stdev, l_float32 range_stdev, l_int32 ncomps, l_int32 reduction );
LEPT_DLL extern PIX * pixBilateralExact ( PIX *pixs, L_KERNEL *spatial_kel, L_KERNEL *range_kel );
@@ -155,6 +155,7 @@ LEPT_DLL extern l_int32 pixSauvolaBinarizeTiled ( PIX *pixs, l_int32 whsize, l_f
LEPT_DLL extern l_int32 pixSauvolaBinarize ( PIX *pixs, l_int32 whsize, l_float32 factor, l_int32 addborder, PIX **ppixm, PIX **ppixsd, PIX **ppixth, PIX **ppixd );
LEPT_DLL extern PIX * pixSauvolaGetThreshold ( PIX *pixm, PIX *pixms, l_float32 factor, PIX **ppixsd );
LEPT_DLL extern PIX * pixApplyLocalThreshold ( PIX *pixs, PIX *pixth, l_int32 redfactor );
+LEPT_DLL extern l_int32 pixThresholdByConnComp ( PIX *pixs, PIX *pixm, l_int32 start, l_int32 end, l_int32 incr, l_float32 thresh48, l_float32 threshdiff, l_int32 *pglobthresh, PIX **ppixd, l_int32 debugflag );
LEPT_DLL extern PIX * pixExpandBinaryReplicate ( PIX *pixs, l_int32 factor );
LEPT_DLL extern PIX * pixExpandBinaryPower2 ( PIX *pixs, l_int32 factor );
LEPT_DLL extern PIX * pixReduceBinary2 ( PIX *pixs, l_uint8 *intab );
@@ -216,6 +217,7 @@ LEPT_DLL extern l_int32 boxaReplaceBox ( BOXA *boxa, l_int32 index, BOX *box );
LEPT_DLL extern l_int32 boxaInsertBox ( BOXA *boxa, l_int32 index, BOX *box );
LEPT_DLL extern l_int32 boxaRemoveBox ( BOXA *boxa, l_int32 index );
LEPT_DLL extern l_int32 boxaRemoveBoxAndSave ( BOXA *boxa, l_int32 index, BOX **pbox );
+LEPT_DLL extern BOXA * boxaSaveValid ( BOXA *boxas, l_int32 copyflag );
LEPT_DLL extern l_int32 boxaInitFull ( BOXA *boxa, BOX *box );
LEPT_DLL extern l_int32 boxaClear ( BOXA *boxa );
LEPT_DLL extern BOXAA * boxaaCreate ( l_int32 n );
@@ -292,6 +294,7 @@ LEPT_DLL extern l_int32 boxaExtractAsNuma ( BOXA *boxa, NUMA **pnax, NUMA **pnay
LEPT_DLL extern l_int32 boxaExtractAsPta ( BOXA *boxa, PTA **pptal, PTA **pptat, PTA **pptar, PTA **pptab, l_int32 keepinvalid );
LEPT_DLL extern BOX * boxaGetRankSize ( BOXA *boxa, l_float32 fract );
LEPT_DLL extern BOX * boxaGetMedian ( BOXA *boxa );
+LEPT_DLL extern l_int32 boxaGetAverageSize ( BOXA *boxa, l_float32 *pw, l_float32 *ph );
LEPT_DLL extern l_int32 boxaaGetExtent ( BOXAA *baa, l_int32 *pw, l_int32 *ph, BOX **pbox, BOXA **pboxa );
LEPT_DLL extern BOXA * boxaaFlattenToBoxa ( BOXAA *baa, NUMA **pnaindex, l_int32 copyflag );
LEPT_DLL extern BOXA * boxaaFlattenAligned ( BOXAA *baa, l_int32 num, BOX *fillerbox, l_int32 copyflag );
@@ -308,6 +311,7 @@ LEPT_DLL extern PIX * pixDrawBoxaRandom ( PIX *pixs, BOXA *boxa, l_int32 width )
LEPT_DLL extern PIX * boxaaDisplay ( BOXAA *baa, l_int32 linewba, l_int32 linewb, l_uint32 colorba, l_uint32 colorb, l_int32 w, l_int32 h );
LEPT_DLL extern BOXA * pixSplitIntoBoxa ( PIX *pixs, l_int32 minsum, l_int32 skipdist, l_int32 delta, l_int32 maxbg, l_int32 maxcomps, l_int32 remainder );
LEPT_DLL extern BOXA * pixSplitComponentIntoBoxa ( PIX *pix, BOX *box, l_int32 minsum, l_int32 skipdist, l_int32 delta, l_int32 maxbg, l_int32 maxcomps, l_int32 remainder );
+LEPT_DLL extern BOXA * makeMosaicStrips ( l_int32 w, l_int32 h, l_int32 direction, l_int32 size );
LEPT_DLL extern l_int32 boxaCompareRegions ( BOXA *boxa1, BOXA *boxa2, l_int32 areathresh, l_int32 *pnsame, l_float32 *pdiffarea, l_float32 *pdiffxor, PIX **ppixdb );
LEPT_DLL extern BOXA * boxaSelectRange ( BOXA *boxas, l_int32 first, l_int32 last, l_int32 copyflag );
LEPT_DLL extern BOXAA * boxaaSelectRange ( BOXAA *baas, l_int32 first, l_int32 last, l_int32 copyflag );
@@ -321,8 +325,9 @@ LEPT_DLL extern BOXA * boxaPermuteRandom ( BOXA *boxad, BOXA *boxas );
LEPT_DLL extern l_int32 boxaSwapBoxes ( BOXA *boxa, l_int32 i, l_int32 j );
LEPT_DLL extern PTA * boxaConvertToPta ( BOXA *boxa, l_int32 ncorners );
LEPT_DLL extern BOXA * ptaConvertToBoxa ( PTA *pta, l_int32 ncorners );
-LEPT_DLL extern BOXA * boxaSmoothSequence ( BOXA *boxas, l_float32 factor, l_int32 max_error, l_int32 debug );
-LEPT_DLL extern BOXA * boxaLinearFit ( BOXA *boxas, l_float32 factor, l_int32 max_error, l_int32 debug );
+LEPT_DLL extern BOXA * boxaSmoothSequence ( BOXA *boxas, l_float32 factor, l_int32 subflag, l_int32 maxdiff, l_int32 debug );
+LEPT_DLL extern BOXA * boxaLinearFit ( BOXA *boxas, l_float32 factor, l_int32 debug );
+LEPT_DLL extern BOXA * boxaModifyWithBoxa ( BOXA *boxas, BOXA *boxam, l_int32 subflag, l_int32 maxdiff );
LEPT_DLL extern BOXA * boxaConstrainSize ( BOXA *boxas, l_int32 width, l_int32 widthflag, l_int32 height, l_int32 heightflag );
LEPT_DLL extern BOXA * boxaReconcileEvenOddHeight ( BOXA *boxas, l_int32 sides, l_int32 delh, l_int32 op, l_float32 factor );
LEPT_DLL extern l_int32 boxaPlotSides ( BOXA *boxa, const char *plotname, NUMA **pnal, NUMA **pnat, NUMA **pnar, NUMA **pnab, l_int32 outformat );
@@ -332,7 +337,7 @@ LEPT_DLL extern l_int32 boxaaSizeRange ( BOXAA *baa, l_int32 *pminw, l_int32 *pm
LEPT_DLL extern l_int32 boxaSizeRange ( BOXA *boxa, l_int32 *pminw, l_int32 *pminh, l_int32 *pmaxw, l_int32 *pmaxh );
LEPT_DLL extern l_int32 boxaLocationRange ( BOXA *boxa, l_int32 *pminx, l_int32 *pminy, l_int32 *pmaxx, l_int32 *pmaxy );
LEPT_DLL extern l_int32 boxaGetArea ( BOXA *boxa, l_int32 *parea );
-LEPT_DLL extern PIX * boxaDisplayTiled ( BOXA *boxa, PIXA *pixa, l_int32 maxwidth, l_int32 linewidth, l_float32 scalefactor, l_int32 background, l_int32 spacing, l_int32 border, const char *fontdir );
+LEPT_DLL extern PIX * boxaDisplayTiled ( BOXA *boxas, PIXA *pixa, l_int32 maxwidth, l_int32 linewidth, l_float32 scalefactor, l_int32 background, l_int32 spacing, l_int32 border, const char *fontdir );
LEPT_DLL extern L_BYTEA * l_byteaCreate ( size_t nbytes );
LEPT_DLL extern L_BYTEA * l_byteaInitFromMem ( l_uint8 *data, size_t size );
LEPT_DLL extern L_BYTEA * l_byteaInitFromFile ( const char *fname );
@@ -402,6 +407,7 @@ LEPT_DLL extern PIX * pixSimpleColorQuantize ( PIX *pixs, l_int32 sigbits, l_int
LEPT_DLL extern NUMA * pixGetRGBHistogram ( PIX *pixs, l_int32 sigbits, l_int32 factor );
LEPT_DLL extern l_int32 makeRGBIndexTables ( l_uint32 **prtab, l_uint32 **pgtab, l_uint32 **pbtab, l_int32 sigbits );
LEPT_DLL extern l_int32 getRGBFromIndex ( l_uint32 index, l_int32 sigbits, l_int32 *prval, l_int32 *pgval, l_int32 *pbval );
+LEPT_DLL extern l_int32 pixHasHighlightRed ( PIX *pixs, l_int32 factor, l_float32 fract, l_float32 fthresh, l_int32 *phasred, l_float32 *pratio, PIX **ppixdb );
LEPT_DLL extern PIX * pixColorGrayRegions ( PIX *pixs, BOXA *boxa, l_int32 type, l_int32 thresh, l_int32 rval, l_int32 gval, l_int32 bval );
LEPT_DLL extern l_int32 pixColorGray ( PIX *pixs, BOX *box, l_int32 type, l_int32 thresh, l_int32 rval, l_int32 gval, l_int32 bval );
LEPT_DLL extern PIX * pixSnapColor ( PIX *pixd, PIX *pixs, l_uint32 srcval, l_uint32 dstval, l_int32 diff );
@@ -580,7 +586,7 @@ LEPT_DLL extern void dewarpaDestroy ( L_DEWARPA **pdewa );
LEPT_DLL extern l_int32 dewarpaDestroyDewarp ( L_DEWARPA *dewa, l_int32 pageno );
LEPT_DLL extern l_int32 dewarpaInsertDewarp ( L_DEWARPA *dewa, L_DEWARP *dew );
LEPT_DLL extern L_DEWARP * dewarpaGetDewarp ( L_DEWARPA *dewa, l_int32 index );
-LEPT_DLL extern l_int32 dewarpaSetCurvatures ( L_DEWARPA *dewa, l_int32 max_linecurv, l_int32 min_diff_linecurv, l_int32 max_diff_linecurv, l_int32 max_edgecurv, l_int32 max_diff_edgecurv );
+LEPT_DLL extern l_int32 dewarpaSetCurvatures ( L_DEWARPA *dewa, l_int32 max_linecurv, l_int32 min_diff_linecurv, l_int32 max_diff_linecurv, l_int32 max_edgecurv, l_int32 max_diff_edgecurv, l_int32 max_edgeslope );
LEPT_DLL extern l_int32 dewarpaUseBothArrays ( L_DEWARPA *dewa, l_int32 useboth );
LEPT_DLL extern l_int32 dewarpaSetMaxDistance ( L_DEWARPA *dewa, l_int32 maxdist );
LEPT_DLL extern L_DEWARP * dewarpRead ( const char *filename );
@@ -601,7 +607,7 @@ LEPT_DLL extern l_int32 dewarpaModelStatus ( L_DEWARPA *dewa, l_int32 pageno, l_
LEPT_DLL extern l_int32 dewarpaApplyDisparity ( L_DEWARPA *dewa, l_int32 pageno, PIX *pixs, l_int32 grayin, l_int32 x, l_int32 y, PIX **ppixd, const char *debugfile );
LEPT_DLL extern l_int32 dewarpMinimize ( L_DEWARP *dew );
LEPT_DLL extern l_int32 dewarpPopulateFullRes ( L_DEWARP *dew, PIX *pix, l_int32 x, l_int32 y );
-LEPT_DLL extern l_int32 dewarpSinglePage ( PIX *pixs, l_int32 thresh, l_int32 adaptive, l_int32 both, PIX **ppixd, L_DEWARPA **pdewa, l_int32 debug );
+LEPT_DLL extern l_int32 dewarpSinglePage ( PIX *pixs, l_int32 thresh, l_int32 adaptive, l_int32 use_both, PIX **ppixd, L_DEWARPA **pdewa, l_int32 debug );
LEPT_DLL extern l_int32 dewarpaListPages ( L_DEWARPA *dewa );
LEPT_DLL extern l_int32 dewarpaSetValidModels ( L_DEWARPA *dewa, l_int32 notests, l_int32 debug );
LEPT_DLL extern l_int32 dewarpaInsertRefModels ( L_DEWARPA *dewa, l_int32 notests, l_int32 debug );
@@ -609,9 +615,9 @@ LEPT_DLL extern l_int32 dewarpaStripRefModels ( L_DEWARPA *dewa );
LEPT_DLL extern l_int32 dewarpaRestoreModels ( L_DEWARPA *dewa );
LEPT_DLL extern l_int32 dewarpaInfo ( FILE *fp, L_DEWARPA *dewa );
LEPT_DLL extern l_int32 dewarpaModelStats ( L_DEWARPA *dewa, l_int32 *pnnone, l_int32 *pnvsuccess, l_int32 *pnvvalid, l_int32 *pnhsuccess, l_int32 *pnhvalid, l_int32 *pnref );
-LEPT_DLL extern l_int32 dewarpaShowArrays ( L_DEWARPA *dewa, l_float32 scalefact, l_int32 first, l_int32 last );
+LEPT_DLL extern l_int32 dewarpaShowArrays ( L_DEWARPA *dewa, l_float32 scalefact, l_int32 first, l_int32 last, const char *fontdir );
LEPT_DLL extern l_int32 dewarpDebug ( L_DEWARP *dew, const char *subdir, l_int32 index );
-LEPT_DLL extern l_int32 dewarpShowResults ( L_DEWARPA *dewa, SARRAY *sa, BOXA *boxa, l_int32 firstpage, l_int32 lastpage, const char *pdfout );
+LEPT_DLL extern l_int32 dewarpShowResults ( L_DEWARPA *dewa, SARRAY *sa, BOXA *boxa, l_int32 firstpage, l_int32 lastpage, const char *fontdir, const char *pdfout );
LEPT_DLL extern L_DNA * l_dnaCreate ( l_int32 n );
LEPT_DLL extern L_DNA * l_dnaCreateFromIArray ( l_int32 *iarray, l_int32 size );
LEPT_DLL extern L_DNA * l_dnaCreateFromDArray ( l_float64 *darray, l_int32 size, l_int32 copyflag );
@@ -825,6 +831,9 @@ LEPT_DLL extern l_int32 gplotGenDataFiles ( GPLOT *gplot );
LEPT_DLL extern l_int32 gplotSimple1 ( NUMA *na, l_int32 outformat, const char *outroot, const char *title );
LEPT_DLL extern l_int32 gplotSimple2 ( NUMA *na1, NUMA *na2, l_int32 outformat, const char *outroot, const char *title );
LEPT_DLL extern l_int32 gplotSimpleN ( NUMAA *naa, l_int32 outformat, const char *outroot, const char *title );
+LEPT_DLL extern l_int32 gplotSimpleXY1 ( NUMA *nax, NUMA *nay, l_int32 outformat, const char *outroot, const char *title );
+LEPT_DLL extern l_int32 gplotSimpleXY2 ( NUMA *nax, NUMA *nay1, NUMA *nay2, l_int32 outformat, const char *outroot, const char *title );
+LEPT_DLL extern l_int32 gplotSimpleXYN ( NUMA *nax, NUMAA *naay, l_int32 outformat, const char *outroot, const char *title );
LEPT_DLL extern GPLOT * gplotRead ( const char *filename );
LEPT_DLL extern l_int32 gplotWrite ( const char *filename, GPLOT *gplot );
LEPT_DLL extern PTA * generatePtaLine ( l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2 );
@@ -841,7 +850,10 @@ LEPT_DLL extern PTA * generatePtaFilledCircle ( l_int32 radius );
LEPT_DLL extern PTA * generatePtaFilledSquare ( l_int32 side );
LEPT_DLL extern PTA * generatePtaLineFromPt ( l_int32 x, l_int32 y, l_float64 length, l_float64 radang );
LEPT_DLL extern l_int32 locatePtRadially ( l_int32 xr, l_int32 yr, l_float64 dist, l_float64 radang, l_float64 *px, l_float64 *py );
-LEPT_DLL extern PTA * generatePlotPtaFromNuma ( NUMA *na, l_int32 orient, l_int32 width, l_int32 refpos, l_int32 max, l_int32 drawref );
+LEPT_DLL extern l_int32 pixRenderPlotFromNuma ( PIX **ppix, NUMA *na, l_int32 plotloc, l_int32 linewidth, l_int32 max, l_uint32 color );
+LEPT_DLL extern PTA * makePlotPtaFromNuma ( NUMA *na, l_int32 size, l_int32 plotloc, l_int32 linewidth, l_int32 max );
+LEPT_DLL extern l_int32 pixRenderPlotFromNumaGen ( PIX **ppix, NUMA *na, l_int32 orient, l_int32 linewidth, l_int32 refpos, l_int32 max, l_int32 drawref, l_uint32 color );
+LEPT_DLL extern PTA * makePlotPtaFromNumaGen ( NUMA *na, l_int32 orient, l_int32 linewidth, l_int32 refpos, l_int32 max, l_int32 drawref );
LEPT_DLL extern l_int32 pixRenderPta ( PIX *pix, PTA *pta, l_int32 op );
LEPT_DLL extern l_int32 pixRenderPtaArb ( PIX *pix, PTA *pta, l_uint8 rval, l_uint8 gval, l_uint8 bval );
LEPT_DLL extern l_int32 pixRenderPtaBlend ( PIX *pix, PTA *pta, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract );
@@ -883,6 +895,8 @@ LEPT_DLL extern PIX * pixDitherToBinary ( PIX *pixs );
LEPT_DLL extern PIX * pixDitherToBinarySpec ( PIX *pixs, l_int32 lowerclip, l_int32 upperclip );
LEPT_DLL extern PIX * pixThresholdToBinary ( PIX *pixs, l_int32 thresh );
LEPT_DLL extern PIX * pixVarThresholdToBinary ( PIX *pixs, PIX *pixg );
+LEPT_DLL extern PIX * pixAdaptThresholdToBinary ( PIX *pixs, PIX *pixm, l_float32 gamma );
+LEPT_DLL extern PIX * pixAdaptThresholdToBinaryGen ( PIX *pixs, PIX *pixm, l_float32 gamma, l_int32 blackval, l_int32 whiteval, l_int32 thresh );
LEPT_DLL extern PIX * pixDitherToBinaryLUT ( PIX *pixs, l_int32 lowerclip, l_int32 upperclip );
LEPT_DLL extern PIX * pixGenerateMaskByValue ( PIX *pixs, l_int32 val, l_int32 usecmap );
LEPT_DLL extern PIX * pixGenerateMaskByBand ( PIX *pixs, l_int32 lower, l_int32 upper, l_int32 inband, l_int32 usecmap );
@@ -896,7 +910,7 @@ LEPT_DLL extern l_int32 * makeGrayQuantIndexTable ( l_int32 nlevels );
LEPT_DLL extern l_int32 * makeGrayQuantTargetTable ( l_int32 nlevels, l_int32 depth );
LEPT_DLL extern l_int32 makeGrayQuantTableArb ( NUMA *na, l_int32 outdepth, l_int32 **ptab, PIXCMAP **pcmap );
LEPT_DLL extern l_int32 makeGrayQuantColormapArb ( PIX *pixs, l_int32 *tab, l_int32 outdepth, PIXCMAP **pcmap );
-LEPT_DLL extern PIX * pixGenerateMaskByBand32 ( PIX *pixs, l_uint32 refval, l_int32 delm, l_int32 delp );
+LEPT_DLL extern PIX * pixGenerateMaskByBand32 ( PIX *pixs, l_uint32 refval, l_int32 delm, l_int32 delp, l_float32 fractm, l_float32 fractp );
LEPT_DLL extern PIX * pixGenerateMaskByDiscr32 ( PIX *pixs, l_uint32 refval1, l_uint32 refval2, l_int32 distflag );
LEPT_DLL extern PIX * pixGrayQuantFromHisto ( PIX *pixd, PIX *pixs, PIX *pixm, l_float32 minfract, l_int32 maxsize );
LEPT_DLL extern PIX * pixGrayQuantFromCmap ( PIX *pixs, PIXCMAP *cmap, l_int32 mindepth );
@@ -946,23 +960,28 @@ LEPT_DLL extern JBDATA * jbDataRead ( const char *rootname );
LEPT_DLL extern PIXA * jbDataRender ( JBDATA *data, l_int32 debugflag );
LEPT_DLL extern l_int32 jbGetULCorners ( JBCLASSER *classer, PIX *pixs, BOXA *boxa );
LEPT_DLL extern l_int32 jbGetLLCorners ( JBCLASSER *classer );
-LEPT_DLL extern l_int32 readHeaderJp2k ( const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pspp );
-LEPT_DLL extern l_int32 freadHeaderJp2k ( FILE *fp, l_int32 *pw, l_int32 *ph, l_int32 *pspp );
-LEPT_DLL extern l_int32 sreadHeaderJp2k ( const l_uint8 *data, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pspp );
-LEPT_DLL extern PIX * pixReadJpeg ( const char *filename, l_int32 cmflag, l_int32 reduction, l_int32 *pnwarn );
+LEPT_DLL extern l_int32 readHeaderJp2k ( const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp );
+LEPT_DLL extern l_int32 freadHeaderJp2k ( FILE *fp, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp );
+LEPT_DLL extern l_int32 readHeaderMemJp2k ( const l_uint8 *data, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp );
+LEPT_DLL extern l_int32 fgetJp2kResolution ( FILE *fp, l_int32 *pxres, l_int32 *pyres );
+LEPT_DLL extern PIX * pixReadJp2k ( const char *filename, l_uint32 reduction, BOX *box, l_int32 hint );
+LEPT_DLL extern PIX * pixReadStreamJp2k ( FILE *fp, l_uint32 reduction, BOX *box, l_int32 hint );
+LEPT_DLL extern l_int32 pixWriteJp2k ( const char *filename, PIX *pix, l_int32 quality, l_int32 nlevels, l_int32 hint );
+LEPT_DLL extern l_int32 pixWriteStreamJp2k ( FILE *fp, PIX *pix, l_int32 quality, l_int32 nlevels, l_int32 hint );
+LEPT_DLL extern PIX * pixReadMemJp2k ( const l_uint8 *data, size_t size, l_uint32 reduction, BOX *box, l_int32 hint );
+LEPT_DLL extern l_int32 pixWriteMemJp2k ( l_uint8 **pdata, size_t *psize, PIX *pix, l_int32 quality, l_int32 nlevels, l_int32 hint );
+LEPT_DLL extern PIX * pixReadJpeg ( const char *filename, l_int32 cmflag, l_int32 reduction, l_int32 *pnwarn, l_int32 hint );
LEPT_DLL extern PIX * pixReadStreamJpeg ( FILE *fp, l_int32 cmflag, l_int32 reduction, l_int32 *pnwarn, l_int32 hint );
LEPT_DLL extern l_int32 readHeaderJpeg ( const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pspp, l_int32 *pycck, l_int32 *pcmyk );
LEPT_DLL extern l_int32 freadHeaderJpeg ( FILE *fp, l_int32 *pw, l_int32 *ph, l_int32 *pspp, l_int32 *pycck, l_int32 *pcmyk );
LEPT_DLL extern l_int32 fgetJpegResolution ( FILE *fp, l_int32 *pxres, l_int32 *pyres );
LEPT_DLL extern l_int32 fgetJpegComment ( FILE *fp, l_uint8 **pcomment );
LEPT_DLL extern l_int32 pixWriteJpeg ( const char *filename, PIX *pix, l_int32 quality, l_int32 progressive );
-LEPT_DLL extern l_int32 pixWriteStreamJpeg ( FILE *fp, PIX *pix, l_int32 quality, l_int32 progressive );
-LEPT_DLL extern PIX * pixReadMemJpeg ( const l_uint8 *cdata, size_t size, l_int32 cmflag, l_int32 reduction, l_int32 *pnwarn, l_int32 hint );
-LEPT_DLL extern l_int32 readHeaderMemJpeg ( const l_uint8 *cdata, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pspp, l_int32 *pycck, l_int32 *pcmyk );
+LEPT_DLL extern l_int32 pixWriteStreamJpeg ( FILE *fp, PIX *pixs, l_int32 quality, l_int32 progressive );
+LEPT_DLL extern PIX * pixReadMemJpeg ( const l_uint8 *data, size_t size, l_int32 cmflag, l_int32 reduction, l_int32 *pnwarn, l_int32 hint );
+LEPT_DLL extern l_int32 readHeaderMemJpeg ( const l_uint8 *data, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pspp, l_int32 *pycck, l_int32 *pcmyk );
LEPT_DLL extern l_int32 pixWriteMemJpeg ( l_uint8 **pdata, size_t *psize, PIX *pix, l_int32 quality, l_int32 progressive );
LEPT_DLL extern l_int32 pixSetChromaSampling ( PIX *pix, l_int32 sampling );
-LEPT_DLL extern l_int32 extractJpegDataFromFile ( const char *filein, l_uint8 **pdata, size_t *pnbytes, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp );
-LEPT_DLL extern l_int32 extractJpegDataFromArray ( const void *data, size_t nbytes, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp );
LEPT_DLL extern L_KERNEL * kernelCreate ( l_int32 height, l_int32 width );
LEPT_DLL extern void kernelDestroy ( L_KERNEL **pkel );
LEPT_DLL extern L_KERNEL * kernelCopy ( L_KERNEL *kels );
@@ -1247,8 +1266,8 @@ LEPT_DLL extern l_int32 convertImageDataToPdf ( l_uint8 *imdata, size_t size, l_
LEPT_DLL extern l_int32 convertToPdfData ( const char *filein, l_int32 type, l_int32 quality, l_uint8 **pdata, size_t *pnbytes, l_int32 x, l_int32 y, l_int32 res, const char *title, L_PDF_DATA **plpd, l_int32 position );
LEPT_DLL extern l_int32 convertImageDataToPdfData ( l_uint8 *imdata, size_t size, l_int32 type, l_int32 quality, l_uint8 **pdata, size_t *pnbytes, l_int32 x, l_int32 y, l_int32 res, const char *title, L_PDF_DATA **plpd, l_int32 position );
LEPT_DLL extern l_int32 pixConvertToPdf ( PIX *pix, l_int32 type, l_int32 quality, const char *fileout, l_int32 x, l_int32 y, l_int32 res, const char *title, L_PDF_DATA **plpd, l_int32 position );
-LEPT_DLL extern l_int32 pixConvertToPdfData ( PIX *pix, l_int32 type, l_int32 quality, l_uint8 **pdata, size_t *pnbytes, l_int32 x, l_int32 y, l_int32 res, const char *title, L_PDF_DATA **plpd, l_int32 position );
LEPT_DLL extern l_int32 pixWriteStreamPdf ( FILE *fp, PIX *pix, l_int32 res, const char *title );
+LEPT_DLL extern l_int32 pixWriteMemPdf ( l_uint8 **pdata, size_t *pnbytes, PIX *pix, l_int32 res, const char *title );
LEPT_DLL extern l_int32 convertSegmentedFilesToPdf ( const char *dirname, const char *substr, l_int32 res, l_int32 type, l_int32 thresh, BOXAA *baa, l_int32 quality, l_float32 scalefactor, const char *title, const char *fileout );
LEPT_DLL extern BOXAA * convertNumberedMasksToBoxaa ( const char *dirname, const char *substr, l_int32 numpre, l_int32 numpost );
LEPT_DLL extern l_int32 convertToPdfSegmented ( const char *filein, l_int32 res, l_int32 type, l_int32 thresh, BOXA *boxa, l_int32 quality, l_float32 scalefactor, const char *title, const char *fileout );
@@ -1260,7 +1279,17 @@ LEPT_DLL extern l_int32 saConcatenatePdf ( SARRAY *sa, const char *fileout );
LEPT_DLL extern l_int32 ptraConcatenatePdf ( L_PTRA *pa, const char *fileout );
LEPT_DLL extern l_int32 concatenatePdfToData ( const char *dirname, const char *substr, l_uint8 **pdata, size_t *pnbytes );
LEPT_DLL extern l_int32 saConcatenatePdfToData ( SARRAY *sa, l_uint8 **pdata, size_t *pnbytes );
+LEPT_DLL extern l_int32 pixConvertToPdfData ( PIX *pix, l_int32 type, l_int32 quality, l_uint8 **pdata, size_t *pnbytes, l_int32 x, l_int32 y, l_int32 res, const char *title, L_PDF_DATA **plpd, l_int32 position );
LEPT_DLL extern l_int32 ptraConcatenatePdfToData ( L_PTRA *pa_data, SARRAY *sa, l_uint8 **pdata, size_t *pnbytes );
+LEPT_DLL extern l_int32 l_generateCIDataForPdf ( const char *fname, PIX *pix, l_int32 quality, L_COMP_DATA **pcid );
+LEPT_DLL extern L_COMP_DATA * l_generateFlateDataPdf ( const char *fname );
+LEPT_DLL extern L_COMP_DATA * l_generateJpegData ( const char *fname, l_int32 ascii85flag );
+LEPT_DLL extern l_int32 l_generateCIData ( const char *fname, l_int32 type, l_int32 quality, l_int32 ascii85, L_COMP_DATA **pcid );
+LEPT_DLL extern l_int32 pixGenerateCIData ( PIX *pixs, l_int32 type, l_int32 quality, l_int32 ascii85, L_COMP_DATA **pcid );
+LEPT_DLL extern L_COMP_DATA * l_generateFlateData ( const char *fname, l_int32 ascii85flag );
+LEPT_DLL extern L_COMP_DATA * l_generateG4Data ( const char *fname, l_int32 ascii85flag );
+LEPT_DLL extern l_int32 cidConvertToPdfData ( L_COMP_DATA *cid, const char *title, l_uint8 **pdata, size_t *pnbytes );
+LEPT_DLL extern void l_CIDataDestroy ( L_COMP_DATA **pcid );
LEPT_DLL extern void l_pdfSetG4ImageMask ( l_int32 flag );
LEPT_DLL extern void l_pdfSetDateAndVersion ( l_int32 flag );
LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator ) ( size_t ) ), void ( ( *deallocator ) ( void * ) ) );
@@ -1435,10 +1464,11 @@ LEPT_DLL extern l_int32 pixColumnStats ( PIX *pixs, BOX *box, NUMA **pnamean, NU
LEPT_DLL extern l_int32 pixGetComponentRange ( PIX *pixs, l_int32 factor, l_int32 color, l_int32 *pminval, l_int32 *pmaxval );
LEPT_DLL extern l_int32 pixGetExtremeValue ( PIX *pixs, l_int32 factor, l_int32 type, l_int32 *prval, l_int32 *pgval, l_int32 *pbval, l_int32 *pgrayval );
LEPT_DLL extern l_int32 pixGetMaxValueInRect ( PIX *pixs, BOX *box, l_uint32 *pmaxval, l_int32 *pxmax, l_int32 *pymax );
-LEPT_DLL extern l_int32 pixGetBinnedComponentRange ( PIX *pixs, l_int32 nbins, l_int32 factor, l_int32 color, l_int32 *pminval, l_int32 *pmaxval, l_uint32 **pcarray, l_int32 debugflag );
-LEPT_DLL extern l_int32 pixGetRankColorArray ( PIX *pixs, l_int32 nbins, l_int32 type, l_int32 factor, l_uint32 **pcarray, l_int32 debugflag );
+LEPT_DLL extern l_int32 pixGetBinnedComponentRange ( PIX *pixs, l_int32 nbins, l_int32 factor, l_int32 color, l_int32 *pminval, l_int32 *pmaxval, l_uint32 **pcarray, const char *fontdir );
+LEPT_DLL extern l_int32 pixGetRankColorArray ( PIX *pixs, l_int32 nbins, l_int32 type, l_int32 factor, l_uint32 **pcarray, l_int32 debugflag, const char *fontdir );
LEPT_DLL extern l_int32 pixGetBinnedColor ( PIX *pixs, PIX *pixg, l_int32 factor, l_int32 nbins, NUMA *nalut, l_uint32 **pcarray, l_int32 debugflag );
-LEPT_DLL extern PIX * pixDisplayColorArray ( l_uint32 *carray, l_int32 ncolors, l_int32 side, l_int32 ncols, l_int32 textflag );
+LEPT_DLL extern PIX * pixDisplayColorArray ( l_uint32 *carray, l_int32 ncolors, l_int32 side, l_int32 ncols, const char *fontdir );
+LEPT_DLL extern PIX * pixRankBinByStrip ( PIX *pixs, l_int32 direction, l_int32 size, l_int32 nbins, l_int32 type );
LEPT_DLL extern PIX * pixaGetAlignedStats ( PIXA *pixa, l_int32 type, l_int32 nbins, l_int32 thresh );
LEPT_DLL extern l_int32 pixaExtractColumnFromEachPix ( PIXA *pixa, l_int32 col, PIX *pixd );
LEPT_DLL extern l_int32 pixGetRowStats ( PIX *pixs, l_int32 type, l_int32 nbins, l_int32 thresh, l_float32 *colvect );
@@ -1704,6 +1734,7 @@ LEPT_DLL extern PIX * pixConvertTo8Or32 ( PIX *pixs, l_int32 copyflag, l_int32 w
LEPT_DLL extern PIX * pixConvert24To32 ( PIX *pixs );
LEPT_DLL extern PIX * pixConvert32To24 ( PIX *pixs );
LEPT_DLL extern PIX * pixRemoveAlpha ( PIX *pixs );
+LEPT_DLL extern PIX * pixAddAlphaTo1bpp ( PIX *pixd, PIX *pixs );
LEPT_DLL extern PIX * pixConvertLossless ( PIX *pixs, l_int32 d );
LEPT_DLL extern PIX * pixConvertForPSWrap ( PIX *pixs );
LEPT_DLL extern PIX * pixConvertToSubpixelRGB ( PIX *pixs, l_float32 scalex, l_float32 scaley, l_int32 order );
@@ -1722,8 +1753,9 @@ LEPT_DLL extern l_int32 pixTilingPaintTile ( PIX *pixd, l_int32 i, l_int32 j, PI
LEPT_DLL extern PIX * pixReadStreamPng ( FILE *fp );
LEPT_DLL extern l_int32 readHeaderPng ( const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap );
LEPT_DLL extern l_int32 freadHeaderPng ( FILE *fp, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap );
-LEPT_DLL extern l_int32 sreadHeaderPng ( const l_uint8 *data, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap );
+LEPT_DLL extern l_int32 readHeaderMemPng ( const l_uint8 *data, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap );
LEPT_DLL extern l_int32 fgetPngResolution ( FILE *fp, l_int32 *pxres, l_int32 *pyres );
+LEPT_DLL extern l_int32 isPngInterlaced ( const char *filename, l_int32 *pinterlaced );
LEPT_DLL extern l_int32 pixWritePng ( const char *filename, PIX *pix, l_float32 gamma );
LEPT_DLL extern l_int32 pixWriteStreamPng ( FILE *fp, PIX *pix, l_float32 gamma );
LEPT_DLL extern l_int32 pixSetZlibCompression ( PIX *pix, l_int32 compval );
@@ -1736,7 +1768,7 @@ LEPT_DLL extern l_int32 freadHeaderPnm ( FILE *fp, l_int32 *pw, l_int32 *ph, l_i
LEPT_DLL extern l_int32 pixWriteStreamPnm ( FILE *fp, PIX *pix );
LEPT_DLL extern l_int32 pixWriteStreamAsciiPnm ( FILE *fp, PIX *pix );
LEPT_DLL extern PIX * pixReadMemPnm ( const l_uint8 *cdata, size_t size );
-LEPT_DLL extern l_int32 sreadHeaderPnm ( const l_uint8 *cdata, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pd, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp );
+LEPT_DLL extern l_int32 readHeaderMemPnm ( const l_uint8 *cdata, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pd, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp );
LEPT_DLL extern l_int32 pixWriteMemPnm ( l_uint8 **pdata, size_t *psize, PIX *pix );
LEPT_DLL extern PIX * pixProjectiveSampledPta ( PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor );
LEPT_DLL extern PIX * pixProjectiveSampled ( PIX *pixs, l_float32 *vc, l_int32 incolor );
@@ -1755,7 +1787,7 @@ LEPT_DLL extern l_int32 sarrayConvertFilesToPS ( SARRAY *sa, l_int32 res, const
LEPT_DLL extern l_int32 convertFilesFittedToPS ( const char *dirin, const char *substr, l_float32 xpts, l_float32 ypts, const char *fileout );
LEPT_DLL extern l_int32 sarrayConvertFilesFittedToPS ( SARRAY *sa, l_float32 xpts, l_float32 ypts, const char *fileout );
LEPT_DLL extern l_int32 writeImageCompressedToPSFile ( const char *filein, const char *fileout, l_int32 res, l_int32 *pfirstfile, l_int32 *pindex );
-LEPT_DLL extern l_int32 convertSegmentedPagesToPS ( const char *pagedir, const char *pagestr, const char *maskdir, const char *maskstr, l_int32 numpre, l_int32 numpost, l_int32 maxnum, l_float32 textscale, l_float32 imagescale, l_int32 threshold, const char *fileout );
+LEPT_DLL extern l_int32 convertSegmentedPagesToPS ( const char *pagedir, const char *pagestr, l_int32 page_numpre, const char *maskdir, const char *maskstr, l_int32 mask_numpre, l_int32 numpost, l_int32 maxnum, l_float32 textscale, l_float32 imagescale, l_int32 threshold, const char *fileout );
LEPT_DLL extern l_int32 pixWriteSegmentedPageToPS ( PIX *pixs, PIX *pixm, l_float32 textscale, l_float32 imagescale, l_int32 threshold, l_int32 pageno, const char *fileout );
LEPT_DLL extern l_int32 pixWriteMixedToPS ( PIX *pixb, PIX *pixc, l_float32 scale, l_int32 pageno, const char *fileout );
LEPT_DLL extern l_int32 convertToPSEmbed ( const char *filein, const char *fileout, l_int32 level );
@@ -1770,24 +1802,15 @@ LEPT_DLL extern l_int32 convertJpegToPSEmbed ( const char *filein, const char *f
LEPT_DLL extern l_int32 convertJpegToPS ( const char *filein, const char *fileout, const char *operation, l_int32 x, l_int32 y, l_int32 res, l_float32 scale, l_int32 pageno, l_int32 endpage );
LEPT_DLL extern l_int32 convertJpegToPSString ( const char *filein, char **poutstr, l_int32 *pnbytes, l_int32 x, l_int32 y, l_int32 res, l_float32 scale, l_int32 pageno, l_int32 endpage );
LEPT_DLL extern char * generateJpegPS ( const char *filein, L_COMP_DATA *cid, l_float32 xpt, l_float32 ypt, l_float32 wpt, l_float32 hpt, l_int32 pageno, l_int32 endpage );
-LEPT_DLL extern L_COMP_DATA * pixGenerateJpegData ( PIX *pixs, l_int32 ascii85flag, l_int32 quality );
-LEPT_DLL extern L_COMP_DATA * l_generateJpegData ( const char *fname, l_int32 ascii85flag );
-LEPT_DLL extern void l_compdataDestroy ( L_COMP_DATA **pcid );
LEPT_DLL extern l_int32 convertG4ToPSEmbed ( const char *filein, const char *fileout );
LEPT_DLL extern l_int32 convertG4ToPS ( const char *filein, const char *fileout, const char *operation, l_int32 x, l_int32 y, l_int32 res, l_float32 scale, l_int32 pageno, l_int32 maskflag, l_int32 endpage );
LEPT_DLL extern l_int32 convertG4ToPSString ( const char *filein, char **poutstr, l_int32 *pnbytes, l_int32 x, l_int32 y, l_int32 res, l_float32 scale, l_int32 pageno, l_int32 maskflag, l_int32 endpage );
LEPT_DLL extern char * generateG4PS ( const char *filein, L_COMP_DATA *cid, l_float32 xpt, l_float32 ypt, l_float32 wpt, l_float32 hpt, l_int32 maskflag, l_int32 pageno, l_int32 endpage );
-LEPT_DLL extern L_COMP_DATA * pixGenerateG4Data ( PIX *pixs, l_int32 ascii85flag );
-LEPT_DLL extern L_COMP_DATA * l_generateG4Data ( const char *fname, l_int32 ascii85flag );
LEPT_DLL extern l_int32 convertTiffMultipageToPS ( const char *filein, const char *fileout, const char *tempfile, l_float32 fillfract );
LEPT_DLL extern l_int32 convertFlateToPSEmbed ( const char *filein, const char *fileout );
LEPT_DLL extern l_int32 convertFlateToPS ( const char *filein, const char *fileout, const char *operation, l_int32 x, l_int32 y, l_int32 res, l_float32 scale, l_int32 pageno, l_int32 endpage );
LEPT_DLL extern l_int32 convertFlateToPSString ( const char *filein, char **poutstr, l_int32 *pnbytes, l_int32 x, l_int32 y, l_int32 res, l_float32 scale, l_int32 pageno, l_int32 endpage );
LEPT_DLL extern char * generateFlatePS ( const char *filein, L_COMP_DATA *cid, l_float32 xpt, l_float32 ypt, l_float32 wpt, l_float32 hpt, l_int32 pageno, l_int32 endpage );
-LEPT_DLL extern L_COMP_DATA * l_generateFlateData ( const char *fname, l_int32 ascii85flag );
-LEPT_DLL extern L_COMP_DATA * pixGenerateFlateData ( PIX *pixs, l_int32 ascii85flag );
-LEPT_DLL extern l_int32 l_generateCIData ( const char *fname, l_int32 type, l_int32 quality, l_int32 ascii85, L_COMP_DATA **pcid );
-LEPT_DLL extern l_int32 pixGenerateCIData ( PIX *pixs, l_int32 type, l_int32 quality, l_int32 ascii85, L_COMP_DATA **pcid );
LEPT_DLL extern l_int32 pixWriteMemPS ( l_uint8 **pdata, size_t *psize, PIX *pix, BOX *box, l_int32 res, l_float32 scale );
LEPT_DLL extern l_int32 getResLetterPage ( l_int32 w, l_int32 h, l_float32 fillfract );
LEPT_DLL extern l_int32 getResA4Page ( l_int32 w, l_int32 h, l_float32 fillfract );
@@ -1897,7 +1920,7 @@ LEPT_DLL extern BOXAA * boxaaQuadtreeRegions ( l_int32 w, l_int32 h, l_int32 nle
LEPT_DLL extern l_int32 quadtreeGetParent ( FPIXA *fpixa, l_int32 level, l_int32 x, l_int32 y, l_float32 *pval );
LEPT_DLL extern l_int32 quadtreeGetChildren ( FPIXA *fpixa, l_int32 level, l_int32 x, l_int32 y, l_float32 *pval00, l_float32 *pval10, l_float32 *pval01, l_float32 *pval11 );
LEPT_DLL extern l_int32 quadtreeMaxLevels ( l_int32 w, l_int32 h );
-LEPT_DLL extern PIX * fpixaDisplayQuadtree ( FPIXA *fpixa, l_int32 factor );
+LEPT_DLL extern PIX * fpixaDisplayQuadtree ( FPIXA *fpixa, l_int32 factor, const char *fontdir );
LEPT_DLL extern L_QUEUE * lqueueCreate ( l_int32 nalloc );
LEPT_DLL extern void lqueueDestroy ( L_QUEUE **plq, l_int32 freeflag );
LEPT_DLL extern l_int32 lqueueAdd ( L_QUEUE *lq, void *item );
@@ -2056,12 +2079,6 @@ LEPT_DLL extern PIX * pixRotate180 ( PIX *pixd, PIX *pixs );
LEPT_DLL extern PIX * pixRotate90 ( PIX *pixs, l_int32 direction );
LEPT_DLL extern PIX * pixFlipLR ( PIX *pixd, PIX *pixs );
LEPT_DLL extern PIX * pixFlipTB ( PIX *pixd, PIX *pixs );
-LEPT_DLL extern void rotate90Low ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 d, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 direction );
-LEPT_DLL extern void flipLRLow ( l_uint32 *data, l_int32 w, l_int32 h, l_int32 d, l_int32 wpl, l_uint8 *tab, l_uint32 *buffer );
-LEPT_DLL extern void flipTBLow ( l_uint32 *data, l_int32 h, l_int32 wpl, l_uint32 *buffer );
-LEPT_DLL extern l_uint8 * makeReverseByteTab1 ( void );
-LEPT_DLL extern l_uint8 * makeReverseByteTab2 ( void );
-LEPT_DLL extern l_uint8 * makeReverseByteTab4 ( void );
LEPT_DLL extern PIX * pixRotateShear ( PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor );
LEPT_DLL extern PIX * pixRotate2Shear ( PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor );
LEPT_DLL extern PIX * pixRotate3Shear ( PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor );
@@ -2072,6 +2089,9 @@ LEPT_DLL extern PIX * pixStrokeWidthTransform ( PIX *pixs, l_int32 color, l_int3
LEPT_DLL extern PIX * pixRunlengthTransform ( PIX *pixs, l_int32 color, l_int32 direction, l_int32 depth );
LEPT_DLL extern l_int32 pixFindHorizontalRuns ( PIX *pix, l_int32 y, l_int32 *xstart, l_int32 *xend, l_int32 *pn );
LEPT_DLL extern l_int32 pixFindVerticalRuns ( PIX *pix, l_int32 x, l_int32 *ystart, l_int32 *yend, l_int32 *pn );
+LEPT_DLL extern NUMA * pixFindMaxRuns ( PIX *pix, l_int32 direction, NUMA **pnastart );
+LEPT_DLL extern l_int32 pixFindMaxHorizontalRunOnLine ( PIX *pix, l_int32 y, l_int32 *pxstart, l_int32 *psize );
+LEPT_DLL extern l_int32 pixFindMaxVerticalRunOnLine ( PIX *pix, l_int32 x, l_int32 *pystart, l_int32 *psize );
LEPT_DLL extern l_int32 runlengthMembershipOnLine ( l_int32 *buffer, l_int32 size, l_int32 depth, l_int32 *start, l_int32 *end, l_int32 n );
LEPT_DLL extern l_int32 * makeMSBitLocTab ( l_int32 bitval );
LEPT_DLL extern SARRAY * sarrayCreate ( l_int32 n );
@@ -2124,7 +2144,7 @@ LEPT_DLL extern PIX * pixScaleGray2xLI ( PIX *pixs );
LEPT_DLL extern PIX * pixScaleGray4xLI ( PIX *pixs );
LEPT_DLL extern PIX * pixScaleBySampling ( PIX *pixs, l_float32 scalex, l_float32 scaley );
LEPT_DLL extern PIX * pixScaleBySamplingToSize ( PIX *pixs, l_int32 wd, l_int32 hd );
-LEPT_DLL extern PIX * pixScaleByIntSubsampling ( PIX *pixs, l_int32 factor );
+LEPT_DLL extern PIX * pixScaleByIntSampling ( PIX *pixs, l_int32 factor );
LEPT_DLL extern PIX * pixScaleRGBToGrayFast ( PIX *pixs, l_int32 factor, l_int32 color );
LEPT_DLL extern PIX * pixScaleRGBToBinaryFast ( PIX *pixs, l_int32 factor, l_int32 thresh );
LEPT_DLL extern PIX * pixScaleGrayToBinaryFast ( PIX *pixs, l_int32 factor, l_int32 thresh );
@@ -2349,6 +2369,7 @@ LEPT_DLL extern l_int32 stringCopy ( char *dest, const char *src, l_int32 n );
LEPT_DLL extern l_int32 stringReplace ( char **pdest, const char *src );
LEPT_DLL extern l_int32 stringLength ( const char *src, size_t size );
LEPT_DLL extern l_int32 stringCat ( char *dest, size_t size, const char *src );
+LEPT_DLL extern char * stringConcatNew ( const char *first, ... );
LEPT_DLL extern char * stringJoin ( const char *src1, const char *src2 );
LEPT_DLL extern char * stringReverse ( const char *src );
LEPT_DLL extern char * strtokSafe ( char *cstr, const char *seps, char **psaveptr );
@@ -2357,11 +2378,13 @@ LEPT_DLL extern char * stringRemoveChars ( const char *src, const char *remchars
LEPT_DLL extern l_int32 stringFindSubstr ( const char *src, const char *sub, l_int32 *ploc );
LEPT_DLL extern char * stringReplaceSubstr ( const char *src, const char *sub1, const char *sub2, l_int32 *pfound, l_int32 *ploc );
LEPT_DLL extern char * stringReplaceEachSubstr ( const char *src, const char *sub1, const char *sub2, l_int32 *pcount );
-LEPT_DLL extern L_DNA * arrayFindEachSequence ( const l_uint8 *data, l_int32 datalen, const l_uint8 *sequence, l_int32 seqlen );
-LEPT_DLL extern l_int32 arrayFindSequence ( const l_uint8 *data, l_int32 datalen, const l_uint8 *sequence, l_int32 seqlen, l_int32 *poffset, l_int32 *pfound );
+LEPT_DLL extern L_DNA * arrayFindEachSequence ( const l_uint8 *data, size_t datalen, const l_uint8 *sequence, size_t seqlen );
+LEPT_DLL extern l_int32 arrayFindSequence ( const l_uint8 *data, size_t datalen, const l_uint8 *sequence, size_t seqlen, l_int32 *poffset, l_int32 *pfound );
LEPT_DLL extern void * reallocNew ( void **pindata, l_int32 oldsize, l_int32 newsize );
LEPT_DLL extern l_uint8 * l_binaryRead ( const char *filename, size_t *pnbytes );
LEPT_DLL extern l_uint8 * l_binaryReadStream ( FILE *fp, size_t *pnbytes );
+LEPT_DLL extern l_uint8 * l_binaryReadSelect ( const char *filename, size_t start, size_t nbytes, size_t *pnread );
+LEPT_DLL extern l_uint8 * l_binaryReadSelectStream ( FILE *fp, size_t start, size_t nbytes, size_t *pnread );
LEPT_DLL extern l_int32 l_binaryWrite ( const char *filename, const char *operation, void *data, size_t nbytes );
LEPT_DLL extern size_t nbytesInFile ( const char *filename );
LEPT_DLL extern size_t fnbytesInFile ( FILE *fp );
@@ -2382,18 +2405,24 @@ LEPT_DLL extern void * lept_calloc ( size_t nmemb, size_t size );
LEPT_DLL extern void lept_free ( void *ptr );
LEPT_DLL extern l_int32 lept_mkdir ( const char *subdir );
LEPT_DLL extern l_int32 lept_rmdir ( const char *subdir );
-LEPT_DLL extern void lept_direxists ( const char *dirname, l_int32 *pexists );
-LEPT_DLL extern l_int32 lept_rm ( const char *subdir, const char *filename );
-LEPT_DLL extern l_int32 lept_mv ( const char *srcfile, const char *newfile );
-LEPT_DLL extern l_int32 lept_cp ( const char *srcfile, const char *newfile );
+LEPT_DLL extern void lept_direxists ( const char *dir, l_int32 *pexists );
+LEPT_DLL extern l_int32 lept_rm_match ( const char *subdir, const char *substr );
+LEPT_DLL extern l_int32 lept_rm ( const char *subdir, const char *tail );
+LEPT_DLL extern l_int32 lept_rmfile ( const char *filepath );
+LEPT_DLL extern l_int32 lept_mv ( const char *srcfile, const char *newdir, const char *newtail, char **pnewpath );
+LEPT_DLL extern l_int32 lept_cp ( const char *srcfile, const char *newdir, const char *newtail, char **pnewpath );
LEPT_DLL extern l_int32 splitPathAtDirectory ( const char *pathname, char **pdir, char **ptail );
LEPT_DLL extern l_int32 splitPathAtExtension ( const char *pathname, char **pbasename, char **pextension );
LEPT_DLL extern char * pathJoin ( const char *dir, const char *fname );
+LEPT_DLL extern char * appendSubdirectory ( const char *dir, const char *subdir );
+LEPT_DLL extern l_int32 convertSepCharsInPath ( char *path, l_int32 type );
LEPT_DLL extern char * genPathname ( const char *dir, const char *fname );
LEPT_DLL extern l_int32 makeTempDirname ( char *result, size_t nbytes, const char *subdir );
+LEPT_DLL extern l_int32 modifyTrailingSlash ( char *path, size_t nbytes, l_int32 flag );
LEPT_DLL extern char * genTempFilename ( const char *dir, const char *tail, l_int32 usetime, l_int32 usepid );
LEPT_DLL extern l_int32 extractNumberFromFilename ( const char *fname, l_int32 numpre, l_int32 numpost );
LEPT_DLL extern l_int32 fileCorruptByDeletion ( const char *filein, l_float32 loc, l_float32 size, const char *fileout );
+LEPT_DLL extern l_int32 fileCorruptByMutation ( const char *filein, l_float32 loc, l_float32 size, const char *fileout );
LEPT_DLL extern l_int32 genRandomIntegerInRange ( l_int32 range, l_int32 seed, l_int32 *pval );
LEPT_DLL extern l_int32 lept_roundftoi ( l_float32 fval );
LEPT_DLL extern l_uint32 convertBinaryToGrayCode ( l_uint32 val );
@@ -2425,6 +2454,7 @@ LEPT_DLL extern PIX * wshedRenderColors ( L_WSHED *wshed );
LEPT_DLL extern PIX * pixReadStreamWebP ( FILE *fp );
LEPT_DLL extern PIX * pixReadMemWebP ( const l_uint8 *filedata, size_t filesize );
LEPT_DLL extern l_int32 readHeaderWebP ( const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pspp );
+LEPT_DLL extern l_int32 readHeaderMemWebP ( const l_uint8 *data, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pspp );
LEPT_DLL extern l_int32 pixWriteWebP ( const char *filename, PIX *pixs, l_int32 quality, l_int32 lossless );
LEPT_DLL extern l_int32 pixWriteStreamWebP ( FILE *fp, PIX *pixs, l_int32 quality, l_int32 lossless );
LEPT_DLL extern l_int32 pixWriteMemWebP ( l_uint8 **pencdata, size_t *pencsize, PIX *pixs, l_int32 quality, l_int32 lossless );
diff --git a/TesseractOCR/include/leptonica/config_auto.h b/TesseractOCR/include/leptonica/config_auto.h
index 675e4b40..dca99c0a 100644
--- a/TesseractOCR/include/leptonica/config_auto.h
+++ b/TesseractOCR/include/leptonica/config_auto.h
@@ -16,6 +16,9 @@
/* Define to 1 if you have giflib. */
/* #undef HAVE_LIBGIF */
+/* Define to 1 if you have libopenjp2. */
+/* #undef HAVE_LIBJP2K */
+
/* Define to 1 if you have jpeg. */
/* #undef HAVE_LIBJPEG */
@@ -69,7 +72,7 @@
#define PACKAGE_NAME "leptonica"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "leptonica 1.70"
+#define PACKAGE_STRING "leptonica 1.71"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "leptonica"
@@ -78,13 +81,13 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.70"
+#define PACKAGE_VERSION "1.71"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
-#define VERSION "1.70"
+#define VERSION "1.71"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
diff --git a/TesseractOCR/include/leptonica/dewarp.h b/TesseractOCR/include/leptonica/dewarp.h
index 79792664..f390c527 100644
--- a/TesseractOCR/include/leptonica/dewarp.h
+++ b/TesseractOCR/include/leptonica/dewarp.h
@@ -91,7 +91,7 @@
* In most situations, the serialized version is ephemeral -- it is
* not needed after being used. No functions will be provided to
* convert between different versions. */
-#define DEWARP_VERSION_NUMBER 3
+#define DEWARP_VERSION_NUMBER 4
struct L_Dewarpa
{
@@ -113,6 +113,8 @@ struct L_Dewarpa
/* in micro-units */
l_int32 max_diff_linecurv; /* maximum abs diff line curvature */
/* in micro-units */
+ l_int32 max_edgeslope; /* maximum abs left or right edge */
+ /* slope, in milli-units */
l_int32 max_edgecurv; /* maximum abs left or right edge */
/* curvature, in micro-units */
l_int32 max_diff_edgecurv; /* maximum abs diff left-right */
@@ -144,6 +146,8 @@ struct L_Dewarp
l_int32 nlines; /* number of long lines found */
l_int32 mincurv; /* min line curvature in micro-units */
l_int32 maxcurv; /* max line curvature in micro-units */
+ l_int32 leftslope; /* left edge slope in milli-units */
+ l_int32 rightslope; /* right edge slope in milli-units */
l_int32 leftcurv; /* left edge curvature in micro-units */
l_int32 rightcurv; /* right edge curvature in micro-units */
l_int32 nx; /* number of sampling pts in x-dir */
diff --git a/TesseractOCR/include/leptonica/environ.h b/TesseractOCR/include/leptonica/environ.h
index c2ff9f69..f7d70a53 100644
--- a/TesseractOCR/include/leptonica/environ.h
+++ b/TesseractOCR/include/leptonica/environ.h
@@ -93,8 +93,8 @@ typedef void *L_TIMER;
* Manual Configuration Only: NOT AUTO_CONF *
*--------------------------------------------------------------------*/
/*
- * Leptonica provides interfaces to link to five external image I/O
- * libraries, plus zlib. Setting any of these to 0 here causes
+ * Leptonica provides interfaces to link to several external image
+ * I/O libraries, plus zlib. Setting any of these to 0 here causes
* non-functioning stubs to be linked.
*/
#ifndef HAVE_CONFIG_H
@@ -105,6 +105,7 @@ typedef void *L_TIMER;
#define HAVE_LIBGIF 0
#define HAVE_LIBUNGIF 0
#define HAVE_LIBWEBP 0
+#define HAVE_LIBJP2K 0
#endif /* ~HAVE_CONFIG_H */
/*
@@ -125,15 +126,18 @@ typedef void *L_TIMER;
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*
* USER CONFIGURABLE *
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*
- * Environ variables for uncompressed formatted image I/O *
+ * Environ variables for image I/O without external libraries *
*--------------------------------------------------------------------*/
/*
- * Leptonica supplies image I/O for bmp, pnm, jp2k, pdf and ps.
+ * Leptonica supplies I/O support without using external libraries for:
+ * * image read/write for bmp, pnm
+ * * header read for jp2k
+ * * image wrapping write for pdf and ps.
* Setting any of these to 0 causes non-functioning stubs to be linked.
*/
#define USE_BMPIO 1
#define USE_PNMIO 1
-#define USE_JP2KIO 1
+#define USE_JP2KHEADER 1
#define USE_PDFIO 1
#define USE_PSIO 1
@@ -217,6 +221,15 @@ enum {
};
+/*------------------------------------------------------------------------*
+ * Path separator conversion *
+ *------------------------------------------------------------------------*/
+enum {
+ UNIX_PATH_SEPCHAR = 0,
+ WIN_PATH_SEPCHAR = 1
+};
+
+
/*------------------------------------------------------------------------*
* Standard memory allocation *
* *
diff --git a/TesseractOCR/include/leptonica/imageio.h b/TesseractOCR/include/leptonica/imageio.h
index 4e0332c7..7ec420ac 100644
--- a/TesseractOCR/include/leptonica/imageio.h
+++ b/TesseractOCR/include/leptonica/imageio.h
@@ -24,6 +24,45 @@
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*====================================================================*/
+/*
+ * General features of image I/O in leptonica
+ *
+ * At present, there are 9 file formats for images that can be read
+ * and written:
+ * png (requires libpng, libz)
+ * jpeg (requires libjpeg)
+ * tiff (requires libtiff, libz)
+ * gif (requires libgif)
+ * webp (requires libwebp)
+ * jp2 (requires libopenjp2)
+ * bmp (no library required)
+ * pnm (no library required)
+ * spix (no library required)
+ * Additionally, there are two file formats for writing (only) images:
+ * PostScript (requires libpng, libz, libjpeg, libtiff)
+ * pdf (requires libpng, libz, libjpeg, libtiff)
+ *
+ * For all 9 read/write formats, leptonica provides interconversion
+ * between pix (with raster data) and formatted image data:
+ * Conversion from pix (typically compression):
+ * pixWrite(): pix --> file
+ * pixWriteStream(): pix --> filestream (aka FILE*)
+ * pixWriteMem(): pix --> memory buffer
+ * Conversion to pix (typically decompression):
+ * pixRead(): file --> pix
+ * pixReadStream(): filestream --> pix
+ * pixReadMem(): memory buffer --> pix
+ *
+ * Conversions for which the image data is not compressed are:
+ * * uncompressed tiff (IFF_TIFF)
+ * * bmp
+ * * pnm
+ * * spix (fast serialization that copies the pix raster data)
+ *
+ * The image header (metadata) information can be read from either
+ * the compressed file or a memory buffer, for all 9 formats.
+ */
+
#ifndef LEPTONICA_IMAGEIO_H
#define LEPTONICA_IMAGEIO_H
@@ -73,9 +112,10 @@ enum {
};
-/* ------------------ Gray hinting in jpeg reader --------------- */
+/* ------------- Hinting bit flags in jpeg reader --------------- */
enum {
- L_HINT_GRAY = 1, /* only want grayscale information */
+ L_JPEG_READ_LUMINANCE = 1, /* only want luminance data; no chroma */
+ L_JPEG_FAIL_ON_BAD_DATA = 2 /* don't return possibly damaged pix */
};
@@ -114,6 +154,7 @@ struct L_Compressed_Data
l_int32 bps; /* bits/sample; typ. 1, 2, 4 or 8 */
l_int32 spp; /* samples/pixel; typ. 1 or 3 */
l_int32 minisblack; /* tiff g4 photometry */
+ l_int32 predictor; /* flate data has PNG predictors */
size_t nbytes; /* number of uncompressed raster bytes */
l_int32 res; /* resolution (ppi) */
};
diff --git a/TesseractOCR/include/leptonica/pix.h b/TesseractOCR/include/leptonica/pix.h
index 0c599da8..0eb4d3c9 100644
--- a/TesseractOCR/include/leptonica/pix.h
+++ b/TesseractOCR/include/leptonica/pix.h
@@ -92,20 +92,23 @@
* Line orientation flags
* Scan direction flags
* Box size adjustment flags
+ * Flags for selecting box boundaries from two choices
* Handling overlapping bounding boxes in boxa
* Horizontal warp
* Pixel selection for resampling
* Thinning flags
* Runlength flags
* Edge filter flags
- * Handling negative values in conversion to unsigned int
* Subpixel color component ordering in LCD display
- * Relative to zero flags
* HSV histogram flags
* Region flags (inclusion, exclusion)
* Flags for adding text to a pix
+ * Flags for plotting on a pix
* Flags for selecting display program
* Flags in the 'special' pix field for non-default operations
+ * Handling negative values in conversion to unsigned int
+ * Relative to zero flags
+ * Flags for adding or removing traling slash from string *
*/
@@ -324,7 +327,7 @@ enum {
* colors are ordered from MSB to LSB, as follows:
*
* | MSB | 2nd MSB | 3rd MSB | LSB |
- * red green blue alpha
+ * red green blue alpha
* 0 1 2 3 (big-endian)
* 3 2 1 0 (little-endian)
*
@@ -728,7 +731,8 @@ enum {
L_SELECT_GREEN = 2, /* use green component */
L_SELECT_BLUE = 3, /* use blue component */
L_SELECT_MIN = 4, /* use min color component */
- L_SELECT_MAX = 5 /* use max color component */
+ L_SELECT_MAX = 5, /* use max color component */
+ L_SELECT_AVERAGE = 6 /* use average of color components */
};
@@ -900,7 +904,9 @@ enum {
L_FROM_BOT = 3, /* scan from bottom */
L_SCAN_NEGATIVE = 4, /* scan in negative direction */
L_SCAN_POSITIVE = 5, /* scan in positive direction */
- L_SCAN_BOTH = 6 /* scan in both directions */
+ L_SCAN_BOTH = 6, /* scan in both directions */
+ L_SCAN_HORIZONTAL = 7, /* horizontal scan (direction unimportant) */
+ L_SCAN_VERTICAL = 8 /* vertical scan (direction unimportant) */
};
@@ -928,6 +934,15 @@ enum {
};
+/*-------------------------------------------------------------------------*
+ * Flags for selecting box boundaries from two choices *
+ *-------------------------------------------------------------------------*/
+enum {
+ L_USE_MINSIZE = 1, /* use boundaries giving min size */
+ L_USE_MAXSIZE = 2, /* use boundaries giving max size */
+ L_SUB_ON_BIG_DIFF = 3 /* substitute boundary if big abs diff */
+};
+
/*-------------------------------------------------------------------------*
* Handling overlapping bounding boxes in boxa *
*-------------------------------------------------------------------------*/
@@ -986,15 +1001,6 @@ enum {
};
-/*-------------------------------------------------------------------------*
- * Handling negative values in conversion to unsigned int *
- *-------------------------------------------------------------------------*/
-enum {
- L_CLIP_TO_ZERO = 1, /* Clip negative values to 0 */
- L_TAKE_ABSVAL = 2 /* Convert to positive using L_ABS() */
-};
-
-
/*-------------------------------------------------------------------------*
* Subpixel color component ordering in LCD display *
*-------------------------------------------------------------------------*/
@@ -1006,16 +1012,6 @@ enum {
};
-/*-------------------------------------------------------------------------*
- * Relative to zero flags *
- *-------------------------------------------------------------------------*/
-enum {
- L_LESS_THAN_ZERO = 1, /* Choose values less than zero */
- L_EQUAL_TO_ZERO = 2, /* Choose values equal to zero */
- L_GREATER_THAN_ZERO = 3 /* Choose values greater than zero */
-};
-
-
/*-------------------------------------------------------------------------*
* HSV histogram flags *
*-------------------------------------------------------------------------*/
@@ -1050,6 +1046,19 @@ enum {
};
+/*-------------------------------------------------------------------------*
+ * Flags for plotting on a pix *
+ *-------------------------------------------------------------------------*/
+enum {
+ L_PLOT_AT_TOP = 1, /* Plot horizontally at top */
+ L_PLOT_AT_MID_HORIZ = 2, /* Plot horizontally at middle */
+ L_PLOT_AT_BOT = 3, /* Plot horizontally at bottom */
+ L_PLOT_AT_LEFT = 4, /* Plot vertically at left */
+ L_PLOT_AT_MID_VERT = 5, /* Plot vertically at middle */
+ L_PLOT_AT_RIGHT = 6 /* Plot vertically at right */
+};
+
+
/*-------------------------------------------------------------------------*
* Flags for selecting display program *
*-------------------------------------------------------------------------*/
@@ -1070,4 +1079,33 @@ enum {
L_NO_CHROMA_SAMPLING_JPEG = 1 /* Write full resolution chroma */
};
+
+/*-------------------------------------------------------------------------*
+ * Handling negative values in conversion to unsigned int *
+ *-------------------------------------------------------------------------*/
+enum {
+ L_CLIP_TO_ZERO = 1, /* Clip negative values to 0 */
+ L_TAKE_ABSVAL = 2 /* Convert to positive using L_ABS() */
+};
+
+
+/*-------------------------------------------------------------------------*
+ * Relative to zero flags *
+ *-------------------------------------------------------------------------*/
+enum {
+ L_LESS_THAN_ZERO = 1, /* Choose values less than zero */
+ L_EQUAL_TO_ZERO = 2, /* Choose values equal to zero */
+ L_GREATER_THAN_ZERO = 3 /* Choose values greater than zero */
+};
+
+
+/*-------------------------------------------------------------------------*
+ * Flags for adding or removing traling slash from string *
+ *-------------------------------------------------------------------------*/
+enum {
+ L_ADD_TRAIL_SLASH = 1, /* Add trailing slash to string */
+ L_REMOVE_TRAIL_SLASH = 2 /* Remove trailing slash from string */
+};
+
+
#endif /* LEPTONICA_PIX_H */
diff --git a/TesseractOCR/include/tesseract/config_auto.h b/TesseractOCR/include/tesseract/config_auto.h
new file mode 100644
index 00000000..3d7afa70
--- /dev/null
+++ b/TesseractOCR/include/tesseract/config_auto.h
@@ -0,0 +1,168 @@
+/* config_auto.h. Generated from config.h.in by configure. */
+/* config/config.h.in. Generated from configure.ac by autoheader. */
+
+
+#ifndef CONFIG_AUTO_H
+#define CONFIG_AUTO_H
+/* config_auto.h: begin */
+
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Disable graphics */
+/* #undef GRAPHICS_DISABLED */
+
+/* Define to 1 if you have the header file. */
+/* #undef HAVE_CAIRO_CAIRO_VERSION_H */
+
+/* Define to 1 if you have the header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `lept' library (-llept). */
+#define HAVE_LIBLEPT 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if the system has the type `long long int'. */
+#define HAVE_LONG_LONG_INT 1
+
+/* Define to 1 if you have the header file. */
+/* #undef HAVE_MALLOC_H */
+
+/* Define to 1 if the system has the type `mbstate_t'. */
+#define HAVE_MBSTATE_T 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the header file.
+ */
+/* #undef HAVE_PANGO_1_0_PANGO_PANGO_FEATURES_H */
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#define HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_SYS_IPC_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_SYS_SHM_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have that is POSIX.1 compatible. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_UNICODE_UCHAR_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if the system has the type `wchar_t'. */
+#define HAVE_WCHAR_T 1
+
+/* Define to 1 if the system has the type `_Bool'. */
+/* #undef HAVE__BOOL */
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* This is a MinGW system */
+/* #undef MINGW */
+
+/* Name of package */
+#define PACKAGE "tesseract"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "http://code.google.com/p/tesseract-ocr/issues/list"
+
+/* Official date of release */
+#define PACKAGE_DATE "01/14"
+
+/* Name of package */
+#define PACKAGE_NAME "tesseract"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "tesseract 3.03"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "tesseract"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Version number */
+#define PACKAGE_VERSION "3.03"
+
+/* Official year for this release */
+#define PACKAGE_YEAR "2014"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both and . */
+#define TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define VERSION "3.03"
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* # undef WORDS_BIGENDIAN */
+# endif
+#endif
+
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+
+
+/* Miscellaneous defines */
+#define AUTOCONF 1
+
+/* Not used yet
+#ifndef NO_GETTEXT
+#define USING_GETTEXT
+#endif
+*/
+
+/* config_auto.h: end */
+#endif
+
diff --git a/TesseractOCR/lib/liblept.a b/TesseractOCR/lib/liblept.a
index 0b15ba1c..e4ea9c56 100644
Binary files a/TesseractOCR/lib/liblept.a and b/TesseractOCR/lib/liblept.a differ
diff --git a/TesseractOCR/lib/libtesseract_all.a b/TesseractOCR/lib/libtesseract_all.a
index f22ca5aa..cb41f8fb 100644
Binary files a/TesseractOCR/lib/libtesseract_all.a and b/TesseractOCR/lib/libtesseract_all.a differ
diff --git a/TesseractOCRiOS.podspec b/TesseractOCRiOS.podspec
index aed867eb..d23e1380 100644
--- a/TesseractOCRiOS.podspec
+++ b/TesseractOCRiOS.podspec
@@ -1,36 +1,29 @@
Pod::Spec.new do |s|
- s.name = 'TesseractOCRiOS'
- s.version = '3.1'
-
- s.summary = 'It helps you to use OCR in iOS projects, writing Objective-C. Easy and fast.'
-
- s.homepage = 'https://github.com/gali8/Tesseract-OCR-iOS'
- s.documentation_url = 'https://github.com/gali8/Tesseract-OCR-iOS/blob/master/README.md'
-
- s.license = {
- :type => 'MIT',
- :text => <<-LICENSE
- Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
- LICENSE
- }
-
- s.author = { 'Daniele Galiotto' => 'genius@g8production.com' }
- s.source = { :git => 'https://github.com/gali8/Tesseract-OCR-iOS.git', :tag => s.version.to_s }
-
- s.platform = :ios, '5.0'
- s.source_files = 'TesseractOCR/*.{h,a}', 'TesseractOCR/**/*.{h,a}'
- s.requires_arc = true
-
+ s.name = 'TesseractOCRiOS'
+ s.version = '3.1.1'
+
+ s.summary = 'Use Tesseract OCR in iOS projects written in either Objective-C or Swift.'
+
+ s.homepage = 'https://github.com/gali8/Tesseract-OCR-iOS'
+ s.documentation_url = 'https://github.com/gali8/Tesseract-OCR-iOS/blob/master/README.md'
+
+ s.license = { :type => 'MIT',
+ :file => 'LICENSE.md' }
+
+ s.authors = { 'Daniele Galiotto' => 'genius@g8production.com',
+ 'Kevin Conley' => 'kcon@stanford.edu'}
+
+ s.source = { :git => 'https://github.com/gali8/Tesseract-OCR-iOS.git', :tag => s.version.to_s }
+
+ s.platform = :ios, "7.0"
+ s.source_files = 'TesseractOCR/*.h', 'TesseractOCR/include/**/*.h'
+ s.requires_arc = true
s.frameworks = 'UIKit', 'Foundation'
+
+ s.ios.deployment_target = "7.0"
+ s.ios.vendored_library = 'TesseractOCR/lib/*.a'
s.ios.vendored_frameworks = 'Products/TesseractOCR.framework'
- s.xcconfig = { 'OTHER_LDFLAGS' => '-lstdc++ -weak_library /usr/lib/libstdc++.6.0.9.dylib', 'CLANG_CXX_LIBRARY' => 'compiler-default' }
+ s.xcconfig = { 'OTHER_LDFLAGS' => '-lstdc++ -weak_library /usr/lib/libstdc++.6.0.9.dylib',
+ 'CLANG_CXX_LIBRARY' => 'compiler-default' }
end