![]() |
Leptonica
1.83.1
Image processing and image analysis suite
|
#include "allheaders.h"
Go to the source code of this file.
Functions | |
PTA * | ptaSort (PTA *ptas, l_int32 sorttype, l_int32 sortorder, NUMA **pnaindex) |
l_ok | ptaGetSortIndex (PTA *ptas, l_int32 sorttype, l_int32 sortorder, NUMA **pnaindex) |
PTA * | ptaSortByIndex (PTA *ptas, NUMA *naindex) |
PTAA * | ptaaSortByIndex (PTAA *ptaas, NUMA *naindex) |
l_ok | ptaGetRankValue (PTA *pta, l_float32 fract, PTA *ptasort, l_int32 sorttype, l_float32 *pval) |
PTA * | ptaSort2d (PTA *pta) |
l_ok | ptaEqual (PTA *pta1, PTA *pta2, l_int32 *psame) |
L_ASET * | l_asetCreateFromPta (PTA *pta) |
l_ok | ptaRemoveDupsByAset (PTA *ptas, PTA **pptad) |
l_ok | ptaUnionByAset (PTA *pta1, PTA *pta2, PTA **pptad) |
l_ok | ptaIntersectionByAset (PTA *pta1, PTA *pta2, PTA **pptad) |
L_HASHMAP * | l_hmapCreateFromPta (PTA *pta) |
l_ok | ptaRemoveDupsByHmap (PTA *ptas, PTA **pptad, L_HASHMAP **phmap) |
l_ok | ptaUnionByHmap (PTA *pta1, PTA *pta2, PTA **pptad) |
l_ok | ptaIntersectionByHmap (PTA *pta1, PTA *pta2, PTA **pptad) |
-------------------------------------- This file has these Pta utilities:
Definition in file ptafunc2.c.
[in] | pta |
Definition at line 435 of file ptafunc2.c.
Referenced by ptaIntersectionByAset().
[in] | pta | input pta |
Notes: (1) The indices into pta are stored in the val field of the hashitems. This is necessary so that hmap and pta can be used together.
Definition at line 632 of file ptafunc2.c.
References l_hashPtToUint64(), ptaGetCount(), and ptaGetIPt().
Referenced by ptaIntersectionByHmap(), and ptaRemoveDupsByHmap().
[in] | ptaas | |
[in] | naindex | na that maps from the new ptaa to the input ptaa |
Definition at line 220 of file ptafunc2.c.
References L_COPY, L_INSERT, numaGetCount(), numaGetIValue(), ptaaAddPta(), ptaaCreate(), ptaaGetCount(), and ptaaGetPta().
[in] | pta1 | |
[in] | pta2 | |
[out] | psame | 1 if same; 0 if different |
Notes: (1) Equality is defined as having the same set of points, independent of the order in which they are presented.
Definition at line 387 of file ptafunc2.c.
References ptaDestroy(), ptaGetCount(), ptaGetPt(), and ptaSort2d().
l_ok ptaGetRankValue | ( | PTA * | pta, |
l_float32 | fract, | ||
PTA * | ptasort, | ||
l_int32 | sorttype, | ||
l_float32 * | pval | ||
) |
[in] | pta | |
[in] | fract | use 0.0 for smallest, 1.0 for largest |
[in] | ptasort | [optional] version of pta sorted by sorttype |
[in] | sorttype | L_SORT_BY_X, L_SORT_BY_Y |
[out] | pval | rankval: the x or y value at fract |
Definition at line 257 of file ptafunc2.c.
References L_SORT_BY_X, L_SORT_BY_Y, L_SORT_INCREASING, ptaDestroy(), ptaGetCount(), ptaGetPt(), and ptaSort().
[in] | ptas | |
[in] | sorttype | L_SORT_BY_X, L_SORT_BY_Y |
[in] | sortorder | L_SORT_INCREASING, L_SORT_DECREASING |
[out] | pnaindex | index of sorted order into original array |
Definition at line 137 of file ptafunc2.c.
References L_SORT_BY_X, L_SORT_BY_Y, L_SORT_DECREASING, L_SORT_INCREASING, numaAddNumber(), numaCreate(), numaDestroy(), numaGetSortIndex(), ptaGetCount(), and ptaGetPt().
Referenced by ptaSort().
[in] | pta1 | |
[in] | pta2 | |
[out] | pptad | intersection of the two point arrays |
Notes: (1) See sarrayIntersectionByAset() for the approach. (2) The key is a 64-bit hash from the (x,y) pair. (3) This is slower than ptaIntersectionByHmap(), mostly because of the nlogn sort to build up the rbtree. Do not use for large numbers of points (say, > 100K).
Definition at line 570 of file ptafunc2.c.
References l_asetCreateFromPta(), ptaCreate(), and ptaGetCount().
[in] | pta1 | |
[in] | pta2 | |
[out] | pptad | intersection of the two point arrays |
Notes: (1) Make pta with pts common to both input arrays.
Definition at line 760 of file ptafunc2.c.
References L_Hashitem::count, l_hashPtToUint64(), l_hmapCreateFromPta(), ptaAddPt(), ptaCreate(), ptaGetCount(), and ptaGetIPt().
[in] | ptas | assumed to be integer values |
[out] | pptad | assumed to be integer values |
Notes: (1) This is slower than ptaRemoveDupsByHmap(), mostly because of the nlogn sort to build up the rbtree. Do not use for large numbers of points (say, > 100K).
Definition at line 473 of file ptafunc2.c.
Referenced by generatePtaBoxa(), generatePtaHashBoxa(), generatePtaPolyline(), and ptaUnionByAset().
[in] | ptas | |
[out] | pptad | set of unique values |
[out] | phmap | [optional] hashmap used for lookup |
Notes: (1) Generates a set of (unique) points from ptas.
Definition at line 668 of file ptafunc2.c.
References L_Hashmap::hashtab, l_hmapCreateFromPta(), L_Hashitem::next, ptaAddPt(), ptaCreate(), ptaGetIPt(), L_Hashmap::tabsize, and L_Hashitem::val.
Referenced by ptaUnionByHmap().
[in] | ptas | |
[in] | sorttype | L_SORT_BY_X, L_SORT_BY_Y |
[in] | sortorder | L_SORT_INCREASING, L_SORT_DECREASING |
[out] | pnaindex | [optional] index of sorted order into original array |
Definition at line 97 of file ptafunc2.c.
References L_SORT_BY_X, L_SORT_BY_Y, L_SORT_DECREASING, L_SORT_INCREASING, numaDestroy(), ptaGetSortIndex(), and ptaSortByIndex().
Referenced by ptaGetRankValue(), and ptaSort2d().
[in] | ptas |
Notes: (1) Sort increasing by row-major, scanning down from the UL corner, where for each value of y, order the pts from left to right.
Definition at line 307 of file ptafunc2.c.
References L_SORT_BY_Y, L_SORT_INCREASING, numaAddNumber(), numaCreate(), numaDestroy(), numaGetCount(), numaGetFValue(), numaGetIValue(), numaSort(), ptaAddPt(), ptaCreate(), ptaDestroy(), ptaGetCount(), ptaGetPt(), and ptaSort().
Referenced by ptaEqual().
[in] | ptas | |
[in] | naindex | na that maps from the new pta to the input pta |
Definition at line 186 of file ptafunc2.c.
References numaGetCount(), numaGetIValue(), ptaAddPt(), ptaCreate(), and ptaGetPt().
Referenced by ptaSort().
[in] | pta1 | |
[in] | pta2 | |
[out] | pptad | union of the two point arrays |
Notes: (1) See sarrayRemoveDupsByAset() for the approach. (2) The key is a 64-bit hash from the (x,y) pair. (3) This is slower than ptaUnionByHmap(), mostly because of the nlogn sort to build up the rbtree. Do not use for large numbers of points (say, > 100K). (4) The *Aset() functions use the sorted l_Aset, which is just an rbtree in disguise.
Definition at line 527 of file ptafunc2.c.
References ptaCopy(), ptaDestroy(), ptaJoin(), and ptaRemoveDupsByAset().
[in] | pta1 | |
[in] | pta2 | |
[out] | pptad | union of the two point arrays |
Notes: (1) Make pta with points found in either of the input arrays.
Definition at line 721 of file ptafunc2.c.
References ptaCopy(), ptaDestroy(), ptaJoin(), and ptaRemoveDupsByHmap().