84#include <config_auto.h>
88#include "allheaders.h"
89#include "readbarcode.h"
92static const l_int32 MAX_SPACE_WIDTH = 19;
93static const l_int32 MAX_NOISE_WIDTH = 50;
94static const l_int32 MAX_NOISE_HEIGHT = 30;
97static const l_int32 MIN_BC_WIDTH = 50;
98static 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);
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);
155 if (format != L_BF_ANY && !barcodeFormatIsSupported(format))
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))
162 pixg = pixClone(pixs);
164 pixg = pixConvertTo8(pixs, 0);
169 return (
SARRAY *)ERROR_PTR(
"no barcode(s) found", __func__, NULL);
190l_float32 angle, conf;
193PIX *pix1, *pix2, *pix3;
196 if (!pixs || pixGetDepth(pixs) != 8 || pixGetColormap(pixs))
197 return (
PIXA *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, NULL);
201 n = boxaGetCount(boxa);
202 L_INFO(
"%d possible barcode(s) found\n", __func__, n);
211 boxaWriteStderr(boxa);
212 pixDisplay(pix2, 100, 100);
213 pixDisplay(pix1, 800, 100);
218 pixa = pixaCreate(n);
219 for (i = 0; i < n; i++) {
220 box = boxaGetBox(boxa, i,
L_CLONE);
222 if (!pix3) conf = 0.0;
223 L_INFO(
"angle = %6.2f, conf = %6.2f\n", __func__, angle, conf);
236 pix3 = pixaDisplayTiledInRows(pixa, 8, 1000, 1.0, 0, 30, 2);
237 pixWrite(
"/tmp/lept/pix3.png", pix3, IFF_PNG);
264char emptystring[] =
"";
265l_int32 w, h, i, j, n, nbars, ival;
270 if (psaw) *psaw = NULL;
272 return (
SARRAY *)ERROR_PTR(
"pixa not defined", __func__, NULL);
273 if (format != L_BF_ANY && !barcodeFormatIsSupported(format))
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);
278 n = pixaGetCount(pixa);
279 saw = sarrayCreate(n);
280 sad = sarrayCreate(n);
281 for (i = 0; i < n; i++) {
283 pix1 = pixaGetPix(pixa, i,
L_CLONE);
284 pixGetDimensions(pix1, &w, &h, NULL);
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);
298 nbars = numaGetCount(na);
299 barstr = (
char *)LEPT_CALLOC(nbars + 1,
sizeof(
char));
300 for (j = 0; j < nbars; j++) {
301 numaGetIValue(na, j, &ival);
302 barstr[j] = 0x30 + ival;
304 sarrayAddString(saw, barstr,
L_INSERT);
308 data = barcodeDispatchDecoder(barstr, format, debugflag);
310 ERROR_INT(
"barcode not decoded", __func__, 1);
311 sarrayAddString(sad, emptystring,
L_COPY);
314 sarrayAddString(sad, data,
L_INSERT);
318 if (sarrayGetCount(saw) == 0) {
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);
394PIX *pix8, *pixe, *pixb, *pixm;
397 return (
BOXA *)ERROR_PTR(
"pixs not defined", __func__, NULL);
400 if (pixGetDepth(pixs) == 8 && !pixGetColormap(pixs))
401 pix8 = pixClone(pixs);
403 pix8 = pixConvertTo8(pixs, 0);
407 pixb = pixThresholdToBinary(pixe, thresh);
408 pixInvert(pixb, pixb);
414 boxa = pixConnComp(pixm, NULL, 8);
451PIX *pixt1, *pixt2, *pixd;
453 if (!pixs || pixGetDepth(pixs) != 1)
454 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
457 pixt1 = pixCloseBrick(NULL, pixs, maxspace + 1, 1);
458 pixt2 = pixOpenBrick(NULL, pixs, maxspace + 1, 1);
459 pixXor(pixt2, pixt2, pixt1);
460 pixOpenBrick(pixt2, pixt2, nwidth, nheight);
464 pixt1 = pixCloseBrick(NULL, pixs, 1, maxspace + 1);
465 pixd = pixOpenBrick(NULL, pixs, 1, maxspace + 1);
466 pixXor(pixd, pixd, pixt1);
467 pixOpenBrick(pixd, pixd, nheight, nwidth);
471 pixOr(pixd, pixd, pixt2);
508l_int32 x, y, w, h, n;
509l_float32 angle, angle1, angle2, conf, conf1, conf2, score1, score2, deg2rad;
512PIX *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.1415926535f / 180.f;
525 boxGetGeometry(box, &x, &y, &w, &h);
526 box2 = boxCreate(x - 25, y - 25, w + 51, h + 51);
527 pix1 = pixClipRectangle(pixb, box2, NULL);
528 pix2 = pixClipRectangle(pixs, box2, NULL);
532 pix3 = pixRotateOrth(pix1, 1);
533 pix4 = pixClone(pix1);
534 pixFindSkewSweepAndSearchScore(pix3, &angle1, &conf1, &score1,
535 1, 1, 0.0f, 45.0f, 2.5f, 0.01f);
536 pixFindSkewSweepAndSearchScore(pix4, &angle2, &conf2, &score2,
537 1, 1, 0.0f, 45.0f, 2.5f, 0.01f);
548 if (score1 >= score2) {
550 if (conf1 > 6.0 && L_ABS(angle1) > 0.1) {
556 pix5 = pixClone(pix2);
560 pix6 = pixRotateOrth(pix2, 1);
561 if (conf2 > 6.0 && L_ABS(angle2) > 0.1) {
562 angle = 90.0 + angle2;
567 pix5 = pixClone(pix6);
575 if ((n = boxaGetCount(boxa1)) != 1) {
576 L_WARNING(
"barcode mask in %d components\n", __func__, n);
579 boxa2 = boxaCopy(boxa1,
L_CLONE);
581 box1 = boxaGetBox(boxa2, 0,
L_CLONE);
582 boxGetGeometry(box1, &x, &y, &w, &h);
583 box2 = boxCreate(x - margin, y - margin, w + 2 * margin,
585 pixd = pixClipRectangle(pix5, box2, NULL);
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);
729NUMA *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);
744 lept_mkdir(
"lept/barcode");
745 gplot = gplotCreate(
"/tmp/lept/barcode/signal", GPLOT_PNG,
746 "Pixel values",
"dist in pixels",
"value");
747 gplotAddPlot(gplot, nax, nay, GPLOT_LINES,
"plot 1");
748 gplotMakeOutput(gplot);
749 gplotDestroy(&gplot);
755 numaSelectCrossingThreshold(nax, nay, thresh, &bestthresh);
758 nad = numaCrossingsByThreshold(nax, nay, bestthresh);
763 if (numaGetCount(nad) < 10) {
764 L_ERROR(
"Only %d crossings; failure\n", __func__, numaGetCount(nad));
785l_int32 w, h, first, last, i, j, wpl, val;
786l_uint32 *line, *data;
790 if (!pixs || pixGetDepth(pixs) != 8)
791 return (
NUMA *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, NULL);
793 pixGetDimensions(pixs, &w, &h, NULL);
799 first = (h - nscans) / 2;
800 last = first + nscans - 1;
804 numaSetCount(nad, w);
805 array = numaGetFArray(nad,
L_NOCOPY);
806 wpl = pixGetWpl(pixs);
807 data = pixGetData(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;
854l_int32 i, n, ret, ned, nod, iw, width;
855l_float32 val, minsize, maxsize, factor;
857NUMA *naedist, *naodist, *naehist, *naohist, *naecent, *naocent;
858NUMA *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);
864 n = numaGetCount(nas);
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);
876 numaDestroy(&naedist);
877 numaDestroy(&naodist);
887 naehist = numaMakeHistogramClipped(naedist, binfract * minsize,
888 (1.25 / binfract) * maxsize);
889 naohist = numaMakeHistogramClipped(naodist, binfract * minsize,
890 (1.25 / binfract) * maxsize);
893 lept_mkdir(
"lept/barcode");
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");
898 gplotMakeOutput(gplot);
899 gplotDestroy(&gplot);
904 1.0 / binfract, 0.0);
906 1.0 / binfract, 0.0);
923 ned = numaGetCount(naedist);
924 nod = numaGetCount(naodist);
926 L_WARNING(
"ned != nod + 1\n", __func__);
927 factor = 1.0 / (binfract * minsize);
928 for (i = 0; i < ned - 1; i++) {
929 numaGetFValue(naedist, i, &val);
930 width = (l_int32)(factor * val);
931 numaGetIValue(naelut, width, &iw);
932 numaAddNumber(nad, iw);
935 numaGetFValue(naodist, i, &val);
936 width = (l_int32)(factor * val);
937 numaGetIValue(naolut, width, &iw);
938 numaAddNumber(nad, iw);
942 numaGetFValue(naedist, ned - 1, &val);
943 width = (l_int32)(factor * val);
944 numaGetIValue(naelut, width, &iw);
945 numaAddNumber(nad, iw);
948 lept_stderr(
" ---- Black bar widths (pixels) ------ \n");
949 numaWriteStderr(naedist);
950 lept_stderr(
" ---- Histogram of black bar widths ------ \n");
951 numaWriteStderr(naehist);
952 lept_stderr(
" ---- Peak ranges in black bar histogram bins --- \n");
953 numaWriteStderr(naerange);
954 lept_stderr(
" ---- Peak black bar centroid width values ------ \n");
955 numaWriteStderr(naecent);
956 lept_stderr(
" ---- Black bar lookup table ------ \n");
957 numaWriteStderr(naelut);
958 lept_stderr(
" ---- White bar widths (pixels) ------ \n");
959 numaWriteStderr(naodist);
960 lept_stderr(
" ---- Histogram of white bar widths ------ \n");
961 numaWriteStderr(naohist);
962 lept_stderr(
" ---- Peak ranges in white bar histogram bins --- \n");
963 numaWriteStderr(naorange);
964 lept_stderr(
" ---- Peak white bar centroid width values ------ \n");
965 numaWriteStderr(naocent);
966 lept_stderr(
" ---- White bar lookup table ------ \n");
967 numaWriteStderr(naolut);
970 numaDestroy(&naedist);
971 numaDestroy(&naodist);
972 numaDestroy(&naerange);
973 numaDestroy(&naorange);
974 numaDestroy(&naecent);
975 numaDestroy(&naocent);
976 numaDestroy(&naelut);
977 numaDestroy(&naolut);
981 numaDestroy(&naehist);
985 numaDestroy(&naohist);
1004 l_float32 *pmindist,
1005 l_float32 *pmaxdist)
1008l_float32 val, newval, mindist, maxdist;
1009NUMA *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);
1017 if ((n = numaGetCount(nas)) < 2)
1018 return ERROR_INT(
"n < 2", __func__, 1);
1024 naedist = numaCreate(n / 2 + 1);
1025 naodist = numaCreate(n / 2);
1026 numaGetFValue(nas, 0, &val);
1027 for (i = 1; i < n; i++) {
1028 numaGetFValue(nas, i, &newval);
1030 numaAddNumber(naedist, newval - val);
1032 numaAddNumber(naodist, newval - val);
1037 na1 = numaCopy(naedist);
1038 numaJoin(na1, naodist, 0, -1);
1039 na2 = numaMakeHistogram(na1, 100, NULL, NULL);
1040 numaHistogramGetValFromRank(na2, 0.1f, &mindist);
1041 numaHistogramGetValFromRank(na2, 0.9f, &maxdist);
1044 L_INFO(
"mindist = %7.3f, maxdist = %7.3f\n", __func__, mindist, maxdist);
1047 *pnaedist = naedist;
1049 numaDestroy(&naedist);
1051 *pnaodist = naodist;
1053 numaDestroy(&naodist);
1054 if (pmindist) *pmindist = mindist;
1055 if (pmaxdist) *pmaxdist = maxdist;
1094l_int32 i, n, inpeak, left;
1095l_float32 center, prevcenter, val;
1099 return (
NUMA *)ERROR_PTR(
"nas not defined", __func__, NULL);
1100 n = numaGetCount(nas);
1101 nad = numaCreate(0);
1104 prevcenter = minfirst - minsep - 1.0;
1105 for (i = 0; i < n; i++) {
1106 numaGetFValue(nas, i, &val);
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) {
1114 numaAddNumber(nad, left);
1115 numaAddNumber(nad, i - 1);
1116 prevcenter = center;
1118 numaSetValue(nad, numaGetCount(nad) - 1, i - 1);
1122 if (inpeak == TRUE) {
1123 numaAddNumber(nad, left);
1124 numaAddNumber(nad, n - 1);
1143l_int32 i, j, nr, low, high;
1144l_float32 cent, sum, val;
1148 return (
NUMA *)ERROR_PTR(
"nahist not defined", __func__, NULL);
1150 return (
NUMA *)ERROR_PTR(
"narange not defined", __func__, NULL);
1151 nr = numaGetCount(narange) / 2;
1153 nad = numaCreate(4);
1154 for (i = 0; i < nr; i++) {
1155 numaGetIValue(narange, 2 * i, &low);
1156 numaGetIValue(narange, 2 * i + 1, &high);
1159 for (j = low; j <= high; j++) {
1160 numaGetFValue(nahist, j, &val);
1164 numaAddNumber(nad, cent / sum);
1192l_int32 i, j, nc, low, high, imax;
1195l_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);
1202 nc = numaGetCount(nacent);
1203 if (nc < 1 || nc > 4)
1204 return (
NUMA *)ERROR_PTR(
"nc must be 1, 2, 3, or 4", __func__, NULL);
1211 warray = numaGetFArray(nacent,
L_NOCOPY);
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++)
1240 numaGetMax(narange, &max, NULL);
1241 imax = (l_int32)max;
1242 nalut = numaCreate(imax + 1);
1243 numaSetCount(nalut, imax + 1);
1244 for (i = 0; i < nc; i++) {
1245 numaGetIValue(narange, 2 * i, &low);
1247 numaGetIValue(narange, 2 * i + 1, &high);
1248 for (j = low; j <= high; j++)
1249 numaSetValue(nalut, j, assign[i]);
1282 l_float32 *pfirstloc,
1286l_int32 i, nw, started, count, trans;
1287l_float32 minsize, minwidth, minshift, xfirst;
1291 return (
NUMA *)ERROR_PTR(
"nas not defined", __func__, NULL);
1292 if (numaGetCount(nas) < 2)
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;
1315 numaGetFValue(nas, 0, &xfirst);
1316 *pfirstloc = xfirst + minshift;
1320 nad = numaCreate(0);
1321 nw = numaGetCount(nac);
1324 for (i = 0; i < nw; i++) {
1325 numaGetIValue(nac, i, &trans);
1327 L_WARNING(
"trans = %d > 2 !!!\n", __func__, trans);
1330 numaAddNumber(nad, count);
1335 numaAddNumber(nad, count);
1341 if (!started && trans) {
1344 numaAddNumber(nad, 1);
1384 l_float32 *pbestwidth,
1385 l_float32 *pbestshift,
1386 l_float32 *pbestscore)
1389l_float32 delwidth, delshift, width, shift, score;
1390l_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;
1459l_int32 i, n, nc, nw, ival;
1461l_float32 score, xfirst, xlast, xleft, xc, xwc;
1465 return ERROR_INT(
"nas not defined", __func__, 1);
1466 if ((n = numaGetCount(nas)) < 2)
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;
1477 numaGetFValue(nas, ifirst, &xfirst);
1478 numaGetFValue(nas, ilast, &xlast);
1479 nw = (l_int32) ((xlast - xfirst + 2.0 * width) / width);
1480 nad = numaCreate(nw);
1481 numaSetCount(nad, nw);
1482 xleft = xfirst - width / 2.0 + shift;
1483 for (i = ifirst; i <= ilast; i++) {
1484 numaGetFValue(nas, i, &xc);
1485 iw = (l_int32)((xc - xleft) / width);
1486 xwc = xleft + (iw + 0.5) * width;
1487 score += (xwc - xc) * (xwc - xc);
1488 numaGetIValue(nad, iw, &ival);
1489 numaSetValue(nad, iw, ival + 1);
1493 *pscore = 4.0 * score / (width * width * (l_float32)nc);
#define GET_DATA_BYTE(pdata, n)
static l_int32 numaGetCrossingDistances(NUMA *nas, NUMA **pnaedist, NUMA **pnaodist, l_float32 *pmindist, l_float32 *pmaxdist)
numaGetCrossingDistances()
static NUMA * pixAverageRasterScans(PIX *pixs, l_int32 nscans)
pixAverageRasterScans()
BOXA * pixLocateBarcodes(PIX *pixs, l_int32 thresh, PIX **ppixb, PIX **ppixm)
pixLocateBarcodes()
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 * pixReadBarcodeWidths(PIX *pixs, l_int32 method, l_int32 debugflag)
pixReadBarcodeWidths()
PIX * pixDeskewBarcode(PIX *pixs, PIX *pixb, BOX *box, l_int32 margin, l_int32 threshold, l_float32 *pangle, l_float32 *pconf)
pixDeskewBarcode()
PIXA * pixExtractBarcodes(PIX *pixs, l_int32 debugflag)
pixExtractBarcodes()
static NUMA * numaLocatePeakRanges(NUMA *nas, l_float32 minfirst, l_float32 minsep, l_float32 maxmin)
numaLocatePeakRanges()
SARRAY * pixReadBarcodes(PIXA *pixa, l_int32 format, l_int32 method, SARRAY **psaw, l_int32 debugflag)
pixReadBarcodes()
static PIX * pixGenerateBarcodeMask(PIX *pixs, l_int32 maxspace, l_int32 nwidth, l_int32 nheight)
pixGenerateBarcodeMask()
static NUMA * numaGetPeakCentroids(NUMA *nahist, NUMA *narange)
numaGetPeakCentroids()
NUMA * pixExtractBarcodeWidths1(PIX *pixs, l_float32 thresh, l_float32 binfract, NUMA **pnaehist, NUMA **pnaohist, l_int32 debugflag)
pixExtractBarcodeWidths1()
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()
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()
SARRAY * pixProcessBarcodes(PIX *pixs, l_int32 format, l_int32 method, SARRAY **psaw, l_int32 debugflag)
pixProcessBarcodes()
NUMA * numaQuantizeCrossingsByWindow(NUMA *nas, l_float32 ratio, l_float32 *pwidth, l_float32 *pfirstloc, NUMA **pnac, l_int32 debugflag)
numaQuantizeCrossingsByWindow()