boxaAddBox
boxaAddBox is a function in the Leptonica image processing library that appends a bounding box to a Boxa, a dynamic array structure used to store multiple BOX records. It is commonly employed after region detection to collect bounding boxes for further analysis or processing.
The signature is typically BOXA boxaAddBox(BOXA boxa, BOX box, l_int32 copyflag); where:
- boxa is the target Boxa to which the box will be added.
- copyflag specifies how the box is added, usually L_COPY to add a copy of the box, or
- The function appends the provided box to the end of the Boxa, resizing the internal storage as
- If copyflag is L_COPY, a duplicate of the box is created and stored; if L_NOCOPY, the original
- If either boxa or box is NULL, the function returns NULL to indicate an error.
- On success, returns the (possibly reallocated) boxa pointer containing the new box.
- On failure, returns NULL and may set an error condition in the Leptonica error system.
- Copy semantics: using L_COPY ensures the Boxa owns its own copy of the box, avoiding side
- Memory management: when using L_COPY, the caller is responsible for freeing the original box if it
See also: boxaCreate, boxaGetBox, boxaGetCount, boxaReplaceBox, and other Boxa management routines.
---