{
  "id": 898453,
  "title": "Real-Time Object Detection and Tracking with Kotlin and YOLO on Android",
  "url": "https://urgent.news/2026/08/14/real-time-object-detection-and-tracking-with-kotlin-and-yolo-on",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-14T19:07:04.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/vmodal_ai/real-time-object-detection-and-tracking-with-kotlin-and-yolo-on-android-3p78"
  },
  "original_language": "en",
  "account": "Real-time object detection and tracking using Kotlin and YOLO on Android presents a practical application of machine learning for mobile devices. Leveraging Android's camera capabilities, GPU acceleration, and sufficient processing power, developers can build a Kotlin application to capture camera frames, execute a YOLO-style object detector, and track detected objects across frames.\n\nThe recommended architecture maintains camera capture, inference, tracking, and rendering as separate components. To set up CameraX, add the necessary dependencies compatible with your project:\n\ndependencies {\nimplementation( androidx.camera:camera-camera2: version )\nimplementation( androidx.camera:camera-lifecycle: version )\nimplementation( androidx.camera:camera-view: version )\n}\n\nCreating an ImageAnalysis use case is crucial for real-time applications. Set the backpressure strategy to KEEP_ONLY_LATEST to ensure only the latest frame is processed, preventing the accumulation of old frames in a growing queue and increasing latency. Implement an ObjectAnalyzer that receives camera frames and calls YoloDetector to detect objects within those frames, properly closing the ImageProxy when processing is complete.\n\nThe YOLO Detector class converts camera input into the tensor format expected by the model by preprocessing the image, running the model, and postprocessing the output. Detection results typically include bounding boxes, class IDs, confidence scores, and optional metadata. Data class Detection represents each detection with associated attributes.\n\nPreprocessing is vital since most object detection models require a fixed input size. For example, rotate the camera frame, crop or resize it, normalize the data, and convert it to a tensor format. Be cautious with aspect ratio when scaling objects, as incorrect scaling can distort objects and negatively impact detection accuracy.\n\nPostprocessing involves filtering out low-confidence detections using a confidence threshold and applying non-maximum suppression (NMS) to eliminate overlapping boxes representing the same object. The chosen threshold should be tuned based on the specific target model and dataset.\n\nTracking objects across frames is essential for maintaining an object's identity throughout multiple frames. A simple tracked object data class can store an ID, bounding box, class ID, and confidence score. A basic tracker associates current detections with existing objects using Intersection over Union (IoU). Implement a function to calculate IoU, which compares two RectF objects to determine their intersection over union, helping to associate detections with existing tracked objects.\n\nFinally, use a custom Android view to draw bounding boxes over the camera preview, allowing developers to visually represent object detection results in real-time.",
  "summary": "Real-Time Object Detection and Tracking with Kotlin and YOLO on Android Real-time computer vision is one of the most useful applications of machine learning on mobile devices. Android phones provide cameras, GPU acceleration, and enough processing power to run optimized detection models locally. In this tutorial, we will build the architecture for a Kotlin application that captures camera frames,…",
  "key_points": [
    "Kotlin application captures camera frames for real-time object detection",
    "YOLO-style detector processes frames with GPU acceleration",
    "Tracking system maintains object identity across frames using IoU"
  ],
  "editors_take": null,
  "illustration": "https://urgent.news/ill/898453.png",
  "coverage": {
    "outlets": 2,
    "also_reported_by": [
      {
        "outlet": "Dev.to",
        "title": "Build a Federated Learning System on Android with Kotlin",
        "url": "https://urgent.news/2026/08/14/build-a-federated-learning-system-on-android-with-kotlin",
        "published": "2026-08-14T19:10:43.000Z"
      }
    ]
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}