MCPcopy Create free account
hub / github.com/creatale/node-dv / pixSplitIntoBoxa

Function pixSplitIntoBoxa

deps/leptonica/src/boxfunc3.c:833–870  ·  view source on GitHub ↗

---------------------------------------------------------------------* * Split mask components into Boxa * *---------------------------------------------------------------------*/ ! * \brief pixSplitIntoBoxa() * * \param[in] pixs 1 bpp * \param[in] minsum minimum pixels to trigger propagation * \param[in] skipdist distance before computing sum

Source from the content-addressed store, hash-verified

831 * </pre>
832 */
833BOXA *
834pixSplitIntoBoxa(PIX *pixs,
835 l_int32 minsum,
836 l_int32 skipdist,
837 l_int32 delta,
838 l_int32 maxbg,
839 l_int32 maxcomps,
840 l_int32 remainder)
841{
842l_int32 i, n;
843BOX *box;
844BOXA *boxa, *boxas, *boxad;
845PIX *pix;
846PIXA *pixas;
847
848 PROCNAME("pixSplitIntoBoxa");
849
850 if (!pixs || pixGetDepth(pixs) != 1)
851 return (BOXA *)ERROR_PTR("pixs undefined or not 1 bpp", procName, NULL);
852
853 boxas = pixConnComp(pixs, &pixas, 8);
854 n = boxaGetCount(boxas);
855 boxad = boxaCreate(0);
856 for (i = 0; i < n; i++) {
857 pix = pixaGetPix(pixas, i, L_CLONE);
858 box = boxaGetBox(boxas, i, L_CLONE);
859 boxa = pixSplitComponentIntoBoxa(pix, box, minsum, skipdist,
860 delta, maxbg, maxcomps, remainder);
861 boxaJoin(boxad, boxa, 0, -1);
862 pixDestroy(&pix);
863 boxDestroy(&box);
864 boxaDestroy(&boxa);
865 }
866
867 pixaDestroy(&pixas);
868 boxaDestroy(&boxas);
869 return boxad;
870}
871
872
873/*!

Callers

nothing calls this directly

Calls 12

pixGetDepthFunction · 0.85
pixConnCompFunction · 0.85
boxaGetCountFunction · 0.85
boxaCreateFunction · 0.85
pixaGetPixFunction · 0.85
boxaGetBoxFunction · 0.85
boxaJoinFunction · 0.85
pixDestroyFunction · 0.85
boxDestroyFunction · 0.85
boxaDestroyFunction · 0.85
pixaDestroyFunction · 0.85

Tested by

no test coverage detected