XUtils

Leptonica

Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. [BSD-2-Clause] [website](http://leptonica.org/index.html)


Leptonica Library

sw

www.leptonica.org

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, sets, ordered maps, hashmaps; 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)
  • Determination of skew and orientation of text images
  • Adaptive background normalization and binarization
  • Segmentation of page images with mixed text and images
  • Color segmentation by clustering and seed-filling
  • 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)

Open Source Projects that use Leptonica

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

Installing leptonica (vcpkg)

  • You can build and install leptonica using vcpkg dependency manager:

”` sh or powershell

  git clone https://github.com/Microsoft/vcpkg.git
  cd vcpkg
  ./bootstrap-vcpkg.sh # "./bootstrap-vcpkg.bat" for powershell
  ./vcpkg integrate install
  ./vcpkg install leptonica

”`

  • The leptonica port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.

Articles

  • coming soon...