Leptonica 1.68
C Image Processing Library
|
Implements 1d and 2d arrays of points (Pta, Ptaa) More...
Go to the source code of this file.
Implements 1d and 2d arrays of points (Pta, Ptaa)
Pta creation, destruction, copy, clone, empty PTA *ptaCreate() PTA *ptaCreateFromNuma() void ptaDestroy() PTA *ptaCopy() PTA *ptaClone() l_int32 ptaEmpty() Pta array extension l_int32 ptaAddPt() l_int32 ptaExtendArrays() Pta Accessors l_int32 ptaGetRefcount() l_int32 ptaChangeRefcount() l_int32 ptaGetCount() l_int32 ptaGetPt() l_int32 ptaGetIPt() l_int32 ptaSetPt() l_int32 ptaGetArrays() Pta serialized for I/O PTA *ptaRead() PTA *ptaReadStream() l_int32 ptaWrite() l_int32 ptaWriteStream() Ptaa creation, destruction PTAA *ptaaCreate() void ptaaDestroy() Ptaa array extension l_int32 ptaaAddPta() l_int32 ptaaExtendArray() Ptaa Accessors l_int32 ptaaGetCount() l_int32 ptaaGetPta() l_int32 ptaaGetPt() Ptaa serialized for I/O PTAA *ptaaRead() PTAA *ptaaReadStream() l_int32 ptaaWrite() l_int32 ptaaWriteStream()
Definition in file ptabasic.c.
Input: n (initial array sizes) Return: pta, or null on error.
Definition at line 83 of file ptabasic.c.
References CALLOC, ERROR_PTR, INITIAL_PTR_ARRAYSIZE, Pta::n, Pta::nalloc, NULL, PROCNAME, ptaChangeRefcount(), Pta::x, and Pta::y.
Referenced by boxaConvertToPta(), boxIntersectByLine(), ccbaGenerateGlobalLocs(), ccbaGenerateSinglePath(), ccbaGenerateSPGlobalLocs(), ccbaStepChainsToPixCoords(), ccbCreate(), dewarpBuildModel(), generatePtaaBoxa(), generatePtaBox(), generatePtaBoxa(), generatePtaFilledCircle(), generatePtaHashBox(), generatePtaLine(), generatePtaPolyline(), getCutPathForHole(), jbAccumulateComposites(), jbClasserCreate(), jbClassifyCorrelation(), jbDataRead(), jbGetLLCorners(), main(), MakePtas(), pdfdataCreate(), pixaCentroids(), pixFindBaselines(), pixFindCornerPixels(), pixFindHistoPeaksHSV(), pixGenerateSelWithRuns(), pixGetHoleBorder(), pixGetLocalSkewAngles(), pixGetLocalSkewTransform(), pixGetMeanVerticals(), pixGetOuterBorder(), pixSearchBinaryMaze(), pixSearchGrayMaze(), pixSelectMinInConnComp(), pixSubsampleBoundaryPixels(), ptaAffineTransform(), ptaCopy(), ptaCreateFromNuma(), ptaCyclicPerm(), ptaGetInsideBox(), ptaGetPixelsFromPix(), ptaReadStream(), ptaRemoveDuplicates(), ptaReverse(), ptaRotate(), ptaScale(), ptaSort(), ptaSubsample(), ptaTransform(), and ptaTranslate().
Input: nax (<optional> can be null) nay Return: pta, or null on error.
Definition at line 115 of file ptabasic.c.
References ERROR_PTR, NULL, numaGetCount(), numaGetFValue(), numaGetXParameters(), PROCNAME, ptaAddPt(), and ptaCreate().
Referenced by dewarpBuildModel(), and main().
void ptaDestroy | ( | PTA ** | ppta | ) |
Input: &pta (<to be="" nulled>="">) Return: void
Note:
Definition at line 156 of file ptabasic.c.
References FREE, L_WARNING, NULL, PROCNAME, ptaChangeRefcount(), ptaGetRefcount(), Pta::x, and Pta::y.
Referenced by boxaAffineTransform(), boxaRotate(), boxaScale(), boxaTranslate(), boxIntersectByLine(), ccbaDisplayBorder(), ccbaDisplayImage1(), ccbaDisplayImage2(), ccbaGenerateGlobalLocs(), ccbaGenerateSinglePath(), ccbaGenerateSPGlobalLocs(), ccbaGenerateStepChains(), ccbDestroy(), dewarpBuildModel(), generatePtaBox(), generatePtaBoxa(), generatePtaHashBox(), generatePtaPolyline(), generatePtaWideLine(), jbAccumulateComposites(), jbClasserDestroy(), jbClassifyCorrelation(), jbClassifyRankHaus(), jbDataDestroy(), jbGetLLCorners(), main(), pdfdataDestroy(), pixAffinePtaWithAlpha(), pixBilinearPtaWithAlpha(), pixDeskewLocal(), pixDisplayMatchedPattern(), pixDisplayPtaa(), pixExtractOnLine(), pixGenerateSelBoundary(), pixGenerateSelWithRuns(), pixGetLocalSkewAngles(), pixGetOuterBorderPta(), pixGetRunsOnLine(), pixProjectivePtaWithAlpha(), pixRemoveMatchedPattern(), pixRenderBox(), pixRenderBoxa(), pixRenderBoxaArb(), pixRenderBoxaBlend(), pixRenderBoxArb(), pixRenderBoxBlend(), pixRenderHashBox(), pixRenderHashBoxArb(), pixRenderHashBoxBlend(), pixRenderLine(), pixRenderLineArb(), pixRenderLineBlend(), pixRenderPolyline(), pixRenderPolylineArb(), pixRenderPolylineBlend(), pixRenderRandomCmapPtaa(), ptaaDestroy(), ptaaGetBoundaryPixels(), ptaaGetPt(), ptaaRemoveShortLines(), ptaaWriteStream(), selaAddCrossJunctions(), selaAddTJunctions(), selDisplayInPix(), wshedApply(), and wshedDestroy().
Input: pta Return: copy of pta, or null on error
Definition at line 189 of file ptabasic.c.
References ERROR_PTR, Pta::n, Pta::nalloc, NULL, PROCNAME, ptaAddPt(), ptaCreate(), and ptaGetPt().
Referenced by ptaaAddPta(), and ptaaGetPta().
Input: pta Return: ptr to same pta, or null on error
Definition at line 219 of file ptabasic.c.
References ERROR_PTR, NULL, PROCNAME, and ptaChangeRefcount().
Referenced by generatePtaBoxa(), generatePtaPolyline(), jbDataSave(), pixGetOuterBorderPta(), pixRenderRandomCmapPtaa(), ptaaAddPta(), and ptaaGetPta().
Input: pta Return: 0 if OK, 1 on error
Note: this only resets the "n" field, for reuse
Definition at line 240 of file ptabasic.c.
References ERROR_INT, Pta::n, and PROCNAME.
Referenced by getCutPathForHole().
Input: pta x, y Return: 0 if OK, 1 on error
Definition at line 262 of file ptabasic.c.
References ERROR_INT, Pta::n, Pta::nalloc, PROCNAME, ptaExtendArrays(), Pta::x, and Pta::y.
Referenced by boxaConvertToPta(), boxIntersectByLine(), ccbaGenerateGlobalLocs(), ccbaGenerateSinglePath(), ccbaGenerateSPGlobalLocs(), ccbaReadStream(), ccbaStepChainsToPixCoords(), dewarpBuildModel(), generatePtaaBoxa(), generatePtaFilledCircle(), generatePtaLine(), getCutPathForHole(), jbAccumulateComposites(), jbClassifyCorrelation(), jbClassifyRankHaus(), jbDataRead(), jbGetLLCorners(), jbGetULCorners(), main(), MakePtas(), pixaCentroids(), pixConvertToPdfData(), pixFindBaselines(), pixFindCornerPixels(), pixFindHistoPeaksHSV(), pixGenerateSelWithRuns(), pixGetHoleBorder(), pixGetLocalSkewAngles(), pixGetLocalSkewTransform(), pixGetMeanVerticals(), pixGetOuterBorder(), pixSearchBinaryMaze(), pixSearchGrayMaze(), pixSelectMinInConnComp(), pixSubsampleBoundaryPixels(), ptaAffineTransform(), ptaCopy(), ptaCreateFromNuma(), ptaCyclicPerm(), ptaGetInsideBox(), ptaGetPixelsFromPix(), ptaJoin(), ptaReadStream(), ptaRemoveDuplicates(), ptaReverse(), ptaRotate(), ptaScale(), ptaSort(), ptaSubsample(), ptaTransform(), and ptaTranslate().
Input: pta Return: 0 if OK; 1 on error
Definition at line 291 of file ptabasic.c.
References ERROR_INT, Pta::nalloc, NULL, PROCNAME, reallocNew(), Pta::x, and Pta::y.
Referenced by ptaAddPt().
Definition at line 316 of file ptabasic.c.
References ERROR_INT, PROCNAME, and Pta::refcount.
Referenced by ptaDestroy().
Definition at line 327 of file ptabasic.c.
References ERROR_INT, PROCNAME, and Pta::refcount.
Referenced by ptaClone(), ptaCreate(), and ptaDestroy().
Input: pta Return: count, or 0 if no pta
Definition at line 346 of file ptabasic.c.
References ERROR_INT, Pta::n, and PROCNAME.
Referenced by boxIntersectByLine(), ccbaDisplayBorder(), ccbaDisplayImage1(), ccbaDisplayImage2(), ccbaDisplaySPBorder(), ccbaGenerateGlobalLocs(), ccbaGenerateSinglePath(), ccbaGenerateSPGlobalLocs(), ccbaGenerateStepChains(), ccbaWriteSVGString(), generatePtaPolyline(), getCutPathForHole(), jbDataWrite(), jbGetLLCorners(), main(), pixAffinePta(), pixAffinePtaColor(), pixAffinePtaGray(), pixAffineSampledPta(), pixAffineSequential(), pixBilinearPta(), pixBilinearPtaColor(), pixBilinearPtaGray(), pixBilinearSampledPta(), pixDisplayPta(), pixDisplayPtaa(), pixExtractOnLine(), pixFindBaselines(), pixGenerateFromPta(), pixGenerateSelBoundary(), pixGenerateSelWithRuns(), pixGetLocalSkewAngles(), pixGetRunsOnLine(), pixPlotAlongPta(), pixProjectivePta(), pixProjectivePtaColor(), pixProjectivePtaGray(), pixProjectiveSampledPta(), pixRenderPta(), pixRenderPtaArb(), pixRenderPtaBlend(), ptaAffineTransform(), ptaContainsPt(), ptaConvertToBoxa(), ptaCyclicPerm(), ptaGetArrays(), ptaGetBoundingRegion(), ptaGetCubicLSF(), ptaGetInsideBox(), ptaGetLinearLSF(), ptaGetQuadraticLSF(), ptaGetQuarticLSF(), ptaGetRange(), ptaJoin(), ptaRemoveDuplicates(), ptaReverse(), ptaRotate(), ptaScale(), ptaSort(), ptaSubsample(), ptaTestIntersection(), ptaTransform(), ptaTranslate(), ptaWriteStream(), selCreateFromPta(), and wshedApply().
Input: pta index (into arrays) &x (<optional return>=""> float x value) &y (<optional return>=""> float y value) Return: 0 if OK; 1 on error
Definition at line 367 of file ptabasic.c.
References ERROR_INT, Pta::n, PROCNAME, Pta::x, and Pta::y.
Referenced by dewarpBuildModel(), generateContentStringPdf(), generateMediaboxPdf(), getAffineXformCoeffs(), getBilinearXformCoeffs(), getProjectiveXformCoeffs(), jbAccumulateComposites(), jbClassifyCorrelation(), jbClassifyRankHaus(), jbGetULCorners(), pixExtractOnLine(), ptaAffineTransform(), ptaaGetPt(), ptaCopy(), ptaGetInsideBox(), ptaGetRange(), ptaReverse(), ptaRotate(), ptaScale(), ptaSort(), ptaSubsample(), ptaTranslate(), and ptaWriteStream().
Input: pta index (into arrays) &x (<optional return>=""> integer x value) &y (<optional return>=""> integer y value) Return: 0 if OK; 1 on error
Definition at line 397 of file ptabasic.c.
References ERROR_INT, Pta::n, PROCNAME, Pta::x, and Pta::y.
Referenced by boxIntersectByLine(), ccbaDisplayBorder(), ccbaDisplayImage1(), ccbaDisplayImage2(), ccbaDisplaySPBorder(), ccbaGenerateGlobalLocs(), ccbaGenerateSinglePath(), ccbaGenerateSPGlobalLocs(), ccbaGenerateStepChains(), ccbaStepChainsToPixCoords(), ccbaWriteStream(), ccbaWriteSVGString(), generatePtaPolyline(), getCutPathForHole(), identifyWatershedBasin(), jbDataRender(), jbDataWrite(), jbGetLLCorners(), main(), pixAffineSequential(), pixDisplayMatchedPattern(), pixDisplayPta(), pixDisplayPtaa(), pixFindBaselines(), pixGenerateFromPta(), pixGenerateSelBoundary(), pixGenerateSelWithRuns(), pixGetRunsOnLine(), pixPlotAlongPta(), pixRemoveMatchedPattern(), pixRenderPta(), pixRenderPtaArb(), pixRenderPtaBlend(), ptaContainsPt(), ptaConvertToBoxa(), ptaCyclicPerm(), ptaGetBoundingRegion(), ptaJoin(), ptaRemoveDuplicates(), ptaReverse(), ptaTestIntersection(), ptaTransform(), ptaWriteStream(), selCreateFromPta(), and wshedApply().
Input: pta index (into arrays) x, y Return: 0 if OK; 1 on error
Definition at line 426 of file ptabasic.c.
References ERROR_INT, Pta::n, PROCNAME, Pta::x, and Pta::y.
Referenced by generateMediaboxPdf().
Input: pta &nax (<optional return>=""> numa of x array) &nay (<optional return>=""> numa of y array) Return: 0 if OK; 1 on error or if pta is empty
Notes: (1) This copies the internal arrays into new Numas.
Definition at line 456 of file ptabasic.c.
References Numa::array, ERROR_INT, Numa::n, NULL, numaCreate(), PROCNAME, ptaGetCount(), Pta::x, and Pta::y.
Referenced by dewarpBuildModel(), main(), and pixGetLocalSkewAngles().
PTA* ptaRead | ( | const char * | filename | ) |
Input: filename Return: pta, or null on error
Definition at line 504 of file ptabasic.c.
References ERROR_PTR, fopenReadStream(), NULL, PROCNAME, and ptaReadStream().
PTA* ptaReadStream | ( | FILE * | fp | ) |
Input: stream Return: pta, or null on error
Definition at line 533 of file ptabasic.c.
References ERROR_PTR, NULL, PROCNAME, PTA_VERSION_NUMBER, ptaAddPt(), ptaCreate(), and version.
Referenced by ptaaReadStream(), and ptaRead().
Input: filename pta type (0 for float values; 1 for integer values) Return: 0 if OK, 1 on error
Definition at line 584 of file ptabasic.c.
References ERROR_INT, fopenWriteStream(), NULL, PROCNAME, and ptaWriteStream().
Input: stream pta type (0 for float values; 1 for integer values) Return: 0 if OK; 1 on error
Definition at line 616 of file ptabasic.c.
References ERROR_INT, PROCNAME, PTA_VERSION_NUMBER, ptaGetCount(), ptaGetIPt(), and ptaGetPt().
Referenced by main(), ptaaWriteStream(), and ptaWrite().
Input: n (initial number of ptrs) Return: ptaa, or null on error
Definition at line 661 of file ptabasic.c.
References CALLOC, ERROR_PTR, INITIAL_PTR_ARRAYSIZE, Ptaa::n, Ptaa::nalloc, NULL, PROCNAME, and Ptaa::pta.
Referenced by ccbaGenerateGlobalLocs(), ccbaGenerateSinglePath(), ccbaStepChainsToPixCoords(), ccbCreate(), dewarpBuildModel(), generatePtaaBoxa(), generatePtaaHashBoxa(), main(), pixGetOuterBordersPtaa(), pixGetTextlineCenters(), ptaaGetBoundaryPixels(), ptaaReadStream(), ptaaRemoveShortLines(), and ptaaSortByIndex().
void ptaaDestroy | ( | PTAA ** | pptaa | ) |
Input: &ptaa <to be="" nulled>=""> Return: void
Definition at line 689 of file ptabasic.c.
References FREE, L_WARNING, Ptaa::n, NULL, PROCNAME, Ptaa::pta, and ptaDestroy().
Referenced by ccbaGenerateGlobalLocs(), ccbaGenerateSinglePath(), ccbaStepChainsToPixCoords(), ccbDestroy(), dewarpBuildModel(), DoPageSegmentation(), main(), pixDrawBoxaRandom(), and pixGetRegionsBinary().
Input: ptaa pta (to be added) copyflag (L_INSERT, L_COPY, L_CLONE) Return: 0 if OK, 1 on error
Definition at line 726 of file ptabasic.c.
References ERROR_INT, L_CLONE, L_COPY, L_INSERT, Ptaa::n, Ptaa::nalloc, NULL, PROCNAME, Ptaa::pta, ptaaExtendArray(), ptaaGetCount(), ptaClone(), and ptaCopy().
Referenced by ccbaGenerateGlobalLocs(), ccbaGenerateSinglePath(), ccbaStepChainsToPixCoords(), dewarpBuildModel(), generatePtaaBoxa(), generatePtaaHashBoxa(), main(), pixGetHoleBorder(), pixGetOuterBorder(), pixGetOuterBordersPtaa(), pixGetTextlineCenters(), ptaaGetBoundaryPixels(), ptaaReadStream(), ptaaRemoveShortLines(), and ptaaSortByIndex().
Input: ptaa Return: 0 if OK, 1 on error
Definition at line 770 of file ptabasic.c.
References ERROR_INT, Ptaa::nalloc, NULL, PROCNAME, Ptaa::pta, and reallocNew().
Referenced by ptaaAddPta().
Input: ptaa Return: count, or 0 if no ptaa
Definition at line 797 of file ptabasic.c.
References ERROR_INT, Ptaa::n, and PROCNAME.
Referenced by ccbaDisplayBorder(), ccbaDisplayImage1(), ccbaDisplayImage2(), ccbaGenerateGlobalLocs(), ccbaGenerateSinglePath(), ccbaGenerateStepChains(), dewarpBuildModel(), main(), pixDisplayPtaa(), pixRenderRandomCmapPtaa(), ptaaAddPta(), ptaaRemoveShortLines(), ptaaSortByIndex(), and ptaaWriteStream().
Input: ptaa index (to the i-th pta) accessflag (L_COPY or L_CLONE) Return: pta, or null on error
Definition at line 817 of file ptabasic.c.
References ERROR_PTR, L_CLONE, L_COPY, Ptaa::n, NULL, PROCNAME, Ptaa::pta, ptaClone(), and ptaCopy().
Referenced by ccbaDisplayBorder(), ccbaDisplayImage1(), ccbaDisplayImage2(), ccbaGenerateGlobalLocs(), ccbaGenerateSinglePath(), ccbaGenerateStepChains(), dewarpBuildModel(), main(), pixDisplayPtaa(), pixGetOuterBorderPta(), pixRenderRandomCmapPtaa(), ptaaGetPt(), ptaaRemoveShortLines(), ptaaSortByIndex(), and ptaaWriteStream().
Input: ptaa ipta (to the i-th pta) jpt (index to the j-th pt in the pta) &x (<optional return>=""> float x value) &y (<optional return>=""> float y value) Return: 0 if OK; 1 on error
Definition at line 848 of file ptabasic.c.
References ERROR_INT, L_CLONE, Pta::n, Ptaa::n, PROCNAME, ptaaGetPta(), ptaDestroy(), and ptaGetPt().
Referenced by dewarpBuildModel().
PTAA* ptaaRead | ( | const char * | filename | ) |
Input: filename Return: ptaa, or null on error
Definition at line 887 of file ptabasic.c.
References ERROR_PTR, fopenReadStream(), NULL, PROCNAME, and ptaaReadStream().
Referenced by main().
PTAA* ptaaReadStream | ( | FILE * | fp | ) |
Input: stream Return: ptaa, or null on error
Definition at line 916 of file ptabasic.c.
References ERROR_PTR, L_INSERT, NULL, PROCNAME, PTA_VERSION_NUMBER, ptaaAddPta(), ptaaCreate(), ptaReadStream(), and version.
Referenced by ptaaRead().
Input: filename ptaa type (0 for float values; 1 for integer values) Return: 0 if OK, 1 on error
Definition at line 955 of file ptabasic.c.
References ERROR_INT, fopenWriteStream(), NULL, PROCNAME, and ptaaWriteStream().
Referenced by dewarpBuildModel(), main(), and pixGetRegionsBinary().
Input: stream ptaa type (0 for float values; 1 for integer values) Return: 0 if OK; 1 on error
Definition at line 987 of file ptabasic.c.
References ERROR_INT, L_CLONE, PROCNAME, PTA_VERSION_NUMBER, ptaaGetCount(), ptaaGetPta(), ptaDestroy(), and ptaWriteStream().
Referenced by main(), and ptaaWrite().
const l_int32 INITIAL_PTR_ARRAYSIZE = 20 [static] |
Definition at line 70 of file ptabasic.c.
Referenced by ptaaCreate(), and ptaCreate().