P2DingoCV.Util.MiscUtil
Classes
|
- class P2DingoCV.Util.MiscUtil.MiscUtil[source]
Bases:
object- static boxesOverlap(b1, b2)[source]
Check if two rectangular bounding boxes overlap.
Parameters
- b1tuple[int, int, int, int]
Bounding box 1 specified as (x, y, width, height).
- b2tuple[int, int, int, int]
Bounding box 2 specified as (x, y, width, height).
Returns
- bool
True if the bounding boxes overlap (intersect), False otherwise.
Notes
Overlap is determined based on the intersection of the boxes’ areas.
Boxes that touch edges but do not share any interior area are considered non-overlapping.
- Parameters:
b1 (Tuple[int, int, int, int])
b2 (Tuple[int, int, int, int])
- Return type:
bool
- static getMode(arr)[source]
- Parameters:
arr (numpy.ndarray)
- Return type:
numpy.ndarray[tuple[int, …], numpy.dtype[numpy.integer]]
- static maskContains(mask_a, mask_b)[source]
Check if one binary mask is completely contained within another.
This function returns True if every non-zero pixel in mask_b falls within a non-zero region of mask_a. In other words, mask_b is entirely “inside” mask_a.
Parameters
- mask_anp.ndarray
Binary mask (0 or 255) representing the “container” region.
- mask_bnp.ndarray
Binary mask (0 or 255) to check for containment within mask_a.
Returns
- bool
True if all non-zero pixels of mask_b are also non-zero in mask_a, False otherwise.
Notes
Both masks must have the same shape.
- This function works for binary masks where foreground pixels are non-zero
(typically 255) and background is zero.