@kiran.kk.phonpe/node-native-ocr
Version:
Native Node.js bindings for the Tesseract OCR project.
885 lines (841 loc) • 87.4 kB
HTML
<html>
<body BGCOLOR=FFFFE4>
<!-- JS Window Closer -----
<form>
<center>
<input type="button" onclick="window.close();" value="Close this window">
</center>
</form>
----- JS Window Closer -->
<!-- Creative Commons License -->
<a rel="license" href="http://creativecommons.org/licenses/by/2.5/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.gif" /></a>
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/2.5/">Creative Commons Attribution 2.5 License</a>.
<!-- /Creative Commons License -->
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<dc:title>leptonica</dc:title>
<dc:date>2001</dc:date>
<dc:description>An open source C library for efficient image processing and image analysis operations</dc:description>
<dc:creator><Agent>
<dc:title>Dan S. Bloomberg</dc:title>
</Agent></dc:creator>
<dc:rights><Agent>
<dc:title>Dan S. Bloomberg</dc:title>
</Agent></dc:rights>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
<dc:source rdf:resource="www.leptonica.com"/>
<license rdf:resource="http://creativecommons.org/licenses/by/2.5/" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by/2.5/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
<requires rdf:resource="http://web.resource.org/cc/Attribution" />
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
</License>
</rdf:RDF>
-->
<pre>
/*====================================================================*
- Copyright (C) 2001 Leptonica. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*====================================================================*/
</pre>
<h2 align=center>Version Notes for Leptonica</h2>
<h3 align=center>18 Feb 2020</h3>
<hr>
<h2 align=center> <IMG SRC="moller52.jpg" border=1 ALIGN_MIDDLE> </h2>
<hr>
<p>
Note: The following are highlights of the changes in each version.
They are <i>not</i> a complete listing of the modifications.
<pre>
1.80.0 28 Jan 2020
* Improve bmp handling of 1 bpp images and sanity checking of params.
* Add function to display all rgb gamut colors
* in Makefile.am, use option serial-tests to avoid races in testing
* Make md subdirectory and add ax_split_version.md there
* Simple function for hue-invariant mapping (pixMapWithInvariantHue)
* Fixed bug in limit of ptra size when used for sorting by bins.
* Use hashmap to count pixel colors in RGB(A) images.
* Convert hashtest program to regression test hash_reg.
* Convert croptest program to regression test crop_reg.
* New color segmentation by region growing (colorfill.c)
* New regression tests: colorfill_reg, circle_reg, ccbord_reg.
* Set maxima for all allocations for common leptonica data structures.
* Don't fail when downscaling 2, 4, 8, and 32 bpp images, even
to one pixel, invoking pixScaleSmooth().
* New functions that select 1 bpp components based on their area.
* Incremental addition to sorted array of numbers.
* new prog/fuzzing directory for oss-fuzz based fuzzing programs
* use of pixcmapIsValid() with extra argument to determine validity
with the pix it is attached to.
* Use lept_stderr() in all programs in the prog directory.
* New program rasteroptest() for thorough testing of rasterop functions.
* Removed the pixSaveTiled*() functions
* Stubbed pixDisplayWrite(). Last used in tesseract 3.04.01 (2/2016).
1.79.0 1 Jan 2020
* Clean up auto-generation of files; removed 'register'
* Some fixes for issues identified by fuzzer
* New source files: checkerboard.c
* New programs: replacebytes.c, webpanimio_reg.c, partifytest.c,
rectangle_reg.c, lowsat_reg.c, rotate_it.c, scale_it.c, dewarp_it.c,
pdfio1_reg.c, pdfio2_reg.c, checkerboard_reg.c, underlinetest.c.
* Convert to standard reg test: heap_reg.c, pixa1_reg.c, smallpix_reg.c
* Improve data checking when reading image file headers
(pnm, png, jpeg, tiff)
* Fix some bugs in pnm reading
* Fix inconsistencies with the encoding type flags in pdf writing
* Allow tiff to write images with colormaps
* Fix errors in PS code; made some functions static
* Add code for animated webp (requires webp mux and demux libraries)
* Add "partify" application for separating parts in a musical score
* Enable tif read/write of gray+alpha and rgba; filter out tiff
pixels that are not uint and compression by tile
* Apply consistent formatting of static const variables
* Add programs for scaling, rotation and deskew, named dewkew_it,
rotate_it and scale_it, for useful operations on arbitrary images.
* Convert pdfiotest program to two regression tests: pdfio1_reg
and pdfio2_reg.
* Remove all use of strncat; use stringCat().
* New functions from removing outliers in sequences of boxes.
* Generalize pixAverageInRect(): mask, region and range filters,
and subsampling. New pixAverageInRectRGB().
* Fix int overflow bug in pixMedianCut(); required new heap accessor.
* New pixMultiplyGray() allows pix to be multiplied by an array (or
another pix)
* Better routines for counting color.
* Lossless conversion for RGB to cmap with not more than 256 colors.
* New histo based global thresholding: pixThresholdByHisto().
* Allow most reg tests to run even if external libraries are not
available.
* New one-line gplot functions that return a pix.
* New application to find where corners meet in a checkerboard.
* Add utility functions for painting through mask in cmap pix,
creating a hit-miss sela from a color pix, equality of two pta.
* Proper handling of 1 bpp colormap tiffs: remove when reading,
preserve when writing.
* Deprecate three pixSaveTile*() functions; removed all calls to
these from the library and progs.
* Include auto_config.h explicitly in all src and prog files.
* Improve input data checking for bmp files.
1.78.0 21 Mar 19
* Various improvements in handling boxa sequences and transforms.
* New regression tests: boxa4_reg, string_reg
* New function for copying a pix, filtered by a boxa.
* Modify histogram method for image comparison.
* More careful attention to invalid boxes in box geometry functions.
* Better string and array functions for search and replace.
* Convenience functions for generating simple masks.
* Allow pdf writing of jp2k images, in full generality.
* Allow writing compressed ps images for printing.
* Modified enum comments to include a suggested enum name.
* New program: imagetops
1.77.0 14 Dec 18
Here is the current status of CVE issues with leptonica; see
https://security-tracker.debian.org/tracker/source-package/leptonlib
* CVE-2018-7442: potential injection attack because '/' is allowed
in gplot rootdir.
Functions using this command have been disabled by default in the
distribution, starting with 1.76.0. As for the specific issue, it
is impossible to specify a general path without using the standard
directory subdivider '/'.
* CVE-2018-7186: number of characters not limited in fscanf or sscanf,
allowing possible attack with buffer overflow.
This has been fixed in 1.75.3.
* CVE-2018-3836: command injection vulnerability in gplotMakeOutput().
This has been fixed in 1.75.3, using stringCheckForChars() to block
rootnames containing any of: ;&|>"?*$()/<
* CVE-2017-18196: duplicated path components.
This was fixed in 1.75.3.
* CVE-2018-7441: hardcoded /tmp pathnames.
These are all wrapped in special debug functions that are not
enabled by default in the distribution, starting with 1.76.0.
* CVE-2018-7247: input 'rootname' can overflow a buffer.
This was fixed in 1.76.0, using snprintf().
* CVE-2018-7440: command injection in gplotMakeOutput using $(command).
Fixed in 1.75.3, which blocks '$' as well as 11 other characters.
Wrapped the few 'system' calls in an extra layer of debug code.
More coverity scan fixes; defects are about 1 per 10,000 source lines.
New regression tests: numa1_reg, numa2_reg, lowaccess_reg,
pixmem_reg.
New non-regression test programs: histoduptest
Juergen Buchmueller is working on Lua bindings. He typedef'd l_ok
and used it in 1100 functions that return a success/failure status.
He also helped clean up remaining issues in the doxygen-generated
documentation.
Using a packed struct for bmp headers to avoid crash on
some big-endians.
Fixed a bug in the prototype parser for xtractprotos that was
surfaced by a typedef declaration for the bmp headers.
Cleaned up IOS guards to avoid compiling a system(3) call on IOS.
Renamed autobuild --> autogen.sh
Added some basic pixa functions for rotation and translation.
Added an iterative method to find rectangular coverings for
arbitrary connected components.
Converted two tests to reg tests running in alltests_reg:
ptra1_reg, ptra2_reg
Enabled read/write for standard jpeg compressed tiff images.
Enabled reading for the old (deprecated) jpeg-encoded tiffs.
Fix range selectors for pixa, pixaa, boxa, boxaa, pta:
Now, last = -1 goes to the end.
When reading tiff --> pix, insert IMAGEDESCRIPTION into text field.
Converted iotest to reg test iomisc_reg; added to alltests_reg
Converted rasterop_reg into a standard regression test; added
to alltests_reg.
Converted boxa2_reg and fhmtauto_reg into standard regression tests;
added to alltests_reg.
Split boxa sequence functions out of boxfunc4.c, into a new boxfunc5.c.
Simplified bmp header and made reading more clearly endian
agnostic (Juergen Buchmueller)
New boxa3_reg regression test. This tests sequences of boxes
by two new boxfunctions in boxfunc5.c.
New bootnumgen4.c for more digit templates.
Rename prog/recog_bootnum.c --> prog/recog_bootname1.c
New in prog: recog_bootnum2.c, recog_bootnum3.c, recogtest7.c
Fixed uninitialized data in pixCentroid() on 1 bpp pix.
New reg test: bytea_reg.c. (removed byteatest.c)
Fixed bug in non-transcoding pdf generation from 1 bpp png.
Added LGTM to static analyzers that run over the library.
1.76.0 1 May 18
Modify infrastructure to fix outstanding security issues. By default,
you can no longer create temp directories and temp files whose
names are known to the compiler. Also, prevent "system" calls,
which were used for image display and gnuplot.
Replaced remaining sprintf() with snprintf() in prog tests.
Added non-transcoding functions for generating pdf from jpeg pixacomp
Add control of jpeg quality from pixWriteMem() and pixWriteStream()
Fixed getFilenamesInDirectory() to properly identify directories
Prevent size overflow in calloc for kernel; cleaned it up fpix and dpix
bmp reading now accepts negative height
Simplified splitimage2pdf; it no longer uses ps2pdf
Remove name-mangling WRITE_AS_NAMED compile option.
Removed 2 deprecated write functions.
Added these regression tests:
locminmax_reg, speckle_reg, watershed_reg,
1.75.3 15 Feb 18
Fixed some coverity scan issues.
Autotools fix to check for png if enabling gnuplot (James Le Cuirot).
1.75.2 11 Feb 18
Converted several progs to standard regression tests.
Added these tests to the alltests_reg suite:
adaptnorm_reg, binmorph1_reg, binmorph3_reg, equal_reg,
extrema_reg, grayfill_reg, falsecolor_reg, grayquant_reg.
Autotools fix for restricting giflib to 5.1+, and allowing
openjpeg 2.3 (James Le Cuirot).
1.75.1 31 Jan 18
Simpler and more accurate function for finding word masks from
text image; better debugging and more thorough testing.
Added to regression test set: prog/italic_reg
Fix for potential injection attack using gplot rootdir.
Bug fix for bmp reading to set opacity.
1.75.0 24 Jan 18
This is a new version, for major Ubuntu release 18.04.
$TMPDIR path rewriting turned off on Unix; only used for Windows.
Added pix conversion to depth 2 and 4. We now have general
converters to 1, 2, 4, 8, 16 and 32 bpp.
Modified giflib to use read/write from/to memory; no temp files;
no longer support versions before 5.1.
Move most low-level code from separate files to their callers;
about 30 of them became static.
Improved table detection on scanned page images (tests: pageseg_reg.c)
Added support for write/compare regression tests for files.
Modified printimage for more flexibility.
Enable lookup by key on comma-separated key/value text file.
Update README.html for building with Visual Studio.
Improved functions for getting pixel averages in RGB images
Simplified and speedup of unsharp masking.
New function for detecting and correcting text orientation.
Remove slow sharpening operation when not appropriate during scaling.
Better handling of gplots with 0 or 1 data point.
Coverity scan fixes.
Modified jpeg2000 header to use openjpeg 2.3.
Improved depth accessors for pixa and pixaa; added size accessors
for pixa and pixaa.
Bug fix in webp interface on read error.
New function that finds the closest boxes in a boxa to any particular
box, in each of 4 directions.
New regression tests in automated sequence: blend5_reg, quadtree_reg,
wordboxes_reg.
New program: textorient
Removed programs: snapcolortest
1.74.4 11 Jun 17
Converted two progs to reg tests
New version because 1.74.3 had some spurious files (xtractprotos,
endianness.h)
1.74.3 9 Jun 17
Coverity scan fixes.
Several fixes for running on Windows, including subtle one with tiff
encoding depending on pad bits.
Utility and test if a page image likely has a table.
Remove use of pixCreateTemplateNoInit() where it may cause problems.
Make release 'configure-make ready'
1.74.2 19 May 17
Many simplifications and improvements to recognizer.
Cleanup of doxygen comments
Encoded pdf title in escape 4-byte hex (for safety)
Fixed several hundered coverity scan possible leaks
Added about 20 regression tests to the automated set.
Improved vertical alignment of dewarp.
Implemented preliminary method for correcting dewarp foreshortening
due to page curvature.
Improved multipage tiff reading and writing.
Added a new version of textline finding.
Fixed bug in fast 2D sharpening code (used in some scaling ops)
BMP i/o rewritten to implement memory version directly.
PNG i/o functions added for encoding and decoding directly to memory.
Method for finding light color regions on scanned page images.
1.74.1 3 Jan 17
Configuration changes to support the patch number in the
version (major.minor.patch).
Removed all remaining pixDisplayWrite() calls in prog/.
Cleaned up and/or promoted about 15 programs to full regression
tests. There are now 95 tests in the regression set.
Over half the initial coverity scan warnings have been removed.
1.74.0 10 Dec 16
Leptonica development was moved to github. The master is at:
github.com/danbloomberg/leptonica
Egor Pugin is the maintainer of the site.
A very large number of changes have been made. Some of them follow;
details can be found in the git commit messages.
Static makefiles modified to work with gnu*9 and c*9.
Modify SET macros to work on windows.
New modes for RGB --> gray conversion.
New functions added for displaying a pix from a pixa.
Split out sort/hash/set/map functions for dna, sarray and pta.
More robust horizontal deskew on multi-column page images.
Improve webpio_reg test.
Remove X11 display for gplot; it is no longer supported.
Remove most sleep calls, which were put in for gplot; no longer needed.
Removed use of gthumb in library.
Removed use of pixDisplayWrite() in the library; still in some progs.
Improved test for endianness in makefile.static; no longer requires
any local files or building and running a program.
Modified all files for doxygen output (spearheaded by
Juergen Buchmueller)
Improved plotting of the boxes in a boxa.
Replaced the slow point hash function with a simple fast one.
Added pam (4 component) format writing to pnmio.c (Juergen Buchmueller)
Improved rendering of pixa in side/by/sides.
Better utilities for pixa and pixacomp.
Add read/write serialization functions from/to memory for all
the major data structures that do not already have them.
More serialized boot recognizers stored as self-generating code.
Cleaned up generating an adapted recognizer from the boot recognizer.
Simplified temp file naming; removed most instances of named
temp files from non-debug code; use tmpfile() and a wrapper
l_makeTempFilename().
Simplify and streamline multipage tiff reading (Jeff Breidenbach).
Improvement of Otsu thresholding.
Recognize outstanding contributors to leptonica over the years.
New gif mem read/write interface that avoids writing a temp file,
contributed by Tobias Peirick.
Use double arrays (dna) instead of float (numa) for set ops.
Enrolled in coverity scan to find potential bugs (Stefan Weil
managed it). Fixed about 200 of them, mostly potential memory
leaks from early function exit.
Cleanup of gray quantization functions and tests.
Refactored connectivity-conserving operations, to make them more useful.
Provided methods for measuring and regularizing the width of strokes.
Removed viewfiles.c from library; code is now in prog htmlviewer.c.
Better debugging in page segmentation (pageseg.c)
Deprecated the pixDisplayWrite*() debugging methods.
Added about 15 regression tests to the framework in alltests_reg.c
Final mods for compatibility with tesseract 4.00.
1.73 25 Jan 16
All lept_* functions have been rewritten to avoid path rewrites for
output to temp files, which were introduced in 1.72.
Now, (1) files are written to the directory specified and (2) we
are careful to write to subdirectories of /tmp/lept/ for all test
programs, starting with the reg tests and prog/dewarp* and
prog/recog*. This also required re-writing stringcode.c and
stringtemplate1.txt to write temp files to subdirectories.
Goal is to write to the specified path while not spamming the
/tmp and /tmp/lept directories. This is particularly important
on windows because files in the <TEMP> directory are not cleared
on reboot.
Naming changes (to avoid collisions):
#defines MALLOC --> LEPT_MALLOC, CALLOC --> LEPT_CALLOC, etc.
ByteBuffer --> L_ByteBuffer
Added grayscale histogram functions that can be used to compare images.
Added functions to determine if an image region has horizontal
text lines.
Added functions to compare photo regions of images to determine
if they're essentially the same.
Added red-black tree utility functions to implement maps and sets.
The keys for maps and sets can be 64-bit entities (signed and
unsigned integers and doubles).
Implemented hashsets and hashmaps, using 64 bit keys.
Replaced the numaHash by l_dnaHash; removed numa2d
Improved security of tiff and gif reading, to prevent memory corruption
when reading bad data.
Removed src files: bootnumgen.c
Added src files: rbtree.c, rbtree.h, map.c, bootnumgen1.c, bootnumgen2.c
Added prog files: rbtreetest.c, maptest.c, settest.c, hashtest.c,
recog_bootnum.c, percolatetest.c
Added files for building using cmake (Egor Pugin)
1.72 5 Apr 15
Better handling of 1 bpp colormap read/write with png so that
they are losseless. The colormap is always removed on read and
the conversion is to the simplest non-cmapped pix that can fully
represent the input -- both with and without alpha.
Fixed overflow bug in pixCorrelationBinary().
Fixed orientation flags and handling of 16 bit RGB in tiff.
Also new wrappers to TIFFClientOpen(), so we no longer go through
the file descriptor for memory operations.
Improvements in the dewarp functions.
New box sequence smoothings.
New antialiased painting through mask; previously it was only
implemented for connected components in a mask.
Better error handling and debug output with jpeg2000 read/write.
Implemented base64 encoding. This allows binary data to be represented
as a C string that can be compiled. Used this in bmf utility.
Implemented automatic code generation for deserialization from
compiled strings (stringcode.*)
Regression tests write to leptonica subdir of <Temp> in windows; in
unix it is optional. This avoids spamming the <Temp> directory.
Added new colorspace conversions (XYZ, LAB).
New source files: encoding.c, bmfdata.h, stringcode.c, stringcode.h,
bootnumgen.c.
Removed source files: convolvelow.c, graymorphlow.c
New programs: genfonts_reg, colorize_reg, texturefill_reg,
autogentest1, autogentest2.
alltests_reg now has 66 tests.
1.71 18 Jun 14
This version supports tesseract 3.04. In particular, 3.04
has automatic conversion of a set of scanned images, either in a
directory or coming directly from a scanner, into pdf with injected
text. This is something we've wanted to do for several years!
Improved jp2k header reading, including resolution.
Removed src files: rotateorthlow.c, pdfio.c, pdfiostub.c
Renamed jp2kio.c, jp2kiostub.c ==> jp2kheader.c, jp2kheaderstub.c.
These header reading functions parse the jp2k files, and
don't require a jpeg2000 library.
New jp2kio.c, jp2kiostub.c, that uses openjpeg-2.X to read
and write jp2k. We now support I/O from these formats:
png, tiff, jpeg, bmp, pnm, webp, gif and jp2k
as well as writing to PostScript and pdf.
New pdfio1.c, pdfio1stub.c, pdfio2.c pdfio2stub.c, where we've
split functions into high and low level.
Fixed memory bug in bilateral.c
Improved reading/write of binary data from file. For example,
l_binaryReadStream() can now be used to capture data piped
in via stdin.
Font directory now arg passed in everywhere (not hardcoded)
Don't write temporary files to /tmp; only to a small number of
subdirectories, to avoid spamming the /tmp directory. E.g.,
for regression tests, the current output is now to /tmp/regout/.
For jpeg reading modify pixReadJpeg() to take as a hint
a bit flag that allows extraction of only the luminance channel.
Allow wrapping of pdf objects from png images without transcoding
(thanks to Jeff Breidenbach)
Better support for alpha on read/write with png, including
1 bpp with colormap, alpha (supported in png with transparency array)
1.70 3 Feb 14 (distribution to debian; ubuntu 14-04; 4.1.0)
New bilateral filtering.
New simple character recognition utility.
Improved dewarping functionality, in model building and rendering.
More flexible use of ref models.
Better and more consistent handling of alpha layer in RGBA, though
use of the spp field. Ability to handle more png files with alpha,
including palette with alpha.
New fast converters from jpeg and jpeg2000 to pdf, without transcoding.
Made bmp reader (and pix reading in general) more robust; avoid
size overflow errors.
New text labelling operations; depth conversion of a set of images
New license (essentially BSD 2-clause), to specify conditions
for both source and binary distribution.
Improved auto make: make all progs, install just 11, test 61.
New src files: bilateral.{c,h}, dewarp1.c, dewarp2.c,
dewarp3.c, dewarp4.c, jp2kio.c, jp2kiostub.c,
pixlabel.c, recogbasic.c, recogdid.c, recogident.c,
recogtrain.c, recog.h
New prog files: adaptmap_dark.c, alphaxform_ret.c,
bilateral_reg.c, binarize_reg.c, binarize_set.c,
blackwhite_reg.c, blend1_reg.c, blend3_reg.c, blend4_reg.c,
boxa1_reg.c, colorcontent_reg.c, coloring_reg.c,
colorspace_reg.c, compare_reg.c, converttopdf.c,
croptest.c, dewarprules.c, dewarptest1.c, dewarptest2.c,
dewarptest3.c, dewarptest4.c, displayboxa.c, displaypix.c,
displaypixa.c, findcorners_reg.c, fpix1_reg.c,
fpix2_reg.c, fpixcontours.c, insert_reg.c, italictest.c,
jpegio_reg.c, label_reg.c, multitype_reg.c, nearline_reg.c,
newspaper_reg.c, numa1_reg.c, numa2_reg.c, recogsort.c,
recogtest1.c, shear1_reg.c, webpio_reg.c, wordboxes_reg.c
Removed src files: arithlow.c, binexpandlow.c, binreducelow.c,
dewarp.c
Removed prog files: blend_reg.c, blendtest1.c,
dewarptest.c, fpix_reg.c, inserttest.c, numa_reg.c, rotatetest2.c
shear_reg, xvdisp.c
1.69 16 Jan 12 (distribution to debian; ubuntu 12-04; 3.0.0)
Fixed bug in pdf generation for large files, using a new
double array (dnabasic.c). Added several new modes for pdf
generation from sets of images.
Dewarp based on image content now aligns to left and right margins;
works at book level; is more robust to bad disparity models;
version 2 serialization.
Fixed regutils to return the actual number of errors.
Improved sorting efficiency of numas in cases where binning,
which is order N, makes sense.
Fixed fpix serialization (now version 2).
New version (5) of xtractprotos, allows putting prototypes in-line in
allheaders.h. Having them separately in leptprotos.h still an option
New copyright (BDS, 2 clause) on src files.
Removed all trailing whitespace in src files.
New src files: boxfunc4.c coloring.c, dnabasic.c
New prog files: dna_reg.c, alphaops_reg.c
Removed prog file: alphaclean_reg.c
1.68 10 Mar 11
Fixed windows issues with passing pointers across C-runtime boundaries
when using dlls, by providing special functions (e.g., lept_fopen()).
Proper version numbers are now set with automake.
New utility (quadtree.c) for generating quadtree statistics.
New utility (in colorspace.c) for conversions to and from YUV.
Refactored functions for assembling image data for generating
either PS or PDF images using g4, jpeg or flate encoding.
Better tempfile names, using current time in microseconds.
Functions for getting resolution from jpeg and png files.
Use size_t throughout for reading and writing binary data.
Deprecate arrayRead*() and arrayWrite() functions; replace in
the library with l_binaryRead*() and l_binaryWrite().
Better handling of colormap images for in-place rasterop and shear.
New utility (bytearray.c) for parsing and handling binary data;
used for generating PDF files.
New utility (pdfio.c) for generating PDF files.
Refactored regutils functions to make them simpler to use.
Top-level deskew now works on any image.
Added functions in utils.c for cross-platform development, mostly
for functions that make and remove directories, copy, move
and delete files, etc. It should now be straightforward to write
programs that will compile and run on windows.
Reg tests have better printout; all give timings.
New utility program: convertfilestopdf
1.67 9 Nov 10
Autoconf: now built with James Cuirot's config files that
build the library and all 200 progs.
New sudoku solver. Just a game, but there are interesting aspects.
Modified parseprotos.c to reject a type of "extern" decl.
Add faster implementation for very small gray morphology
operations (3x1, 1x3, 3x3).
Eliminate warnings on recent gcc if you don't check return values
from fread, fscanf, fgets, system, etc.
Convolution: new functions for windowed variance and stdev; allow
non-square kernel for windowed mean square.
Put stdio.h and stdlib.h in alltypes.h, so they're not required
in any .c files.
Replace numaConvolve(), which is just a windowed mean, by
windowed statistics functions (mean, mean square, variance).
Generalize pixExtractOnLine() for arbitrary lines.
Add pix interface to webp (webpio.c, webpiostub.c). This is a
new open source codec, based on the video codec vpx (webm).
Serialization of FPix and DPix
Interconversion between FPix and DPix
Integer scaling of FPix and DPix; includes the last row and column.
New convertfiles.c: depth conversion on files in a directory.
Testing programs in prog:
convolve_reg.c, numa_reg.c: expanded test set
projection_reg.c (tests pixRowStats(), pixColumnStats())
dewarptest.c: output ps and pdf files
writemtiff.c: simple driver to write images to a single file
1.66 3 Aug 10
More tweaks for including (or not) bounding box hints for
PS wrapping. Default is to write b.b., but not in functions
that wrap images as full pages (psio1.c, psio2.c)
pix4.c split in two files, and added function to identify c.c.
that are sufficiently similar in shape to rectangles (pix5.c)
Modify 2 and 4 bit setters to clip the input value so that it can
only affect the pixel requested (arrayaccess.c, arrayaccess,h)
New pseudorandom sequence functions (numafunc1.c)
Dewarping camera-based images using textlines (dewarp.c, prog/dewarp*)
Geometrical function for aggregating overlapping bounding boxes.
Programs to generate figures for book chapter "Document Image
Applications" in "Mathematical Morphology: theory and applications"
(see: http:/www.leptonica.org/najman-talbot-book-chapter.html)
(prog/livre*.c)
Functions that do affine and other operations in images with
alpha blending at edges: pix*WithAlpha(). Also do this
with a gamma/inverse-gamma wrapper to further reduce edge aliasing.
(rotate.c, scale.c, projective.c, affine.c, bilinear.c,
prog/alphaxform_reg.c)
Improved color segmentation (fixed bugs; made faster)
Higher order least square fits: quadratic, cubic, quartic. (pts.c)
Various mods for otsu binarization and the *SplitDistribution*()
functions (numafunc2.c, prog/otsutest2.c)
Control sampling in convolution output (convolve.c, prog/fpix_reg.c)
Morphological operations on numas (numafunc1.c, numafunc2.c,
prog/numa_reg.c)
Pix serialization wrapped so we can use pixRead(), etc on these
files (spixio.c, readfile.c, writefile.c)
Gif read/write to memory fixed (and cheated -- using files) (gifio.c)
New fpix and dpix accessors; contour rendering on fpix (fpix1.c, fpix2.c)
Various functions for linearly mapping colors and displaying arrays
of colors (pix4.c, blend.c, prog/rankhisto_reg.c)
Functions for getting approximate ranges of colors and color
components in an image (pix4.c, colormap.c)
Cleaned up windows platform and compiler defines and macros.
1.65 5 Apr 10
Added regression test utility functions for standardizing and
automating construction and running of regression tests. Makes the
golden files when the 2nd arg to the reg test is 'generate'.
(regutils.{c,h})
Converted 22 reg tests in prog to use this; invoked with alltests_reg.
Goal is to put all prog/*_reg.c into this format and put a set
of golden files on the web.
Small fixes in gifio for handling streams properly.
New functions for shifting colors, hue invariant transforms, etc
(blend.c)
prog/dwamorph*.c: rename *1_reg.c to dwalineargen.c; others
converted to standard reg tests.
New rgb convolution functions.
For PS output, write all images with a bounding box hint and with
page numbers, which works for both embedded (e.g., in tex) and
full page generated PS. Once converted to pdf, this is fine
in all situation.
New functions for initialization and random insertion with pixcomp.
For color quantization, make the lightest color white if sufficiently
close; ditto for black (colorquant1.c, colorquant2.c).
Rank binning of 8 bpp and rgb images (numafunc2.c, pix4.c)
A function to rank colors by the intensity of the minimum comp (pix4.c)
New pixRotateBinaryNice(), rotates 1 bpp pix in such a way that
the shear lines aren't visible. (rotate.c)
New pixSaveTiledWithText(), a convenience function to append text
to images that are being tiled. (writefile.c)
Stereoscopic warping functions and stereo pair functions (warper.c)
Linear interpolated shear -- better than rasterop shear (shear.c)
Option to use higher quality chroma (U,V) sampling in jpeg (jpegio.c)
Rename Bmf --> L_Bmf.
New tests in prog:
alltests_reg.c alphaclean_reg.c, psio_reg.c, rankbin_reg.c,
rankhisto_reg.c, warpertest.c
1.64 3 Jan 10
Easy setup for standard byte processing on 8 bpp pix (pix2.c)
Evaluation of difference between similar images; test for
similar images and (compare.c)
Subpixel scaling, with color input and separate scale factors (pixconv.c)
Fix tiff header reader to get correct format (tiffio.c)
Enable pixDisplay() to work with i_view (windows) and with
xzgv and xli as well as xv; allow application to choose
which to use (writefile.c).
Use a mask to specify regions that are changed by a morphological
operation (morphapp.c).
Improve the default sharpening for scaling (scale.c)
Function to test for equivalence of file data (utils.c)
Select and read image files with embedded index (readfile.c)
Fix box size calculation in pixEmbedForRotation(); solution
provided by Brent Sundheimer.
New pixDisplayMultiple(), instead of calling gthumb directly; this
is now set up to use i_view for windows.
Changed criteria for determining if an image is color (colorcontent.c,
colorquant{1,2}.c.
Optional mode where the filename extension is automatically written
to output image files; particularly useful for windows.
Initialize boxa and pixa as full, with minimal placeholders.
Get rank valued numbers and boxes in numa and boxa.
Cute implementation for finding largest solid rectangle (maze.c)
New median cut quantization for mixed (color/gray) images (colorquant2.c)
Many changes to allow the library and applications be built easily
in windows. There is now a thorough windows readme, written by Tom
Powers, for doing this. The windows build information and
project files are now in a new vs2008 directory.
1.63 8 Nov 09
Added pixScaleToGrayFast(), a faster version with very similar quality.
Fixed scaleGrayLILow() to handle edge pixels more accurately
Text processing:
new text application (finditalic.c, prog/finditalic.c) for locating
words in italic type style.
Easier to add text to a pix using the bitmap font stored in
the font directory; see, e.g., prog/writetxt_reg.c.
Blending of 2 images with an alpha channel: pixBlendWithGrayMask()
Fixed bug in color segmentation; it now (again) works properly.
New utility (pixcomp.c) for handling compressed pix arrays in
memory; new PixComp and PixaComp structs.
Fast serialization of pix without compressing (pixSerializeToMemory
and pixDeserializeFromMemory); required serialized colormaps
FileI/O: new functions for reading file headers.
PostScript generation modernized; split psio.c into psio1.c
and psio2.c; added level 3 (flate) encoding.
new functions for reading and writing multipage tiffs, for
arbitrary input images. For writing, compression is lossless
(either g4 or zip)
update all I/O stub files
Miscellaneous: new pixaAddBorderGeneral(); new functions in pix3.c
for counting fg pixels and summing 8 bpp pixels by column and row;
new numaUniformSampling() for resampling with interpolation;
subpixel scaling.
New or improved regression tests in prog:
extrema_reg, pixalloc_reg, blend2_reg, rotateorth_reg,
ioformats_reg, colorseg_reg, pixcomp_reg, pixserial_reg,
writetext_reg, psioseg_reg, subpixel_reg.
Interface changes:
findFileFormat() and findFileFormatBuffer(): now returns format
using input ptr. The function return value is 0 if OK; 1 on error
rename: pixThresholdPixels() --> pixThresholdPixelSum()
1.62 26 Jul 09
Expanded composite Dwa implementation as a sequence of operations,
so that it now works beyond a size of 63. It's typically about 2x
faster than the composite rasterop implementation (with help
from Ankur Jain). Also use data transfer instead of data copy
whenever possible. Thorough tests with binmorph4_reg and binmorph5_reg.
New functions in colorseg.c for masking and histogramming in HSV
color space.
Treat string constants rigorously as const char*, initializing
to char[] if to be used as non-const, or in some cases casting
to char*. This avoids compiler warnings.
Improved color quantization using existing colormap for octcubes
and a new version for grayscale. This will rigorously map most
black and most white octcubes (rsp) to black and white
if they exist in the colormap.
Fast quantization to an existing colormap for color and grayscale.
Fixed some bugs; e.g., in pixAffineSampled() for 1 bpp with
L_BRING_IN_BLACK; reading and writing pnm for 2 and 4 bpp.
In pngio.c, enable compile time control over these settings:
converting 16 bpp --> 8 bpp on read
removing alpha channel on read
setting zlib compression on write
For general scaling, allow sharpening to be optional, and provided
faster sharpening operations.
Improve support for 16 bpp grayscale.
For scaleToGray* functions, reduce the width truncation.
In psio.c, new functions for converting segmented page images
(text and image) into level 2 PostScript.
Removed all implicit casting to const char*.
New custom pix memory allocator, designed for large pix whose
memory needs to be reused many times.
In xtractprotos, we now allow prepending an arbitrary string to
each prototype.
In environ.h, additions for MSVC to work with VC++6, including
prototpye strings for dll import and export (thanks to Ray Smith).
In colorseg.c, new functions for building HSV histograms, finding
peaks, and generating masks based on the peaks.
New or improved regression tests:
pixalloc_reg, binmorph4_reg, binmorph5_reg, conversion_reg,
scale_reg, cmapquant_reg,
1.61 26 Apr 09
New histo-based grayscale quantization: pixGrayQuantizeFromHisto(),
that is used in new pixQuanitzeIfFewColorsMixed().
Made final fix in pixBlockconv(). No underflows; no more overflows!
More efficient rgb write with pnm.
Add proto to jpegiostub.c, allowing proper use of the stubber.
Fix several filter functions to use proper test on filter size; viz.,
pixMinMaxTiles(), several functions in convolve.c.
Redo shear implementation to handle arbitrary angles, to handle
colormapped images, and to avoid the singularity at pi/2.
Removed both static vars from pixSaveTiled().
Generalized pixRotate() to handle colormapped images, and to use
pixRotateBySampling() in place of the removed pixRotateEuclidean().
New skew finder for full angle range, pixFindSkewOrthogonalRange().
For skew detection, now allow shear about image center as well as
about the UL corner.
New rotation reg tests: rotate1_reg.c and rotate2_reg.c.
Better serialization format for boxaa; introduce new version numbers
for boxaa, pixa, and boxa, as required.
Proper init in boxGetGeometry(), boxaGetBoxGeometry(), and the
accessors in sel1.c and kernel.c.
Improved Numa functions in numafunc1.c and numafunc2.c; in
particular, numaMakeHistogramAuto() and numaGetStatsUsingHistogram().
With all histo generators, make sure the start and binsize params
are properly set and are used.
Interface change: Use these parameters implicitly in
numaHistogramGetRankFromVal() and numaHistogramGetValFromRank().
Interface change to ptaGetLinearLSF(): add 1 optional parameter.
In several pixaDisplay*() functions, handle colormaps properly.
pixafunc.c split to pixafunc1.c and pixafunc2.c.
New connected component selections and options in pixaSort.
Patch from Tony Dovgal for reading tiff rgba files.
Added new logical operation options for numas.
New pixConvertRGBToGrayMinMax() that chooses min or max of 3 components.
Computation of pixelwise aligned stats between multiple images
of the same size (e.g., video), in pix4.c.
Very fast binsort implemented for boxa and pixa.
Cleanup and rename stack, queue, heap and ptra functions:
all structs and typedefs start with "L_"
all functions start with "l"
Sel creation for crosses and T junctions.
New thresholding operations to binary; split out from adaptmap.c
into binarize.c.
Implementation of sauvola binarization, including use of pixtiling.
Added composite parallel union and intersection morphological operations.
Small changes to scaling and rotation to improve accuracy; only
visible on very tiny, symmetric images.
Implemented DPix (double precision data); useful for the mean
square accumulator for sauvola binarization.
New fast hybrid grayscale seedfill, in addition to the interative
version (contributed by Ankur Jain).
New or improved regression tests:
rotate1_reg, rotate2_reg, shear_reg, numa_reg, skew_reg,
ptra1_reg, ptra2_reg, paint_reg, smallpix_reg, pta_reg,
pixmem_reg, binarize_reg, grayfill_reg.
1.60 19 Jan 09
Fixed bug in pixBlockconv(), introduced in 1.59, that causes
overflow when convolving with an image that has white (255)
at the edges. [quickly found by Dave Bryan]
Include function to display freetype fonts in a pix.
The files freetype.c and freetype.h are in the distribution, but are not
yet linked into the library. This is contributed by Tony Dovgal,
and this version works only for MSVC.
Found that the problems with binary compression in giflib are fixed
with giflib 4.1.6.
1.59 11 Jan 09
Lots of changes since 1.58.
New files: affinecompose.c, ptra.c, warper.c, watershed.{h,c}.
Split: boxfunc.c --> (boxfunc1.c, boxfunc2.c, boxfunc3.c)
Improved connected component filtering, with logical functions
applied to indicator arrays (pix4.c, pixafunc.c, numafunc1.c).
Function to determine if an image can be quantized nicely with
only a few colors (colorcontent.c, pixconv.c).
New gray seed-filling functions (seedfill.c, seedfilllow.c).
Fixed bugs in tophats and hdome, due to misuse of pixSubtractGray()
(morphapp.c).
New function for improving contrast (adaptmap.c)
Watershed transform (still slightly buggy) (watershed.c,h).
Fast random access into a pix using line pointers (pix1.c, arrayaccess.*)
Conversions of colormaps from gray to color and v.v. (colormap.c)
Seedfill function that applies an upper limit to the fill
distance (seedfill.c)
New function for warping images with random harmonic distortion
(with help from Tony Dovgal).
New generic ptr array utility: all O(1) functions of a stack plus
random replace, insert and delete (ptra.c).
Simple functions for colorizing a grayscale image with an arbitrary
color (pixconv.c, colormap.c)
Flexible affine transforms (translation, scale, rotation) on pta
and boxa (affinecompose.c).
Clipping of foreground (both exact and approximate) starting from
within a rectangular region of the image (pix4.c)
Blending a colored rectangle over an image (pix2.c, boxfunc3.c)
Generation of rectangle covering of mask components (boxfunc3.c).
Block convolution using tiles (for very large images) (convolve.c)
New or improved regression tests in prog:
locminmax_reg, lowaccess_reg, grayfill_reg, adaptnorm_reg,
xformbox_reg, warper_reg, cmapquant_reg, compfilter_reg,
splitcomp_reg, affine_reg, bilinear_reg, projective_reg
Acknowledgments:
(1) Big thanks to Tony Dovgal for helping with the warping
(e.g. for captcha). Tony also provided an implementation that
allows rendering truetype fonts into a Pix on windows.
This is not yet incorporated, because it opens a huge
"can of worms," which is OK if you're going fishing