Skip to content

Commit

Permalink
Release 1.75.2
Browse files Browse the repository at this point in the history
* Also cleaned up prog/jbrankhaus.c and prog/jbcorrelation.c
  • Loading branch information
DanBloomberg committed Feb 10, 2018
1 parent f74b343 commit 13d783c
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 64 deletions.
16 changes: 8 additions & 8 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*====================================================================*/

README (version 1.75.1)
File update: 31 Jan 2018
README (version 1.75.2)
File update: 11 Feb 2018
---------------------------

gunzip leptonica-1.75.1.tar.gz
tar -xvf leptonica-1.75.1.tar
gunzip leptonica-1.75.2.tar.gz
tar -xvf leptonica-1.75.2.tar

</pre>

Expand Down Expand Up @@ -116,7 +116,7 @@ <h2> <A NAME="BUILDING">
Libraries, executables and prototypes are easily made, as described below.

When you extract from the archive, all files are put in a
subdirectory 'leptonica-1.75.1'. In that directory you will
subdirectory 'leptonica-1.75.2'. In that directory you will
find a src directory containing the source files for the library,
and a prog directory containing source files for various
testing and example programs.
Expand Down Expand Up @@ -251,7 +251,7 @@ <h2> <A NAME="BUILDING">
make install

Configure also supports building in a separate directory from the
source. Run "/(path-to)/leptonica-1.75.1/configure" and then "make"
source. Run "/(path-to)/leptonica-1.75.2/configure" and then "make"
from the desired build directory.

Configure has a number of useful options; run "configure --help" for
Expand Down Expand Up @@ -1069,8 +1069,8 @@ <h2> <A NAME="CONTENTS">
http://code.google.com/p/leptonica, as well as all versions after 1.60.
These have now been transferred by Egor Pugin to github:
github.com/danbloomberg/leptonica
where all releases (1.42 - 1.75.1) are available; e.g.,
https://github.com/DanBloomberg/leptonica/releases/tag/1.75.1
where all releases (1.42 - 1.75.2) are available; e.g.,
https://github.com/DanBloomberg/leptonica/releases/tag/1.75.2
Most recent releases from 1.67 are also available at
leptonica.org/download.html
Note that if you are downloading from github, the releases are more
Expand Down
71 changes: 39 additions & 32 deletions prog/jbcorrelation.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@
/*
* jbcorrelation.c
*
* jbcorrelation dirin thresh weight rootname [firstpage npages]
* jbcorrelation dirin thresh weight [firstpage npages]
*
* dirin: directory of input pages
* thresh: 0.80 - 0.85 is a reasonable compromise between accuracy
* and number of classes, for characters
* weight: 0.6 seems to work reasonably with thresh = 0.8.
* rootname: used for naming the two output files (templates
* and c.c. data)
*
* Note: all components larger than a default size are not saved.
* The default size is given in jbclass.c.
* Notes:
* (1) All components larger than a default size are not saved.
* The default size is given in jbclass.c.
* (2) The two output files (for templates and c.c. data)
* are written with the rootname
* /tmp/lept/jb/result
*/

#include "allheaders.h"
Expand All @@ -49,23 +51,24 @@

#define BUF_SIZE 512

/* select additional debug output */
/* Select additional debug output */
#define DEBUG_TEST_DATA_IO 0
#define RENDER_DEBUG 1
#define DISPLAY_DIFFERENCE 0
#define DISPLAY_DIFFERENCE 1
#define DISPLAY_ALL_INSTANCES 0

/* for display output of all instances, sorted by class */
/* For display output of all instances, sorted by class */
#define X_SPACING 10
#define Y_SPACING 15
#define MAX_OUTPUT_WIDTH 400
#define MAX_OUTPUT_WIDTH 1000

static const char rootname[] = "/tmp/lept/jb/result";

