hawk_eye.inference.inference_types¶
Contains basic storage types passed around in the library.
-
class
hawk_eye.inference.inference_types.
Color
[source]¶ Contains colors for the AUVSI SUAS Interop Server.
These colors can be used for both the background color and the alphanumeric color.
Note
NONE
can be used if a color cannot be identified.
-
class
hawk_eye.inference.inference_types.
Shape
[source]¶ Contains target shapes for the AUVSI SUAS Interop Server.
Note
NAS
(not-a-shape) can be used if a shape cannot be identified.
-
class
hawk_eye.inference.inference_types.
Target
(x: int, y: int, width: int, height: int, shape: Optional[hawk_eye.inference.inference_types.Shape] = <Shape.NAS: 0>, orientation: Optional[float] = 0.0, background_color: Optional[hawk_eye.inference.inference_types.Color] = <Color.NONE: 0>, alphanumeric: Optional[str] = '', alphanumeric_color: Optional[hawk_eye.inference.inference_types.Color] = <Color.NONE: 0>, image: Optional[PIL.Image.Image] = None, confidence: Optional[float] = 0.0)[source]¶ Represents a target found on an image.
This is intended to be built upon as the the target is being classified. Note that a target must have at least an x-position, y-position, width, and height to be created. A target should only be returned back by the library if at also contains a background color as well.
- Parameters
x – The x position of the top-left corner in pixels.
y – The y position of the top-left corner in pixels.
width – The width of the blob in pixels.
height – The height of the blob in pixels.
orientation – The orientation of the target. An orientation of 0 means the target is not rotated, an orientation of 90 means it the top of the target points to the right of the image (0 <= orientation < 360).
shape – The target
Shape
.background_color – The target background
Color
.alphanumeric – The letter(s) and/or number(s) on the target. May consist of one or more of the characters 0-9, A-Z, a-z. Typically, this will only be one capital letter.
alphanumeric_color – The target alphanumeric
Color
.image – Image showing the target.
confidence – The confidence that the target exists (0 <= confidence <= 1).
-
overlaps
(other_target: hawk_eye.inference.inference_types.Shape) → bool[source]¶ Check if another
Target
has overlap.- Parameters
other_target – The other
Target
to compare with.- Returns
True
if there is overlap,False
if no overlap.
Examples:
>>> target1 = Target(x=0, y=0, width=10, height=10) >>> target2 = Target(x=7, y=5, width=11, height=12) >>> target1.overlaps(target2) True >>> target1 = Target(x=0, y=0, width=10, height=10) >>> target2 = Target(x=20, y=22, width=30, height=32) >>> target1.overlaps(target2) False