Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
Clone or download
DanBloomberg Prepare for release 1.77.0. Updated documentation.
* highlevel.html, READEME.html, version-notes.html, comments
  in several utility files (fpix numa, pta, utils).
Latest commit 59cb50f Dec 14, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmake Add quotes to correctly handle dirs with spaces. Apr 15, 2018
prog Add new function for determining if box sizes are essentially the same. Dec 4, 2018
src Prepare for release 1.77.0. Updated documentation. Dec 14, 2018
.gitignore Ignore .trs test result files Jan 29, 2018
.travis.yml Update .travis.yml Mar 3, 2018
CMakeLists.txt Uses CMAKE_CURRENT_ variables intead of CMAKE_ globals Oct 30, 2018
Doxyfile Prepare for release 1.77.0. Updated documentation. Dec 14, 2018
Makefile.am Following a suggestion from @zdenop, rename autobuild --> autogen.sh Jun 12, 2018
README.html Prepare for release 1.77.0. Updated documentation. Dec 14, 2018
README.md Add LGTM.com code quality badges Aug 30, 2018
appveyor.yml Update appveyor.yml Sep 12, 2017
autogen.sh Following a suggestion from @zdenop, rename autobuild --> autogen.sh Jun 12, 2018
configure.ac Set next version number to 1.77.0. Jun 1, 2018
cppan.yml Update sw script. Nov 19, 2018
lept.pc.cmake Fix missed $ Apr 20, 2017
lept.pc.in Add leptonica 1.71. Jan 14, 2016
leptonica-license.txt Several changes Sep 17, 2016
lok.lua Introduce `l_ok' return type for OK / error results. May 30, 2018
make-for-auto Miscellaneous fixes, including changes to static makefiles Feb 6, 2016
make-for-local Miscellaneous fixes, including changes to static makefiles Feb 6, 2016
moller52.jpg Add leptonica 1.42. Jan 14, 2016
style-guide.txt Modified recog to allow either DID or greedy splitting of characters. Feb 1, 2017
sw.cpp Update sw script. Nov 19, 2018
version-notes.html Prepare for release 1.77.0. Updated documentation. Dec 14, 2018

README.md

Leptonica Library

Build Status Build status Coverity Scan Build Status Code Quality: Cpp Total Alerts

www.leptonica.org

The library supports many operations that are useful on

  • Document images
  • Natural images

Fundamental image processing and image analysis operations

  • Rasterop (aka bitblt)
  • Affine transforms (scaling, translation, rotation, shear) on images of arbitrary pixel depth
  • Projective and bilinear transforms
  • Binary and grayscale morphology, rank order filters, and convolution
  • Seedfill and connected components
  • Image transformations with changes in pixel depth, both at the same scale and with scale change
  • Pixelwise masking, blending, enhancement, arithmetic ops, etc.

Ancillary utilities

  • I/O for standard image formats (jpg, png, tiff, webp, jp2, bmp, pnm, gif, ps, pdf)
  • Utilities to handle arrays of image-related data types (e.g., pixa, boxa, pta)
  • Utilities for stacks, generic arrays, queues, heaps, lists; number and string arrays; etc.

Examples of some applications enabled and implemented

  • Octcube-based color quantization (w/ and w/out dithering)
  • Modified median cut color quantization (w/ and w/out dithering)
  • Skew determination of text images
  • Adaptive normalization and binarization
  • Segmentation of page images with mixed text and images
  • Location of baselines and local skew determination
  • jbig2 unsupervised classifier
  • Border representations of 1 bpp images and raster conversion for SVG
  • Postscript generation (levels 1, 2 and 3) of images for device-independent output
  • PDF generation (G4, DCT, FLATE) of images for device-independent output
  • Connectivity-preserving thinning and thickening of 1 bpp images
  • Image warping (captcha, stereoscopic)
  • Image dewarping based on content (textlines)
  • Watershed transform
  • Greedy splitting of components into rectangles
  • Location of largest fg or bg rectangles in 1 bpp images
  • Search for least-cost paths on binary and grayscale images
  • Barcode reader for 1D barcodes (very early version as of 1.55)

Implementation characteristics

  • Efficient: image data is packed binary (into 32-bit words); operations on 32-bit data whenever possible
  • Simple: small number of data structures; simplest implementations provided that are efficient
  • Consistent: data allocated on the heap with simple ownership rules; function names usually begin with primary data structure (e.g., pix); simple code patterns throughout
  • Robust: all ptr args checked; extensive use of accessors; exit not permitted
  • Tested: thorough regression tests provided for most basic functions; valgrind tested
  • ANSI C: automatically generated prototype header file
  • Portable: endian-independent; builds in Linux, macOS, MinGW, Cygwin, Windows
  • Nearly thread-safe: ref counting on some structs
  • Documentation: large number of in-line comments; doxygen; web pages for further background
  • Examples: many programs provided to test and show usage of approx. 2600 functions in the library

Open Source Projects that use Leptonica

  • tesseract (optical character recognition)
  • OpenCV (computer vision library)
  • jbig2enc (encodes multipage binary image documents with jbig2 compression)

Major contributors to Leptonica

  • Tom Powers: Tom has supported Leptonica on Windows for many years. He has made many contributions to code quality and documentation, including the beautiful "unofficial documentation" on the web site. Without his effort, Leptonica would not run today on Windows.
  • David Bryan: David has worked for years to support Leptonica on multiple platforms. He designed many nice features in Leptonica, such as the severity-based error messaging system, and has identified and fixed countless bugs. And he has built and tested each distribution many times on cross-compilers.
  • James Le Cuirot: James has written and supported the autotools scripts on Leptonica distributions for many years, and has helped test every distribution since 1.67.
  • Jeff Breidenbach: Jeff has built every Debian distribution for Leptonica. He has also made many improvements to formatted image I/O, including tiff, png and pdf. He is a continuous advocate for simplification.
  • Egor Pugin: Egor is co-maintainer of Leptonica on GitHub. He ported everything, including all the old distributions, from Google Code when it shut down. He set Leptonica up for appveyor and travis testing, and has implemented the cppan project, which simplifies building executables on Windows.
  • Jürgen Buchmüller: Jürgen wrote text converters to modify Leptonica source code so that it generates documentation using doxygen. He also wrote tiff wrappers for memory I/O.
  • Stefan Weil: Stefan has worked from the beginning to clean up the Leptonica GitHub distribution, including removing errors in the source code. He also suggested and implemented the use of Coverity Scan.