Detect object movements

Contents
[ ]

One more example of how object detection API could be exploited is that it can be used to protect vehicles against unauthorized use. The main idea is that an application could send images of a vehicle to Aspose Object Detection service with a certain interval, receive the coordinates of its boundaries on the image, and detect its movements. Once the coordinates of the object change, the application sends an alert to the owner. For example, this is how car owners could be instantly informed about their car being stolen from a parking lot.

todo:image_alt_text

/// <summary>
/// Detect object on an image that is passed in a request stream.
/// </summary>
public void DetectObjectMovements(string objectLabel, int initTopLeftX, int initTopLeftY)
{
Console.WriteLine("Detect objects on an image. Image data is passed in a request stream");
using (FileStream inputImageStream = File.OpenRead(Path.Combine(ExampleImagesFolder, SampleImageFileName)))
{
string method = "ssd";
int threshold = 50;
bool includeLabel = true;
bool includeScore = true;
string outPath = null;
string storage = null; // We are using default Cloud Storage
var request = new CreateObjectBoundsRequest(inputImageStream, method, threshold, includeLabel, includeScore, outPath, storage);
Console.WriteLine($"Call CreateObjectBoundsRequest with params: method:{method}, threshold:{threshold}, include label: {includeLabel}, includeScore: {includeScore}");
DetectedObjectList detectedObjectList = this.ImagingApi.CreateObjectBounds(request);
foreach(var detectedObject in detectedObjectList)
{
if(detectedObject.Label == objectLabel)
{
if(detectedObject.Bounds.X != initTopLeftX
|| detectedObject.Bounds.Y != initTopLeftY)
{
//object moved
ShowAlertMessage();
}
}
}
}
Console.WriteLine();
}