ROI Tracker

ROI Tracker is a new feature of the Media Vision API since Tizen 7.0 (C# API10). The RoiTracker API allows users to obtain the proper ROI coordinates that users want to track in an image. For example, when an image and ROI coordinates are provided as input to this API, the Media Vision framework will process the given image and ROI coordinates from the decoded image data and will provide ROI coordinates within the given image.

Prerequisites

To enable your application to use the ROI tracker and generation functionality, follow the steps below:

  1. Install the NuGet packages for media vision.

  2. To use ROI Tracker, include the Tizen.Multimedia and Tizen.Multimedia.Vision namespaces in your application:

    C#
    Copy
    using Tizen.Multimedia; using Tizen.Multimedia.Vision;

Prepare a MediaVisionSource

Prepare an input source to track. In this example, we use ImageUtil APIs to get the image buffer:

C#
Copy
MediaVisionSource inputSource = null; using (JpegDecoder jpegDecoder = new JpegDecoder()) { jpegDecoder.SetColorSpace(ColorSpace.Rgb888); var frame = (await jpegDecoder.DecodeAsync("path")).FirstOrDefault(); inputSource = new MediaVisionSource(frame.Buffer, (uint)frame.Size.Width, (uint)frame.Size.Height, ColorSpace.Rgb888); }

Track ROI area

To track an ROI area, follow the steps below:

  1. Prepare a RoiTracker configuration:

    C#
    Copy
    var roiTrackingConfiguration = new RoiTrackingConfiguration(); // If you don't set TrackerType, it will be RoiTrackerType.Balance. roiTrackingConfiguration.TrackerType = RoiTrackerType.Accuracy; // ROI should be set. // If you don't set the ROI property before calling TrackAsync, TrackAsync method will throw ArgumentException. roiTrackingConfiguration.Roi = new Rectangle(10, 10, 100, 100);
  2. Track an ROI area:

    C#
    Copy
    var result = await RoiTracker.TrackAsync(inputSource, roiTrackingConfiguration); Log.Info("RoiTracker", $"X={result.X}, Y={result.Y}, Width={result.Width}, Height={result.Height}, ");
    Note

    If you want to change ROI area after calling TrackAsync, you should create RoiTrackingConfiguration again.

  3. Dispose of MediaVisionSource and RoiTrackingConfiguration instances, after using them:

    C#
    Copy
    inputSource?.Dispose(); roiTrackingConfiguration?.Dispose();
  • Dependencies
    • Tizen 7.0 and Higher
Pose Detection
Next Audio Management
Submit your feedback to GitHub