OutlineScaler

class OutlineScaler(val frameWidth: Int, val frameHeight: Int, val containerWidth: Float, val containerHeight: Float)

A utility class to handle the scaling of outlines (the bounding boxes used for object detections) into a container, while keeping the aspect ratio of the original frame (camera ratio)

Parameters

frameWidth

The width of the frame, captured by the camera

frameHeight

The height of the frame, captured by the camera

containerWidth

The width of the container where the outline will be drawn

containerHeight

The height of the container where the outline will be drawn

Constructors

Link copied to clipboard
constructor(frameWidth: Int, frameHeight: Int, containerWidth: Float, containerHeight: Float)

Types

Link copied to clipboard
data class ScaledBox(val xLeft: Float, val yTop: Float, val width: Float, val height: Float)

Data class representing the scaled box with its dimensions and position

Properties

Link copied to clipboard
private val containerHeight: Float
Link copied to clipboard
private val containerWidth: Float
Link copied to clipboard
private val frameHeight: Int
Link copied to clipboard
private val frameWidth: Int

Functions

Link copied to clipboard

Scales the given bounding box dimensions and positions to fit inside a container, like a BoxWithConstraints.