84 #include <config_auto.h>
88 #include "allheaders.h"
89 #include "readbarcode.h"
92 static const l_int32 MAX_SPACE_WIDTH = 19;
93 static const l_int32 MAX_NOISE_WIDTH = 50;
94 static const l_int32 MAX_NOISE_HEIGHT = 30;
97 static const l_int32 MIN_BC_WIDTH = 50;
98 static const l_int32 MIN_BC_HEIGHT = 50;
102 l_int32 nwidth, l_int32 nheight);
105 NUMA **pnaodist, l_float32 *pmindist,
106 l_float32 *pmaxdist);
108 l_float32 minsep, l_float32 maxmin);
112 l_int32 nshift, l_float32 minwidth,
114 l_float32 *pbestwidth,
115 l_float32 *pbestshift,
116 l_float32 *pbestscore);
118 l_float32 width, l_float32 shift,
119 l_float32 *pscore,
NUMA **pnad);
122 #ifndef NO_CONSOLE_IO
123 #define DEBUG_DESKEW 0
124 #define DEBUG_WIDTHS 0
152 if (psaw) *psaw = NULL;
154 return (
SARRAY *)ERROR_PTR(
"pixs not defined", __func__, NULL);
156 return (
SARRAY *)ERROR_PTR(
"unsupported format", __func__, NULL);
157 if (method != L_USE_WIDTHS && method != L_USE_WINDOWS)
158 return (
SARRAY *)ERROR_PTR(
"invalid method", __func__, NULL);
161 if (pixGetDepth(pixs) == 8 && !pixGetColormap(pixs))
169 return (
SARRAY *)ERROR_PTR(
"no barcode(s) found", __func__, NULL);
190 l_float32 angle, conf;
193 PIX *pix1, *pix2, *pix3;
196 if (!pixs || pixGetDepth(pixs) != 8 || pixGetColormap(pixs))
197 return (
PIXA *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, NULL);
202 L_INFO(
"%d possible barcode(s) found\n", __func__, n);
212 pixDisplay(pix2, 100, 100);
213 pixDisplay(pix1, 800, 100);
219 for (i = 0; i < n; i++) {
222 if (!pix3) conf = 0.0;
223 L_INFO(
"angle = %6.2f, conf = %6.2f\n", __func__, angle, conf);
237 pixWrite(
"/tmp/lept/pix3.png", pix3, IFF_PNG);
264 char emptystring[] =
"";
265 l_int32 w, h, i, j, n, nbars, ival;
270 if (psaw) *psaw = NULL;
272 return (
SARRAY *)ERROR_PTR(
"pixa not defined", __func__, NULL);
274 return (
SARRAY *)ERROR_PTR(
"unsupported format", __func__, NULL);
275 if (method != L_USE_WIDTHS && method != L_USE_WINDOWS)
276 return (
SARRAY *)ERROR_PTR(
"invalid method", __func__, NULL);
281 for (i = 0; i < n; i++) {
285 if (w < MIN_BC_WIDTH || h < MIN_BC_HEIGHT) {
286 L_ERROR(
"pix is too small: w = %d, h = %d\n", __func__, w, h);
293 ERROR_INT(
"valid barcode widths not returned", __func__, 1);
299 barstr = (
char *)LEPT_CALLOC(nbars + 1,
sizeof(
char));
300 for (j = 0; j < nbars; j++) {
302 barstr[j] = 0x30 + ival;
310 ERROR_INT(
"barcode not decoded", __func__, 1);
321 return (
SARRAY *)ERROR_PTR(
"no valid barcode data", __func__, NULL);
349 return (
NUMA *)ERROR_PTR(
"pixs not defined", __func__, NULL);
350 if (pixGetDepth(pixs) != 8)
351 return (
NUMA *)ERROR_PTR(
"pixs not 8 bpp", __func__, NULL);
352 if (method != L_USE_WIDTHS && method != L_USE_WINDOWS)
353 return (
NUMA *)ERROR_PTR(
"invalid method", __func__, NULL);
356 if (method == L_USE_WIDTHS)
363 if (method == L_USE_WINDOWS)
364 lept_stderr(
"Window width for barcode: %7.3f\n", winwidth);
369 return (
NUMA *)ERROR_PTR(
"barcode widths invalid", __func__, NULL);
394 PIX *pix8, *pixe, *pixb, *pixm;
397 return (
BOXA *)ERROR_PTR(
"pixs not defined", __func__, NULL);
400 if (pixGetDepth(pixs) == 8 && !pixGetColormap(pixs))
451 PIX *pixt1, *pixt2, *pixd;
453 if (!pixs || pixGetDepth(pixs) != 1)
454 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
459 pixXor(pixt2, pixt2, pixt1);
466 pixXor(pixd, pixd, pixt1);
471 pixOr(pixd, pixd, pixt2);
508 l_int32 x, y, w, h, n;
509 l_float32 angle, angle1, angle2, conf, conf1, conf2, score1, score2, deg2rad;
512 PIX *pix1, *pix2, *pix3, *pix4, *pix5, *pix6, *pixd;
514 if (pangle) *pangle = 0.0;
515 if (pconf) *pconf = 0.0;
516 if (!pixs || pixGetDepth(pixs) != 8)
517 return (
PIX *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, NULL);
518 if (!pixb || pixGetDepth(pixb) != 1)
519 return (
PIX *)ERROR_PTR(
"pixb undefined or not 1 bpp", __func__, NULL);
521 return (
PIX *)ERROR_PTR(
"box not defined or 1 bpp", __func__, NULL);
524 deg2rad = 3.1415926535 / 180.;
526 box2 =
boxCreate(x - 25, y - 25, w + 51, h + 51);
535 1, 1, 0.0, 45.0, 2.5, 0.01);
537 1, 1, 0.0, 45.0, 2.5, 0.01);
548 if (score1 >= score2) {
550 if (conf1 > 6.0 && L_ABS(angle1) > 0.1) {
561 if (conf2 > 6.0 && L_ABS(angle2) > 0.1) {
562 angle = 90.0 + angle2;
576 L_WARNING(
"barcode mask in %d components\n", __func__, n);
583 box2 =
boxCreate(x - margin, y - margin, w + 2 * margin,
592 if (pangle) *pangle = angle;
593 if (pconf) *pconf = conf;
596 L_ERROR(
"pixd not made\n", __func__);
637 if (pnaehist) *pnaehist = NULL;
638 if (pnaohist) *pnaohist = NULL;
639 if (!pixs || pixGetDepth(pixs) != 8)
640 return (
NUMA *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, NULL);
644 return (
NUMA *)ERROR_PTR(
"nac not made", __func__, NULL);
648 pnaohist, debugflag);
690 if (pwidth) *pwidth = 0;
691 if (pnac) *pnac = NULL;
692 if (!pixs || pixGetDepth(pixs) != 8)
693 return (
NUMA *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, NULL);
697 return (
NUMA *)ERROR_PTR(
"nacp not made", __func__, NULL);
727 l_float32 bestthresh;
729 NUMA *nas, *nax, *nay, *nad;
731 if (!pixs || pixGetDepth(pixs) != 8)
732 return (
NUMA *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, NULL);
736 return (
NUMA *)ERROR_PTR(
"nas not made", __func__, NULL);
739 w = pixGetWidth(pixs);
741 (l_float32)(w - 1), 4 * w + 1, &nax, &nay);
745 gplot =
gplotCreate(
"/tmp/lept/barcode/signal", GPLOT_PNG,
746 "Pixel values",
"dist in pixels",
"value");
764 L_ERROR(
"Only %d crossings; failure\n", __func__,
numaGetCount(nad));
785 l_int32 w, h, first, last, i, j, wpl, val;
786 l_uint32 *line, *data;
790 if (!pixs || pixGetDepth(pixs) != 8)
791 return (
NUMA *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, NULL);
799 first = (h - nscans) / 2;
800 last = first + nscans - 1;
806 wpl = pixGetWpl(pixs);
808 for (j = 0; j < w; j++) {
809 for (i = first; i <= last; i++) {
810 line = data + i * wpl;
814 array[j] = array[j] / (l_float32)nscans;
854 l_int32 i, n, ret, ned, nod, iw, width;
855 l_float32 val, minsize, maxsize, factor;
857 NUMA *naedist, *naodist, *naehist, *naohist, *naecent, *naocent;
858 NUMA *naerange, *naorange, *naelut, *naolut, *nad;
860 if (pnaehist) *pnaehist = NULL;
861 if (pnaohist) *pnaohist = NULL;
863 return (
NUMA *)ERROR_PTR(
"nas not defined", __func__, NULL);
866 return (
NUMA *)ERROR_PTR(
"n < 10", __func__, NULL);
868 return (
NUMA *)ERROR_PTR(
"binfract <= 0.0", __func__, NULL);
873 if (ret || minsize < 1.0 || maxsize / minsize > 8.0) {
874 L_ERROR(
"bad data, or minsize = %5.2f < 1.0 or max/min = %f > 4.0\n",
875 __func__, minsize, maxsize / minsize);
888 (1.25 / binfract) * maxsize);
890 (1.25 / binfract) * maxsize);
894 gplot =
gplotCreate(
"/tmp/lept/barcode/histw", GPLOT_PNG,
895 "Raw width histogram",
"Width",
"Number");
896 gplotAddPlot(gplot, NULL, naehist, GPLOT_LINES,
"plot black");
897 gplotAddPlot(gplot, NULL, naohist, GPLOT_LINES,
"plot white");
904 1.0 / binfract, 0.0);
906 1.0 / binfract, 0.0);
926 L_WARNING(
"ned != nod + 1\n", __func__);
927 factor = 1.0 / (binfract * minsize);
928 for (i = 0; i < ned - 1; i++) {
930 width = (l_int32)(factor * val);
936 width = (l_int32)(factor * val);
943 width = (l_int32)(factor * val);
948 lept_stderr(
" ---- Black bar widths (pixels) ------ \n");
950 lept_stderr(
" ---- Histogram of black bar widths ------ \n");
952 lept_stderr(
" ---- Peak ranges in black bar histogram bins --- \n");
954 lept_stderr(
" ---- Peak black bar centroid width values ------ \n");
956 lept_stderr(
" ---- Black bar lookup table ------ \n");
958 lept_stderr(
" ---- White bar widths (pixels) ------ \n");
960 lept_stderr(
" ---- Histogram of white bar widths ------ \n");
962 lept_stderr(
" ---- Peak ranges in white bar histogram bins --- \n");
964 lept_stderr(
" ---- Peak white bar centroid width values ------ \n");
966 lept_stderr(
" ---- White bar lookup table ------ \n");
1004 l_float32 *pmindist,
1005 l_float32 *pmaxdist)
1008 l_float32 val, newval, mindist, maxdist;
1009 NUMA *na1, *na2, *naedist, *naodist;
1011 if (pnaedist) *pnaedist = NULL;
1012 if (pnaodist) *pnaodist = NULL;
1013 if (pmindist) *pmindist = 0.0;
1014 if (pmaxdist) *pmaxdist = 0.0;
1016 return ERROR_INT(
"nas not defined", __func__, 1);
1018 return ERROR_INT(
"n < 2", __func__, 1);
1027 for (i = 1; i < n; i++) {
1044 L_INFO(
"mindist = %7.3f, maxdist = %7.3f\n", __func__, mindist, maxdist);
1047 *pnaedist = naedist;
1051 *pnaodist = naodist;
1054 if (pmindist) *pmindist = mindist;
1055 if (pmaxdist) *pmaxdist = maxdist;
1094 l_int32 i, n, inpeak, left;
1095 l_float32 center, prevcenter, val;
1099 return (
NUMA *)ERROR_PTR(
"nas not defined", __func__, NULL);
1104 prevcenter = minfirst - minsep - 1.0;
1105 for (i = 0; i < n; i++) {
1107 if (inpeak == FALSE && val > maxmin) {
1110 }
else if (inpeak == TRUE && val <= maxmin) {
1111 center = (left + i - 1.0) / 2.0;
1112 if (center - prevcenter >= minsep) {
1116 prevcenter = center;
1122 if (inpeak == TRUE) {
1143 l_int32 i, j, nr, low, high;
1144 l_float32 cent, sum, val;
1148 return (
NUMA *)ERROR_PTR(
"nahist not defined", __func__, NULL);
1150 return (
NUMA *)ERROR_PTR(
"narange not defined", __func__, NULL);
1154 for (i = 0; i < nr; i++) {
1159 for (j = low; j <= high; j++) {
1192 l_int32 i, j, nc, low, high, imax;
1195 l_float32 max, rat21, rat32, rat42;
1199 return (
NUMA *)ERROR_PTR(
"narange not defined", __func__, NULL);
1201 return (
NUMA *)ERROR_PTR(
"nacent not defined", __func__, NULL);
1203 if (nc < 1 || nc > 4)
1204 return (
NUMA *)ERROR_PTR(
"nc must be 1, 2, 3, or 4", __func__, NULL);
1213 return (
NUMA *)ERROR_PTR(
"first peak has width 0.0",
1215 rat21 = warray[1] / warray[0];
1216 if (rat21 < 1.5 || rat21 > 2.6)
1217 L_WARNING(
"width ratio 2/1 = %f\n", __func__, rat21);
1219 rat32 = warray[2] / warray[1];
1220 if (rat32 < 1.3 || rat32 > 2.25)
1221 L_WARNING(
"width ratio 3/2 = %f\n", __func__, rat32);
1224 rat42 = warray[3] / warray[1];
1225 if (rat42 < 1.7 || rat42 > 2.3)
1226 L_WARNING(
"width ratio 4/2 = %f\n", __func__, rat42);
1232 for (i = 0; i < 4; i++)
1241 imax = (l_int32)max;
1244 for (i = 0; i < nc; i++) {
1248 for (j = low; j <= high; j++)
1282 l_float32 *pfirstloc,
1286 l_int32 i, nw, started, count, trans;
1287 l_float32 minsize, minwidth, minshift, xfirst;
1291 return (
NUMA *)ERROR_PTR(
"nas not defined", __func__, NULL);
1293 return (
NUMA *)ERROR_PTR(
"nas size < 2", __func__, NULL);
1302 &minwidth, &minshift, NULL);
1306 &minwidth, &minshift, NULL);
1308 L_INFO(
"best width = %7.3f, best shift = %7.3f\n",
1309 __func__, minwidth, minshift);
1313 if (pwidth) *pwidth = minwidth;
1316 *pfirstloc = xfirst + minshift;
1324 for (i = 0; i < nw; i++) {
1327 L_WARNING(
"trans = %d > 2 !!!\n", __func__, trans);
1341 if (!started && trans) {
1384 l_float32 *pbestwidth,
1385 l_float32 *pbestshift,
1386 l_float32 *pbestscore)
1389 l_float32 delwidth, delshift, width, shift, score;
1390 l_float32 bestwidth, bestshift, bestscore;
1393 return ERROR_INT(
"nas not defined", __func__, 1);
1394 if (!pbestwidth || !pbestshift)
1395 return ERROR_INT(
"&bestwidth and &bestshift not defined", __func__, 1);
1400 delwidth = (maxwidth - minwidth) / (nwidth - 1.0);
1401 for (i = 0; i < nwidth; i++) {
1402 width = minwidth + delwidth * i;
1403 delshift = width / (l_float32)(nshift);
1404 for (j = 0; j < nshift; j++) {
1405 shift = -0.5 * (width - delshift) + j * delshift;
1407 if (score < bestscore) {
1412 lept_stderr(
"width = %7.3f, shift = %7.3f, score = %7.3f\n",
1413 width, shift, score);
1419 *pbestwidth = bestwidth;
1420 *pbestshift = bestshift;
1422 *pbestscore = bestscore;
1459 l_int32 i, n, nc, nw, ival;
1461 l_float32 score, xfirst, xlast, xleft, xc, xwc;
1465 return ERROR_INT(
"nas not defined", __func__, 1);
1467 return ERROR_INT(
"nas size < 2", __func__, 1);
1468 if (ifirst < 0) ifirst = 0;
1469 if (ilast <= 0) ilast = n - 1;
1470 if (ifirst >= ilast)
1471 return ERROR_INT(
"ifirst not < ilast", __func__, 1);
1472 nc = ilast - ifirst + 1;
1479 nw = (l_int32) ((xlast - xfirst + 2.0 * width) / width);
1482 xleft = xfirst - width / 2.0 + shift;
1483 for (i = ifirst; i <= ilast; i++) {
1485 iw = (l_int32)((xc - xleft) / width);
1486 xwc = xleft + (iw + 0.5) * width;
1487 score += (xwc - xc) * (xwc - xc);
1493 *pscore = 4.0 * score / (width * width * (l_float32)nc);
#define GET_DATA_BYTE(pdata, n)
char * barcodeDispatchDecoder(char *barstr, l_int32 format, l_int32 debugflag)
barcodeDispatchDecoder()
l_int32 barcodeFormatIsSupported(l_int32 format)
barcodeFormatIsSupported()
l_ok boxGetGeometry(const BOX *box, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph)
boxGetGeometry()
BOXA * boxaCopy(BOXA *boxa, l_int32 copyflag)
boxaCopy()
void boxDestroy(BOX **pbox)
boxDestroy()
l_ok boxaWriteStderr(BOXA *boxa)
boxaWriteStderr()
void boxaDestroy(BOXA **pboxa)
boxaDestroy()
l_int32 boxaGetCount(const BOXA *boxa)
boxaGetCount()
BOX * boxaGetBox(BOXA *boxa, l_int32 index, l_int32 accessflag)
boxaGetBox()
BOX * boxCreate(l_int32 x, l_int32 y, l_int32 w, l_int32 h)
boxCreate()
BOXA * boxaSort(BOXA *boxas, l_int32 sorttype, l_int32 sortorder, NUMA **pnaindex)
boxaSort()
BOXA * pixConnComp(PIX *pixs, PIXA **ppixa, l_int32 connectivity)
pixConnComp()
PIX * pixSobelEdgeFilter(PIX *pixs, l_int32 orientflag)
pixSobelEdgeFilter()
l_ok gplotAddPlot(GPLOT *gplot, NUMA *nax, NUMA *nay, l_int32 plotstyle, const char *plotlabel)
gplotAddPlot()
l_ok gplotMakeOutput(GPLOT *gplot)
gplotMakeOutput()
GPLOT * gplotCreate(const char *rootname, l_int32 outformat, const char *title, const char *xlabel, const char *ylabel)
gplotCreate()
void gplotDestroy(GPLOT **pgplot)
gplotDestroy()
PIX * pixThresholdToBinary(PIX *pixs, l_int32 thresh)
pixThresholdToBinary()
PIX * pixOpenBrick(PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize)
pixOpenBrick()
PIX * pixCloseBrick(PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize)
pixCloseBrick()
l_ok numaAddNumber(NUMA *na, l_float32 val)
numaAddNumber()
l_ok numaGetFValue(NUMA *na, l_int32 index, l_float32 *pval)
numaGetFValue()
l_ok numaWriteStderr(NUMA *na)
numaWriteStderr()
NUMA * numaCreate(l_int32 n)
numaCreate()
l_ok numaSetCount(NUMA *na, l_int32 newcount)
numaSetCount()
void numaDestroy(NUMA **pna)
numaDestroy()
l_ok numaSetValue(NUMA *na, l_int32 index, l_float32 val)
numaSetValue()
l_int32 numaGetCount(NUMA *na)
numaGetCount()
l_ok numaGetIValue(NUMA *na, l_int32 index, l_int32 *pival)
numaGetIValue()
NUMA * numaCopy(NUMA *na)
numaCopy()
l_float32 * numaGetFArray(NUMA *na, l_int32 copyflag)
numaGetFArray()
l_ok numaInterpolateEqxInterval(l_float32 startx, l_float32 deltax, NUMA *nasy, l_int32 type, l_float32 x0, l_float32 x1, l_int32 npts, NUMA **pnax, NUMA **pnay)
numaInterpolateEqxInterval()
l_ok numaJoin(NUMA *nad, NUMA *nas, l_int32 istart, l_int32 iend)
numaJoin()
l_ok numaGetMax(NUMA *na, l_float32 *pmaxval, l_int32 *pimaxloc)
numaGetMax()
NUMA * numaMakeHistogram(NUMA *na, l_int32 maxbins, l_int32 *pbinsize, l_int32 *pbinstart)
numaMakeHistogram()
l_ok numaSelectCrossingThreshold(NUMA *nax, NUMA *nay, l_float32 estthresh, l_float32 *pbestthresh)
numaSelectCrossingThreshold()
NUMA * numaMakeHistogramClipped(NUMA *na, l_float32 binsize, l_float32 maxsize)
numaMakeHistogramClipped()
l_ok numaHistogramGetValFromRank(NUMA *na, l_float32 rank, l_float32 *prval)
numaHistogramGetValFromRank()
NUMA * numaCrossingsByThreshold(NUMA *nax, NUMA *nay, l_float32 thresh)
numaCrossingsByThreshold()
l_uint32 * pixGetData(PIX *pix)
pixGetData()
void pixDestroy(PIX **ppix)
pixDestroy()
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
PIX * pixClone(PIX *pixs)
pixClone()
PIX * pixInvert(PIX *pixd, PIX *pixs)
pixInvert()
PIX * pixOr(PIX *pixd, PIX *pixs1, PIX *pixs2)
pixOr()
PIX * pixXor(PIX *pixd, PIX *pixs1, PIX *pixs2)
pixXor()
PIX * pixClipRectangle(PIX *pixs, BOX *box, BOX **pboxc)
pixClipRectangle()
l_ok pixaAddPix(PIXA *pixa, PIX *pix, l_int32 copyflag)
pixaAddPix()
void pixaDestroy(PIXA **ppixa)
pixaDestroy()
PIXA * pixaCreate(l_int32 n)
pixaCreate()
l_int32 pixaGetCount(PIXA *pixa)
pixaGetCount()
l_ok pixaAddBox(PIXA *pixa, BOX *box, l_int32 copyflag)
pixaAddBox()
PIX * pixaGetPix(PIXA *pixa, l_int32 index, l_int32 accesstype)
pixaGetPix()
PIX * pixaDisplayTiledInRows(PIXA *pixa, l_int32 outdepth, l_int32 maxwidth, l_float32 scalefactor, l_int32 background, l_int32 spacing, l_int32 border)
pixaDisplayTiledInRows()
PIX * pixConvertTo8(PIX *pixs, l_int32 cmapflag)
pixConvertTo8()
NUMA * pixReadBarcodeWidths(PIX *pixs, l_int32 method, l_int32 debugflag)
pixReadBarcodeWidths()
static l_int32 numaGetCrossingDistances(NUMA *nas, NUMA **pnaedist, NUMA **pnaodist, l_float32 *pmindist, l_float32 *pmaxdist)
numaGetCrossingDistances()
NUMA * numaQuantizeCrossingsByWindow(NUMA *nas, l_float32 ratio, l_float32 *pwidth, l_float32 *pfirstloc, NUMA **pnac, l_int32 debugflag)
numaQuantizeCrossingsByWindow()
static NUMA * pixAverageRasterScans(PIX *pixs, l_int32 nscans)
pixAverageRasterScans()
PIX * pixDeskewBarcode(PIX *pixs, PIX *pixb, BOX *box, l_int32 margin, l_int32 threshold, l_float32 *pangle, l_float32 *pconf)
pixDeskewBarcode()
static l_int32 numaEvalBestWidthAndShift(NUMA *nas, l_int32 nwidth, l_int32 nshift, l_float32 minwidth, l_float32 maxwidth, l_float32 *pbestwidth, l_float32 *pbestshift, l_float32 *pbestscore)
numaEvalBestWidthAndShift()
NUMA * pixExtractBarcodeWidths2(PIX *pixs, l_float32 thresh, l_float32 *pwidth, NUMA **pnac, l_int32 debugflag)
pixExtractBarcodeWidths2()
NUMA * pixExtractBarcodeWidths1(PIX *pixs, l_float32 thresh, l_float32 binfract, NUMA **pnaehist, NUMA **pnaohist, l_int32 debugflag)
pixExtractBarcodeWidths1()
BOXA * pixLocateBarcodes(PIX *pixs, l_int32 thresh, PIX **ppixb, PIX **ppixm)
pixLocateBarcodes()
PIXA * pixExtractBarcodes(PIX *pixs, l_int32 debugflag)
pixExtractBarcodes()
NUMA * numaQuantizeCrossingsByWidth(NUMA *nas, l_float32 binfract, NUMA **pnaehist, NUMA **pnaohist, l_int32 debugflag)
numaQuantizeCrossingsByWidth()
NUMA * pixExtractBarcodeCrossings(PIX *pixs, l_float32 thresh, l_int32 debugflag)
pixExtractBarcodeCrossings()
static NUMA * numaLocatePeakRanges(NUMA *nas, l_float32 minfirst, l_float32 minsep, l_float32 maxmin)
numaLocatePeakRanges()
static PIX * pixGenerateBarcodeMask(PIX *pixs, l_int32 maxspace, l_int32 nwidth, l_int32 nheight)
pixGenerateBarcodeMask()
static NUMA * numaGetPeakCentroids(NUMA *nahist, NUMA *narange)
numaGetPeakCentroids()
SARRAY * pixReadBarcodes(PIXA *pixa, l_int32 format, l_int32 method, SARRAY **psaw, l_int32 debugflag)
pixReadBarcodes()
static NUMA * numaGetPeakWidthLUT(NUMA *narange, NUMA *nacent)
numaGetPeakWidthLUT()
static l_int32 numaEvalSyncError(NUMA *nas, l_int32 ifirst, l_int32 ilast, l_float32 width, l_float32 shift, l_float32 *pscore, NUMA **pnad)
numaEvalSyncError()
SARRAY * pixProcessBarcodes(PIX *pixs, l_int32 format, l_int32 method, SARRAY **psaw, l_int32 debugflag)
pixProcessBarcodes()
PIX * pixRotate(PIX *pixs, l_float32 angle, l_int32 type, l_int32 incolor, l_int32 width, l_int32 height)
pixRotate()
PIX * pixRotateOrth(PIX *pixs, l_int32 quads)
pixRotateOrth()
SARRAY * sarrayCreate(l_int32 n)
sarrayCreate()
l_int32 sarrayGetCount(SARRAY *sa)
sarrayGetCount()
void sarrayDestroy(SARRAY **psa)
sarrayDestroy()
l_ok sarrayAddString(SARRAY *sa, const char *string, l_int32 copyflag)
sarrayAddString()
l_ok pixFindSkewSweepAndSearchScore(PIX *pixs, l_float32 *pangle, l_float32 *pconf, l_float32 *pendscore, l_int32 redsweep, l_int32 redsearch, l_float32 sweepcenter, l_float32 sweeprange, l_float32 sweepdelta, l_float32 minbsdelta)
pixFindSkewSweepAndSearchScore()
void lept_stderr(const char *fmt,...)
lept_stderr()
l_int32 lept_mkdir(const char *subdir)
lept_mkdir()