public static class ParameterUtils.WeightedRectangle extends Object
The user of this class must know what the coordinate system ahead of time; it's then possible to convert to a more concrete type such as a metering rectangle or a face.
When converting to a more concrete type, out-of-range values are clipped; this prevents possible illegal argument exceptions being thrown at runtime.
Modifier and Type | Field and Description |
---|---|
Rect |
rect
Arbitrary rectangle (the range is user-defined); never
null . |
int |
weight
Arbitrary weight (the range is user-defined).
|
Constructor and Description |
---|
WeightedRectangle(Rect rect,
int weight)
Create a new weighted-rectangle from a non-
null rectangle; the weight
can be unbounded. |
Modifier and Type | Method and Description |
---|---|
Face |
toFace()
Convert to a face; the rect is considered to be the bounds, and the weight
is considered to be the score.
|
Face |
toFace(int id,
Point leftEyePosition,
Point rightEyePosition,
Point mouthPosition)
Convert to a face; the rect is considered to be the bounds, and the weight
is considered to be the score.
|
MeteringRectangle |
toMetering()
Convert to a metering rectangle, clipping any of the values to stay within range.
|
public final Rect rect
null
.public final int weight
public WeightedRectangle(Rect rect, int weight)
null
rectangle; the weight
can be unbounded.public MeteringRectangle toMetering()
If values are clipped, a warning is printed to logcat.
public Face toFace(int id, Point leftEyePosition, Point rightEyePosition, Point mouthPosition)
If the score is out of range of , , the score is clipped first and a warning is printed to logcat.
If the id is negative, the id is changed to 0 and a warning is printed to logcat.
All other parameters are passed-through as-is.
public Face toFace()
If the score is out of range of , , the score is clipped first and a warning is printed to logcat.
All other parameters are passed-through as-is.