39 #include <config_auto.h>
42 #include "allheaders.h"
77 l_int32 i, n, d, same;
82 PROCNAME(
"pixaThinConnected");
85 return (
PIXA *)ERROR_PTR(
"pixas not defined", procName, NULL);
87 return (
PIXA *)ERROR_PTR(
"invalid fg/bg type", procName, NULL);
88 if (connectivity != 4 && connectivity != 8)
89 return (
PIXA *)ERROR_PTR(
"connectivity not 4 or 8", procName, NULL);
90 if (maxiters == 0) maxiters = 10000;
94 return (
PIXA *)ERROR_PTR(
"pix are not all 1 bpp", procName, NULL);
96 if (connectivity == 4)
103 for (i = 0; i < n; i++) {
164 l_int32 connectivity,
170 PROCNAME(
"pixThinConnected");
173 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
174 if (pixGetDepth(pixs) != 1)
175 return (
PIX *)ERROR_PTR(
"pixs not 1 bpp", procName, NULL);
177 return (
PIX *)ERROR_PTR(
"invalid fg/bg type", procName, NULL);
178 if (connectivity != 4 && connectivity != 8)
179 return (
PIX *)ERROR_PTR(
"connectivity not 4 or 8", procName, NULL);
180 if (maxiters == 0) maxiters = 10000;
182 if (connectivity == 4)
229 l_int32 i, j, r, nsels, same;
232 PIX *pix1, *pix2, *pixd;
235 PROCNAME(
"pixThinConnectedBySet");
238 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
239 if (pixGetDepth(pixs) != 1)
240 return (
PIX *)ERROR_PTR(
"pixs not 1 bpp", procName, NULL);
242 return (
PIX *)ERROR_PTR(
"invalid fg/bg type", procName, NULL);
244 return (
PIX *)ERROR_PTR(
"sela not defined", procName, NULL);
245 if (maxiters == 0) maxiters = 10000;
250 for (i = 0; i < nsels; i++) {
257 return (
PIX *)ERROR_PTR(
"pixhmt array not made", procName, NULL);
267 for (i = 0; i < maxiters; i++) {
269 for (r = 0; r < 4; r++) {
270 for (j = 0; j < nsels; j++) {
273 pixHMT(pixhmt[j], pixd, selr);
276 pixOr(pixhmt[0], pixhmt[0], pixhmt[j]);
349 SELA *sela1, *sela2, *sela3;
351 PROCNAME(
"selaMakeThinSets");
353 if (index < 1 || index > 11)
354 return (
SELA *)ERROR_PTR(
"invalid index", procName, NULL);
468 snprintf(buf,
sizeof(buf),
"/tmp/lept/sels/set%d.png", index);
469 pixWrite(buf, pix1, IFF_PNG);
470 pixDisplay(pix1, 100, 100);
PIX * pixThinConnectedBySet(PIX *pixs, l_int32 type, SELA *sela, l_int32 maxiters)
pixThinConnectedBySet()
PIX * pixThinConnected(PIX *pixs, l_int32 type, l_int32 connectivity, l_int32 maxiters)
pixThinConnected()
PIXA * pixaThinConnected(PIXA *pixas, l_int32 type, l_int32 connectivity, l_int32 maxiters)
pixaThinConnected()
SELA * selaMakeThinSets(l_int32 index, l_int32 debug)
selaMakeThinSets()
l_ok pixEqual(PIX *pix1, PIX *pix2, l_int32 *psame)
pixEqual()
PIX * pixHMT(PIX *pixd, PIX *pixs, SEL *sel)
pixHMT()
void pixDestroy(PIX **ppix)
pixDestroy()
PIX * pixCopy(PIX *pixd, const PIX *pixs)
pixCopy()
PIX * pixCreateTemplate(const PIX *pixs)
pixCreateTemplate()
PIX * pixInvert(PIX *pixd, PIX *pixs)
pixInvert()
PIX * pixOr(PIX *pixd, PIX *pixs1, PIX *pixs2)
pixOr()
PIX * pixSubtract(PIX *pixd, PIX *pixs1, PIX *pixs2)
pixSubtract()
l_ok pixaAddPix(PIXA *pixa, PIX *pix, l_int32 copyflag)
pixaAddPix()
void pixaDestroy(PIXA **ppixa)
pixaDestroy()
l_ok pixaVerifyDepth(PIXA *pixa, l_int32 *psame, l_int32 *pmaxd)
pixaVerifyDepth()
PIXA * pixaCreate(l_int32 n)
pixaCreate()
PIX ** pixaGetPixArray(PIXA *pixa)
pixaGetPixArray()
l_int32 pixaGetCount(PIXA *pixa)
pixaGetCount()
PIX * pixaGetPix(PIXA *pixa, l_int32 index, l_int32 accesstype)
pixaGetPix()
PIX * pixExtractBorderConnComps(PIX *pixs, l_int32 connectivity)
pixExtractBorderConnComps()
void selaDestroy(SELA **psela)
selaDestroy()
l_ok selaFindSelByName(SELA *sela, const char *name, l_int32 *pindex, SEL **psel)
selaFindSelByName()
SELA * selaCreate(l_int32 n)
selaCreate()
SEL * selRotateOrth(SEL *sel, l_int32 quads)
selRotateOrth()
void selDestroy(SEL **psel)
selDestroy()
l_ok selaAddSel(SELA *sela, SEL *sel, const char *selname, l_int32 copyflag)
selaAddSel()
SEL * selaGetSel(SELA *sela, l_int32 i)
selaGetSel()
PIX * selaDisplayInPix(SELA *sela, l_int32 size, l_int32 gthick, l_int32 spacing, l_int32 ncols)
selaDisplayInPix()
l_int32 selaGetCount(SELA *sela)
selaGetCount()
SELA * sela8ccThin(SELA *sela)
sela8ccThin()
SELA * sela4and8ccThin(SELA *sela)
sela4and8ccThin()
SELA * sela4ccThin(SELA *sela)
sela4ccThin()
l_int32 lept_mkdir(const char *subdir)
lept_mkdir()