![]() |
Leptonica 1.85.0
Image processing and image analysis suite
|
Go to the source code of this file.
Functions | |
| static l_int32 | ptaExtendArrays (PTA *pta) |
| static l_int32 | ptaaExtendArray (PTAA *ptaa) |
| PTA * | ptaCreate (l_int32 n) |
| PTA * | ptaCreateFromNuma (NUMA *nax, NUMA *nay) |
| void | ptaDestroy (PTA **ppta) |
| PTA * | ptaCopy (PTA *pta) |
| PTA * | ptaCopyRange (PTA *ptas, l_int32 istart, l_int32 iend) |
| PTA * | ptaClone (PTA *pta) |
| l_ok | ptaEmpty (PTA *pta) |
| l_ok | ptaAddPt (PTA *pta, l_float32 x, l_float32 y) |
| l_ok | ptaInsertPt (PTA *pta, l_int32 index, l_int32 x, l_int32 y) |
| l_ok | ptaRemovePt (PTA *pta, l_int32 index) |
| l_int32 | ptaGetCount (PTA *pta) |
| l_ok | ptaGetPt (PTA *pta, l_int32 index, l_float32 *px, l_float32 *py) |
| l_ok | ptaGetIPt (PTA *pta, l_int32 index, l_int32 *px, l_int32 *py) |
| l_ok | ptaSetPt (PTA *pta, l_int32 index, l_float32 x, l_float32 y) |
| l_ok | ptaGetArrays (PTA *pta, NUMA **pnax, NUMA **pnay) |
| PTA * | ptaRead (const char *filename) |
| PTA * | ptaReadStream (FILE *fp) |
| PTA * | ptaReadMem (const l_uint8 *data, size_t size) |
| l_ok | ptaWriteDebug (const char *filename, PTA *pta, l_int32 type) |
| l_ok | ptaWrite (const char *filename, PTA *pta, l_int32 type) |
| l_ok | ptaWriteStream (FILE *fp, PTA *pta, l_int32 type) |
| l_ok | ptaWriteMem (l_uint8 **pdata, size_t *psize, PTA *pta, l_int32 type) |
| PTAA * | ptaaCreate (l_int32 n) |
| void | ptaaDestroy (PTAA **pptaa) |
| l_ok | ptaaAddPta (PTAA *ptaa, PTA *pta, l_int32 copyflag) |
| l_int32 | ptaaGetCount (PTAA *ptaa) |
| PTA * | ptaaGetPta (PTAA *ptaa, l_int32 index, l_int32 accessflag) |
| l_ok | ptaaGetPt (PTAA *ptaa, l_int32 ipta, l_int32 jpt, l_float32 *px, l_float32 *py) |
| l_ok | ptaaInitFull (PTAA *ptaa, PTA *pta) |
| l_ok | ptaaReplacePta (PTAA *ptaa, l_int32 index, PTA *pta) |
| l_ok | ptaaAddPt (PTAA *ptaa, l_int32 ipta, l_float32 x, l_float32 y) |
| l_ok | ptaaTruncate (PTAA *ptaa) |
| PTAA * | ptaaRead (const char *filename) |
| PTAA * | ptaaReadStream (FILE *fp) |
| PTAA * | ptaaReadMem (const l_uint8 *data, size_t size) |
| l_ok | ptaaWriteDebug (const char *filename, PTAA *ptaa, l_int32 type) |
| l_ok | ptaaWrite (const char *filename, PTAA *ptaa, l_int32 type) |
| l_ok | ptaaWriteStream (FILE *fp, PTAA *ptaa, l_int32 type) |
| l_ok | ptaaWriteMem (l_uint8 **pdata, size_t *psize, PTAA *ptaa, l_int32 type) |
Variables | |
| static const l_uint32 | MaxArraySize = 100000000 |
| static const l_uint32 | MaxPtrArraySize = 10000000 |
| static const l_int32 | InitialArraySize = 50 |
Pta creation, destruction, copy, clone, empty
PTA *ptaCreate()
PTA *ptaCreateFromNuma()
void ptaDestroy()
PTA *ptaCopy()
PTA *ptaCopyRange()
PTA *ptaClone()
l_int32 ptaEmpty()
Pta array extension
l_int32 ptaAddPt()
static l_int32 ptaExtendArrays()
Pta insertion and removal
l_int32 ptaInsertPt()
l_int32 ptaRemovePt()
Pta accessors
l_int32 ptaGetCount()
l_int32 ptaGetPt()
l_int32 ptaGetIPt()
l_int32 ptaSetPt()
l_int32 ptaGetArrays()
Pta serialized for I/O
PTA *ptaRead()
PTA *ptaReadStream()
PTA *ptaReadMem()
l_int32 ptaWriteDebug()
l_int32 ptaWrite()
l_int32 ptaWriteStream()
l_int32 ptaWriteMem()
Ptaa creation, destruction
PTAA *ptaaCreate()
void ptaaDestroy()
Ptaa array extension
l_int32 ptaaAddPta()
static l_int32 ptaaExtendArray()
Ptaa accessors
l_int32 ptaaGetCount()
l_int32 ptaaGetPta()
l_int32 ptaaGetPt()
Ptaa array modifiers
l_int32 ptaaInitFull()
l_int32 ptaaReplacePta()
l_int32 ptaaAddPt()
l_int32 ptaaTruncate()
Ptaa serialized for I/O
PTAA *ptaaRead()
PTAA *ptaaReadStream()
PTAA *ptaaReadMem()
l_int32 ptaaWrite()
l_int32 ptaaWriteStream()
l_int32 ptaaWriteMem()
Definition in file ptabasic.c.
| l_ok ptaaAddPt | ( | PTAA * | ptaa, |
| l_int32 | ipta, | ||
| l_float32 | x, | ||
| l_float32 | y ) |
| [in] | ptaa | |
| [in] | ipta | to the i-th pta |
| [in] | x,y | point coordinates |
Definition at line 1198 of file ptabasic.c.
References L_CLONE, Ptaa::n, ptaAddPt(), ptaaGetPta(), and ptaDestroy().
| [in] | ptaa | |
| [in] | pta | to be added |
| [in] | copyflag | L_INSERT, L_COPY, L_CLONE |
Definition at line 964 of file ptabasic.c.
References L_CLONE, L_COPY, L_INSERT, Ptaa::n, Ptaa::nalloc, Ptaa::pta, ptaaExtendArray(), ptaaGetCount(), ptaClone(), ptaCopy(), and ptaDestroy().
Referenced by ptaaReadStream().
| PTAA * ptaaCreate | ( | l_int32 | n | ) |
| [in] | n | initial number of ptrs |
Definition at line 906 of file ptabasic.c.
References InitialArraySize, Ptaa::n, Ptaa::nalloc, Ptaa::pta, and ptaaDestroy().
Referenced by ptaaReadStream().
| l_ok ptaAddPt | ( | PTA * | pta, |
| l_float32 | x, | ||
| l_float32 | y ) |
| [in] | pta | |
| [in] | x,y |
Definition at line 328 of file ptabasic.c.
References Pta::n, Pta::nalloc, ptaExtendArrays(), and Pta::y.
Referenced by ptaaAddPt(), ptaCopy(), ptaCopyRange(), ptaCreateFromNuma(), and ptaReadStream().
| void ptaaDestroy | ( | PTAA ** | pptaa | ) |
| [in,out] | pptaa | will be set to null before returning |
Definition at line 931 of file ptabasic.c.
References Ptaa::n, Ptaa::pta, and ptaDestroy().
Referenced by ptaaCreate(), and ptaaReadStream().
|
static |
| [in] | ptaa |
Notes:
(1) This doubles the pta ptr array size.
(2) The max number of pta ptrs is 10M.
Definition at line 1017 of file ptabasic.c.
References Ptaa::nalloc, and Ptaa::pta.
Referenced by ptaaAddPta().
| l_int32 ptaaGetCount | ( | PTAA * | ptaa | ) |
| [in] | ptaa |
Definition at line 1047 of file ptabasic.c.
References Ptaa::n.
Referenced by ptaaAddPta(), ptaaReplacePta(), ptaaTruncate(), and ptaaWriteStream().
| l_ok ptaaGetPt | ( | PTAA * | ptaa, |
| l_int32 | ipta, | ||
| l_int32 | jpt, | ||
| l_float32 * | px, | ||
| l_float32 * | py ) |
| [in] | ptaa | |
| [in] | ipta | to the i-th pta |
| [in] | jpt | index to the j-th pt in the pta |
| [out] | px | [optional] float x value |
| [out] | py | [optional] float y value |
Definition at line 1094 of file ptabasic.c.
References L_CLONE, Pta::n, Ptaa::n, ptaaGetPta(), ptaDestroy(), and ptaGetPt().
| [in] | ptaa | |
| [in] | index | to the i-th pta |
| [in] | accessflag | L_COPY or L_CLONE |
Definition at line 1065 of file ptabasic.c.
References L_CLONE, L_COPY, Ptaa::n, Ptaa::pta, ptaClone(), and ptaCopy().
Referenced by ptaaAddPt(), ptaaGetPt(), ptaaTruncate(), and ptaaWriteStream().
| [in] | ptaa | can have non-null ptrs in the ptr array |
| [in] | pta | to be replicated into the entire ptr array |
Definition at line 1132 of file ptabasic.c.
References Ptaa::n, Ptaa::nalloc, ptaaReplacePta(), and ptaCopy().
| PTAA * ptaaRead | ( | const char * | filename | ) |
| [in] | filename |
Definition at line 1269 of file ptabasic.c.
References ptaaReadStream().
| PTAA * ptaaReadMem | ( | const l_uint8 * | data, |
| size_t | size ) |
| [in] | data | serialization in ascii |
| [in] | size | of data in bytes; can use strlen to get it |
Definition at line 1343 of file ptabasic.c.
References ptaaReadStream().
| PTAA * ptaaReadStream | ( | FILE * | fp | ) |
| [in] | fp | file stream |
Notes:
(1) It is OK for the ptaa to be empty (n == 0).
Definition at line 1300 of file ptabasic.c.
References L_INSERT, PTA_VERSION_NUMBER, ptaaAddPta(), ptaaCreate(), ptaaDestroy(), and ptaReadStream().
Referenced by ptaaRead(), and ptaaReadMem().
| [in] | ptaa | |
| [in] | index | to the index-th pta |
| [in] | pta | insert and replace any existing one |
Notes:
(1) Any existing pta is destroyed, and the input one
is inserted in its place.
(2) If index is invalid, return 1 (error)
Definition at line 1169 of file ptabasic.c.
References Ptaa::pta, ptaaGetCount(), and ptaDestroy().
Referenced by ptaaInitFull().
| l_ok ptaaTruncate | ( | PTAA * | ptaa | ) |
| [in] | ptaa |
Notes:
(1) This identifies the largest index containing a pta that
has any points within it, destroys all pta above that index,
and resets the count.
Definition at line 1231 of file ptabasic.c.
References L_CLONE, Ptaa::n, Ptaa::pta, ptaaGetCount(), ptaaGetPta(), ptaDestroy(), and ptaGetCount().
| l_ok ptaaWrite | ( | const char * | filename, |
| PTAA * | ptaa, | ||
| l_int32 | type ) |
| [in] | filename | |
| [in] | ptaa | |
| [in] | type | 0 for float values; 1 for integer values |
Definition at line 1401 of file ptabasic.c.
References ptaaWriteStream().
Referenced by ptaaWriteDebug().
| l_ok ptaaWriteDebug | ( | const char * | filename, |
| PTAA * | ptaa, | ||
| l_int32 | type ) |
| [in] | filename | |
| [in] | ptaa | |
| [in] | type | 0 for float values; 1 for integer values |
Notes:
(1) Debug version, intended for use in the library when writing
to files in a temp directory with names that are compiled in.
This is used instead of ptaaWrite() for all such library calls.
(2) The global variable LeptDebugOK defaults to 0, and can be set
or cleared by the function setLeptDebugOK().
Definition at line 1379 of file ptabasic.c.
References ptaaWrite().
| l_ok ptaaWriteMem | ( | l_uint8 ** | pdata, |
| size_t * | psize, | ||
| PTAA * | ptaa, | ||
| l_int32 | type ) |
| [out] | pdata | data of serialized ptaa; ascii |
| [out] | psize | size of returned data |
| [in] | ptaa | |
| [in] | type | 0 for float values; 1 for integer values |
Notes:
(1) Serializes ptaa in memory and puts the result in a buffer.
Definition at line 1472 of file ptabasic.c.
References ptaaWriteStream().
| l_ok ptaaWriteStream | ( | FILE * | fp, |
| PTAA * | ptaa, | ||
| l_int32 | type ) |
| [in] | fp | file stream |
| [in] | ptaa | |
| [in] | type | 0 for float values; 1 for integer values |
Definition at line 1432 of file ptabasic.c.
References L_CLONE, PTA_VERSION_NUMBER, ptaaGetCount(), ptaaGetPta(), ptaDestroy(), and ptaWriteStream().
Referenced by ptaaWrite(), and ptaaWriteMem().
| [in] | pta |
Definition at line 286 of file ptabasic.c.
References Pta::refcount.
Referenced by ptaaAddPta(), and ptaaGetPta().
| [in] | pta |
Definition at line 219 of file ptabasic.c.
References Pta::n, Pta::nalloc, ptaAddPt(), ptaCreate(), and ptaGetPt().
Referenced by ptaaAddPta(), ptaaGetPta(), and ptaaInitFull().
| [in] | ptas | |
| [in] | istart | starting index in ptas |
| [in] | iend | ending index in ptas; use 0 to copy to end |
Definition at line 249 of file ptabasic.c.
References ptaAddPt(), ptaCreate(), ptaGetCount(), and ptaGetIPt().
| PTA * ptaCreate | ( | l_int32 | n | ) |
| [in] | n | initial array sizes |
Definition at line 120 of file ptabasic.c.
References InitialArraySize, Pta::n, Pta::nalloc, ptaDestroy(), Pta::refcount, and Pta::y.
Referenced by ptaCopy(), ptaCopyRange(), ptaCreateFromNuma(), and ptaReadStream().
| [in] | nax | [optional] can be null |
| [in] | nay |
Definition at line 150 of file ptabasic.c.
References ptaAddPt(), and ptaCreate().
| void ptaDestroy | ( | PTA ** | ppta | ) |
| [in,out] | ppta | will be set to null before returning |
Notes:
(1) Decrements the ref count and, if 0, destroys the pta.
(2) Always nulls the input ptr.
Definition at line 191 of file ptabasic.c.
References Pta::refcount, and Pta::y.
Referenced by ptaaAddPt(), ptaaAddPta(), ptaaDestroy(), ptaaGetPt(), ptaaReplacePta(), ptaaTruncate(), ptaaWriteStream(), ptaCreate(), and ptaReadStream().
| l_ok ptaEmpty | ( | PTA * | pta | ) |
| [in] | pta |
Notes:
This only resets the Pta::n field, for reuse
Definition at line 308 of file ptabasic.c.
References Pta::n.
|
static |
| [in] | pta |
Notes:
(1) Doubles the size of the array.
(2) The max number of points is 100M.
Definition at line 363 of file ptabasic.c.
References Pta::nalloc, and Pta::y.
Referenced by ptaAddPt(), and ptaInsertPt().
| [in] | pta | |
| [out] | pnax | [optional] numa of x array |
| [out] | pnay | [optional] numa of y array |
Notes:
(1) This copies the internal arrays into new Numas.
Definition at line 584 of file ptabasic.c.
References Numa::array, Numa::n, ptaGetCount(), and Pta::y.
| l_int32 ptaGetCount | ( | PTA * | pta | ) |
| [in] | pta |
Definition at line 480 of file ptabasic.c.
References Pta::n.
Referenced by ptaaTruncate(), ptaCopyRange(), ptaGetArrays(), ptaInsertPt(), ptaRemovePt(), and ptaWriteStream().
| l_ok ptaGetIPt | ( | PTA * | pta, |
| l_int32 | index, | ||
| l_int32 * | px, | ||
| l_int32 * | py ) |
| [in] | pta | |
| [in] | index | into arrays |
| [out] | px | [optional] integer x value |
| [out] | py | [optional] integer y value |
Definition at line 527 of file ptabasic.c.
References Pta::n, and Pta::y.
Referenced by ptaCopyRange(), and ptaWriteStream().
| l_ok ptaGetPt | ( | PTA * | pta, |
| l_int32 | index, | ||
| l_float32 * | px, | ||
| l_float32 * | py ) |
| [in] | pta | |
| [in] | index | into arrays |
| [out] | px | [optional] float x value |
| [out] | py | [optional] float y value |
Definition at line 499 of file ptabasic.c.
References Pta::n, and Pta::y.
Referenced by ptaaGetPt(), ptaCopy(), and ptaWriteStream().
| l_ok ptaInsertPt | ( | PTA * | pta, |
| l_int32 | index, | ||
| l_int32 | x, | ||
| l_int32 | y ) |
| [in] | pta | |
| [in] | index | at which pt is to be inserted |
| [in] | x,y | point values |
Definition at line 402 of file ptabasic.c.
References Pta::n, Pta::nalloc, ptaExtendArrays(), ptaGetCount(), and Pta::y.
| PTA * ptaRead | ( | const char * | filename | ) |
| [in] | filename |
Definition at line 630 of file ptabasic.c.
References ptaReadStream().
| PTA * ptaReadMem | ( | const l_uint8 * | data, |
| size_t | size ) |
| [in] | data | serialization in ascii |
| [in] | size | of data in bytes; can use strlen to get it |
Definition at line 718 of file ptabasic.c.
References ptaReadStream().
| PTA * ptaReadStream | ( | FILE * | fp | ) |
| [in] | fp | file stream |
Notes:
(1) It is OK for the pta to be empty (n == 0).
Definition at line 662 of file ptabasic.c.
References PTA_VERSION_NUMBER, ptaAddPt(), ptaCreate(), and ptaDestroy().
Referenced by ptaaReadStream(), ptaRead(), and ptaReadMem().
| l_ok ptaRemovePt | ( | PTA * | pta, |
| l_int32 | index ) |
| [in] | pta | |
| [in] | index | of point to be removed |
Notes:
(1) This shifts pta[i] --> pta[i - 1] for all i > index.
(2) It should not be used repeatedly on large arrays,
because the function is O(n).
Definition at line 447 of file ptabasic.c.
References Pta::n, ptaGetCount(), and Pta::y.
| l_ok ptaSetPt | ( | PTA * | pta, |
| l_int32 | index, | ||
| l_float32 | x, | ||
| l_float32 | y ) |
| [in] | pta | |
| [in] | index | into arrays |
| [in] | x,y |
Definition at line 554 of file ptabasic.c.
| l_ok ptaWrite | ( | const char * | filename, |
| PTA * | pta, | ||
| l_int32 | type ) |
| [in] | filename | |
| [in] | pta | |
| [in] | type | 0 for float values; 1 for integer values |
Definition at line 776 of file ptabasic.c.
References ptaWriteStream().
Referenced by ptaWriteDebug().
| l_ok ptaWriteDebug | ( | const char * | filename, |
| PTA * | pta, | ||
| l_int32 | type ) |
| [in] | filename | |
| [in] | pta | |
| [in] | type | 0 for float values; 1 for integer values |
Notes:
(1) Debug version, intended for use in the library when writing
to files in a temp directory with names that are compiled in.
This is used instead of ptaWrite() for all such library calls.
(2) The global variable LeptDebugOK defaults to 0, and can be set
or cleared by the function setLeptDebugOK().
Definition at line 754 of file ptabasic.c.
References ptaWrite().
| l_ok ptaWriteMem | ( | l_uint8 ** | pdata, |
| size_t * | psize, | ||
| PTA * | pta, | ||
| l_int32 | type ) |
| [out] | pdata | data of serialized pta; ascii |
| [out] | psize | size of returned data |
| [in] | pta | |
| [in] | type | 0 for float values; 1 for integer values |
Notes:
(1) Serializes a pta in memory and puts the result in a buffer.
Definition at line 854 of file ptabasic.c.
References ptaWriteStream().
| l_ok ptaWriteStream | ( | FILE * | fp, |
| PTA * | pta, | ||
| l_int32 | type ) |
| [in] | fp | file stream |
| [in] | pta | |
| [in] | type | 0 for float values; 1 for integer values |
Definition at line 807 of file ptabasic.c.
References PTA_VERSION_NUMBER, ptaGetCount(), ptaGetIPt(), and ptaGetPt().
Referenced by ptaaWriteStream(), ptaWrite(), and ptaWriteMem().
|
static |
n'importe quoi
Definition at line 104 of file ptabasic.c.
Referenced by ptaaCreate(), and ptaCreate().
|
static |
Definition at line 102 of file ptabasic.c.
|
static |
Definition at line 103 of file ptabasic.c.