int main(int argc,
char **argv)
{
char filename[BUF_SIZE];
char *dirin, *rootname;
char *dirin;
l_int32 i, firstpage, npages, nfiles;
l_float32 thresh, weight;
JBDATA *data;
Expand All @@ -75,24 +78,26 @@ PIX *pix;
PIXA *pixa, *pixadb;
static char mainName[] = "jbcorrelation";

if (argc != 5 && argc != 7)
return ERROR_INT(" Syntax: jbcorrelation dirin thresh weight "
"rootname [firstpage, npages]", mainName, 1);
if (argc != 4 && argc != 6)
return ERROR_INT(
" Syntax: jbcorrelation dirin thresh weight [firstpage, npages]",
mainName, 1);

dirin = argv[1];
thresh = atof(argv[2]);
weight = atof(argv[3]);
rootname = argv[4];

if (argc == 5) {
if (argc == 4) {
firstpage = 0;
npages = 0;
}
else {
firstpage = atoi(argv[5]);
npages = atoi(argv[6]);
firstpage = atoi(argv[4]);
npages = atoi(argv[5]);
}

lept_mkdir("lept/jb");

#if 0

/*--------------------------------------------------------------*/
Expand All @@ -109,7 +114,7 @@ static char mainName[] = "jbcorrelation";
safiles = getSortedPathnamesInDirectory(dirin, NULL, firstpage, npages);
nfiles = sarrayGetCount(safiles);

sarrayWriteStream(stderr, safiles);
/* sarrayWriteStream(stderr, safiles); */

/* Classify components on requested pages */
startTimer();
Expand All @@ -133,7 +138,7 @@ static char mainName[] = "jbcorrelation";
npages, nfiles);
for (i = 0; i < npages; i++) {
pix = pixaGetPix(pixa, i, L_CLONE);
snprintf(filename, BUF_SIZE, "%s.%04d", rootname, i);
snprintf(filename, BUF_SIZE, "%s.%03d", rootname, i);
fprintf(stderr, "filename: %s\n", filename);
pixWrite(filename, pix, IFF_PNG);
pixDestroy(&pix);
Expand All @@ -142,22 +147,24 @@ static char mainName[] = "jbcorrelation";
#if DISPLAY_DIFFERENCE
{
char *fname;
PIX *pixt;
fname = sarrayGetString(safiles, 0, 0);
pixt = pixRead(fname);
pix = pixaGetPix(pixa, 0, L_CLONE);
pixXor(pixt, pixt, pix);
pixWrite("junk_output_diff", pixt, IFF_PNG);
pixDestroy(&pix);
pixDestroy(&pixt);
PIX *pix1, *pix2;
fname = sarrayGetString(safiles, 0, L_NOCOPY);
pix1 = pixRead(fname);
pix2 = pixaGetPix(pixa, 0, L_CLONE);
pixXor(pix1, pix1, pix2);
pixWrite("/tmp/lept/jb/output_diff.png", pix1, IFF_PNG);
pixDestroy(&pix1);
pixDestroy(&pix2);
}
#endif /* DISPLAY_DIFFERENCE */

#if DEBUG_TEST_DATA_IO
{ JBDATA *newdata;
PIX *newpix;
PIXA *newpixa;
l_int32 same, iofail;
{
JBDATA *newdata;
PIX *newpix;
PIXA *newpixa;
l_int32 same, iofail;

/* Read the data back in and render the pages */
newdata = jbDataRead(rootname);
newpixa = jbDataRender(newdata, FALSE);
Expand All @@ -180,7 +187,7 @@ static char mainName[] = "jbcorrelation";
fprintf(stderr, "read/write for jbdata succeeds\n");
jbDataDestroy(&newdata);
pixaDestroy(&newpixa);
}
}
#endif /* DEBUG_TEST_DATA_IO */

#if RENDER_DEBUG
Expand Down
54 changes: 31 additions & 23 deletions prog/jbrankhaus.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
* dirin: directory of input pages
* size: size of SE used for dilation
* rank: min pixel fraction required in both directions in match
* rootname: used for naming the two output files (templates
* and c.c. data)
*
* Notes:
* (1) All components larger than a default size are not saved.
Expand All @@ -42,6 +40,9 @@
* gives good accuracy without too manyclasses, is:
* size = 2 (2 x 2 structuring element)
* rank = 0.97
* (3) The two output files (for templates and c.c. data)
* are written with the rootname
* /tmp/lept/jb/result
*/

#include "allheaders.h"
Expand All @@ -62,14 +63,15 @@
/* for display output of all instances, sorted by class */
#define X_SPACING 10
#define Y_SPACING 15
#define MAX_OUTPUT_WIDTH 400
#define MAX_OUTPUT_WIDTH 1000

static const char rootname[] = "/tmp/lept/jb/result";

int main(int argc,
char **argv)
{
char filename[BUF_SIZE];
char *dirin, *rootname, *fname;
char *dirin, *fname;
l_int32 i, size, firstpage, npages, nfiles;
l_float32 rank;
JBDATA *data;
Expand All @@ -79,25 +81,26 @@ PIX *pix, *pixt;
PIXA *pixa, *pixadb;
static char mainName[] = "jbrankhaus";

if (argc != 5 && argc != 7)
if (argc != 4 && argc != 6)
return ERROR_INT(
" Syntax: jbrankhaus dirin size rank rootname [firstpage, npages]",
" Syntax: jbrankhaus dirin size rank [firstpage, npages]",
mainName, 1);

dirin = argv[1];
size = atoi(argv[2]);
rank = atof(argv[3]);
rootname = argv[4];

if (argc == 5) {
if (argc == 4) {
firstpage = 0;
npages = 0;
}
else {
firstpage = atoi(argv[5]);
npages = atoi(argv[6]);
firstpage = atoi(argv[4]);
npages = atoi(argv[5]);
}

lept_mkdir("lept/jb");

#if 0

/*--------------------------------------------------------------*/
Expand Down Expand Up @@ -136,27 +139,33 @@ static char mainName[] = "jbrankhaus";
npages, nfiles);
for (i = 0; i < npages; i++) {
pix = pixaGetPix(pixa, i, L_CLONE);
snprintf(filename, BUF_SIZE, "%s.%04d", rootname, i);
snprintf(filename, BUF_SIZE, "%s.%03d", rootname, i);
fprintf(stderr, "filename: %s\n", filename);
pixWrite(filename, pix, IFF_PNG);
pixDestroy(&pix);
}

#if DISPLAY_DIFFERENCE
{
char *fname;
PIX *pix1, *pix2;
fname = sarrayGetString(safiles, 0, L_NOCOPY);
pixt = pixRead(fname);
pix = pixaGetPix(pixa, 0, L_CLONE);
pixXor(pixt, pixt, pix);
pixWrite("junk_output_diff", pixt, IFF_PNG);
pixDestroy(&pix);
pixDestroy(&pixt);
pix1 = pixRead(fname);
pix2 = pixaGetPix(pixa, 0, L_CLONE);
pixXor(pix1, pix1, pix2);
pixWrite("/tmp/lept/jb/output_diff.png", pix1, IFF_PNG);
pixDestroy(&pix1);
pixDestroy(&pix2);
}
#endif /* DISPLAY_DIFFERENCE */

#if DEBUG_TEST_DATA_IO
{ JBDATA *newdata;
PIX *newpix;
PIXA *newpixa;
l_int32 same, iofail;
{
JBDATA *newdata;
PIX *newpix;
PIXA *newpixa;
l_int32 same, iofail;

/* Read the data back in and render the pages */
newdata = jbDataRead(rootname);
newpixa = jbDataRender(newdata, FALSE);
Expand All @@ -179,7 +188,7 @@ static char mainName[] = "jbrankhaus";
fprintf(stderr, "read/write for jbdata succeeds\n");
jbDataDestroy(&newdata);
pixaDestroy(&newpixa);
}
}
#endif /* DEBUG_TEST_DATA_IO */

#if RENDER_DEBUG
Expand Down Expand Up @@ -216,4 +225,3 @@ static char mainName[] = "jbrankhaus";

return 0;
}

10 changes: 9 additions & 1 deletion version-notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@


<h2 align=center>Version Notes for Leptonica</h2>
<h3 align=center>24 Jan 2018</h3>
<h3 align=center>11 Feb 2018</h3>

<hr>
<h2 align=center> <IMG SRC="moller52.jpg" border=1 ALIGN_MIDDLE> </h2>
Expand All @@ -89,6 +89,14 @@ <h2 align=center> <IMG SRC="moller52.jpg" border=1 ALIGN_MIDDLE> </h2>

<pre>

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.
Expand Down

0 comments on commit 13d783c

Please sign in to comment.