---------------------------------------------------------------------* * 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
| 831 | * </pre> |
| 832 | */ |
| 833 | BOXA * |
| 834 | pixSplitIntoBoxa(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 | { |
| 842 | l_int32 i, n; |
| 843 | BOX *box; |
| 844 | BOXA *boxa, *boxas, *boxad; |
| 845 | PIX *pix; |
| 846 | PIXA *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 | /*! |
nothing calls this directly
no test coverage detected