Featured operations are
- Rasterop (a.k.a. bitblt)
- Affine transformations (scaling, translation, rotation, shear) on images of arbitrary pixel depth
- Binary and grayscale morphology, rank order, and convolution
- Seedfill and connected components
- Image transformations combining changes in scale and pixel depth
- Pixelwise masking, blending, enhancement, arithmetic ops, etc.
Ancillary operations include
- I/O for standard image formats
- Utilities to handle arrays of image-related data types
- Utilities for generic stacks, queues, heaps and lists; and for byte queues and arrays of numbers and strings
Example applications include
- Octcube-based color quantization, with and without dithering
- Modified median-cut color quantization, with and without dithering
- Skew determination of text images
- Segmentation of page images with mixed text and images
- jbig2 unsupervised classifier
- Border representations of 1 bit/pixel images and raster conversion for SVG
- PostScript wrapping (levels 1, 2) of images for device-independent output
- Rendering text on an image
- Connectivity-preserving thinning and thickening of 1 bit/pixel images
- Line removal from a grayscale sketch
- Search for least-cost paths on binary and grayscale images
Reference documentation for users
- The Leptonica image processing and analysis source code comes with a very weakly restricted copyright license.
- The README gives an overview of installation and usage, with a brief description of the library contents.
- A page of brief notes on version changes.
- A set of somewhat detailed usage notes , still being added to, should introduce you to some of the contents and usage patterns in the library.
- A lightweight overview of the software is also under construction.
- For a deeper look into specific components of the library, see the web pages linked from the image processing page.
- The final arbiter is, of course, the source itself.
Source download
- Click here to download the source. [ update: Nov 8, 2009]
- See here for further information about the source code.
Contents
- What is the origin of the name Leptonica?
- Image processing at this site [ update: Nov 8, 2009]
- Some issues in software design
A primer on particle physics - A small collection of stellar links
Broadband for Dummies: a primer for safely using the internet with windows [update: Feb 14, 2009]
Reading and writing images
Before you can do anything with images, you need to be able to read and write them. Of the large number of image formats in existence, we support a small set that are the most useful. Some like BMP and PNM are very simple, but the most important support compressed file formats with open libraries. These include the two formats supported by all browsers, PNG and (JFIF) JPEG. There is also TIFF-wrapped CCITT-G4 compression, which, for some strange reason is not supported by browsers. Note that Leptonica doesn't support GIF, because the specific universal compression scheme it uses (LZW) has until recently been covered by patents that Burroughs-Sperry-Rand attempted to enforce. You'll also find that PNG, which uses gzip compression in libz, is usually about 10% more efficient than GIF, and the Burrows-Wheeler encoder used in bzip2 is better still. Most of the fileio functions can be found in readfile.c and writefile.c. The top-level functions are pixRead() and pixWrite(). Specific encoders are supported by functions in files that end in "io.c". These functions, most of which use streams for I/O, are the link between our image data structure, the Pix, and the low-level code that reads and writes the image data. There are also special high-level functions. For example, tiffio.c has functions for reading and writing files containing multiple images and writing files with special tiff tags embedded in the header. See prog/mtifftest.c for examples. Also, jpegio.c has a function that reads jpeg files, optionally converting RGB to 8 bpp with a colormap, reducing by a power of 2, and returning warnings if the compressed data is corrupted.
Additionally, you can write PostScript files in a variety of formats, both level 1 (uncompressed) and level 2 (using DCT (aka JPEG) and CCITT-G4 compression with the option to paint through the binary mask. This is implemented in psio.c, where you will find a number of functions that support these two compressed formats, as well as as the ascii85 error-correction encoder that encodes 4 bytes of binary data into 5 bytes of ascii. See prog/psiotest.c for examples.
What about reading PostScript files into raster images? Fortunately, we have Aladdin's ghostscript to do this. I have put several bash scripts in prog, such as ps2png, that use ghostscript with various output devices convert a PostScript file to a set of compressed image files, one file per page. PDF files are also easily generated from PostScript using Aladdin's ps2pdf, which is a shell script that also runs ghostscript with the appropriate output device.
0 commenti:
Post a Comment