Use the objects provided by the SAFR SDK by importing the RealNetworks.ArgusKit
assembly into your C# source file. The following code example shows how to do that and the basic steps for setting up an object tracker:
using RealNetworks.ArgusKit;
using System.Windows;
namespace Sample
{
public partial class MainWindow : Window
{
// The object tracker
private ObjectTracker ObjectTracker = null;
public MainWindow()
{
InitializeComponent();
// Select the cloud environment
var cloud = CloudEnvironment.Prod;
// Define the cloud account
var account = new CloudAccount("user", "pwd");
// Create the object tracker configuration
var config = new ObjectTrackerConfiguration();
config.Recognizer.Cloud = cloud;
config.Recognizer.Account = account;
...
// Create the object tracker
ObjectTracker = new ObjectTracker(config);
ObjectTracker.DidTrack += OnDidTrack;
}
// We assume that this function is invoked from a video player or a camera
// that outputs a BitmapSource for every video frame. We wrap the video
// frame up and pass it to the object tracker.
private void OnNewVideoFrameAvailable(RealNetworks.CameraKit.VideoFrame frame)
{
ObjectTracker?.TrackObjects(frame);
}
// Invoked by the object tracker every time the tracking state has changed
private void OnDidTrack(object sender, ObjectTrackerDidTrackEventArgs e)
{
TrackingResult result = e.Result;
// Process the tracking result
...
}
}
}
Note: The only supported solution platform is "x64". Other configurations, including "Any CPU" and "x86", are not supported.