Package org.jetbrains.kotlinx.dl.visualization

Types

DetectorViewBase
Link copied to clipboard
abstract class DetectorViewBase<T>(context: Context, attrs: AttributeSet) : View

Base class for View implementations which visualize detected results on top of the image preview. Derived classes should implement drawDetection method to perform actual drawing.

PreviewImageBounds
Link copied to clipboard
data class PreviewImageBounds(x: Float, y: Float, width: Float, height: Float)

Defines location and size of the actual preview image relative to the PreviewView. This information can be used to convert from the image coordinate system to the view coordinate system.

Functions

bounds
Link copied to clipboard
fun Canvas.bounds(): PreviewImageBounds

Create PreviewImageBounds originating in the top-left corner of this Canvas object and matching its dimensions.

drawLandmark
Link copied to clipboard
fun Canvas.drawLandmark(landmark: Landmark, paint: Paint, radius: Float, bounds: PreviewImageBounds = bounds())

Draw a given landmark on the Canvas using paint and radius.

drawLandmarks
Link copied to clipboard
fun Canvas.drawLandmarks(landmarks: List<Landmark>, paint: Paint, radius: Float, bounds: PreviewImageBounds = bounds())

Draw given landmarks on the Canvas using paint and radius.

drawMultiplePoses
Link copied to clipboard
fun Canvas.drawMultiplePoses(detectedPoses: MultiPoseDetectionResult, landmarkPaint: Paint, edgePaint: Paint, objectPaint: Paint, labelPaint: TextPaint, landmarkRadius: Float, bounds: PreviewImageBounds = bounds())

Draw given detectedPoses on the Canvas using landmarkPaint and landmarkRadius for the pose vertices, edgePaint for the poses edges, objectPaint for the bounding box and labelPaint for the label.

drawObject
Link copied to clipboard
fun Canvas.drawObject(detectedObject: DetectedObject, paint: Paint, labelPaint: TextPaint, bounds: PreviewImageBounds = bounds())

Draw given detectedObject on the Canvas using paint for the bounding box and labelPaint for the label.

drawObjects
Link copied to clipboard
fun Canvas.drawObjects(detectedObjects: List<DetectedObject>, paint: Paint, labelPaint: TextPaint, bounds: PreviewImageBounds = bounds())

Draw given detectedObjects on the Canvas using paint for the bounding box and labelPaint for the label.

drawPose
Link copied to clipboard
fun Canvas.drawPose(detectedPose: DetectedPose, landmarkPaint: Paint, edgePaint: Paint, landmarkRadius: Float, bounds: PreviewImageBounds = bounds())

Draw given detectedPose on the Canvas using landmarkPaint and landmarkRadius for the pose vertices, and edgePaint for the pose edges.

getPreviewImageBounds
Link copied to clipboard
fun getPreviewImageBounds(sourceImageWidth: Int, sourceImageHeight: Int, viewWidth: Int, viewHeight: Int, scaleType: PreviewView.ScaleType): PreviewImageBounds

Calculate the location of the preview image top-left corner (relative to the component top-left corner) and dimensions, to be used for displaying detected objects, for example with the DetectorViewBase.