EyesOnIt C# SDK
The EyesOnIt C# SDK provides typed request and response models for image processing, stream monitoring, search, video processing, face recognition, and real-time Socket.IO updates.
In This Section
Installation
Install the package from NuGet:
dotnet add package eyesonit.csharp.sdk --version 4.0.0
The package targets .NET Framework 4.8.
Namespaces
using EyesOnItSDK.API;
using EyesOnItSDK.API.Elements;
using EyesOnItSDK.API.Inputs;
using EyesOnItSDK.API.Outputs;
using EyesOnItSDK.SocketIO;
Create A Client
EyesOnItAPI is the main SDK client.
var client = new EyesOnItAPI("http://localhost:8000");
Use the base URL of your EyesOnIt server, including protocol and port.
Quick Start: Process One Image
Create most request models by constructing the object and then assigning properties.
using System;
using System.IO;
using System.Threading.Tasks;
using EyesOnItSDK.API;
using EyesOnItSDK.API.Elements;
using EyesOnItSDK.API.Inputs;
public static async Task Main()
{
var client = new EyesOnItAPI("http://localhost:8000");
var region = new EOIRegion
{
Name = "Front Door",
Polygon = new[]
{
new EOIVertex(0, 0),
new EOIVertex(1280, 0),
new EOIVertex(1280, 720),
new EOIVertex(0, 720),
},
DetectionConfigs = new[]
{
new EOIDetectionConfig
{
ClassName = "person",
ClassThreshold = 25,
ObjectDescriptions = new[]
{
new EOIObjectDescription
{
Text = "person wearing a hard hat",
Threshold = 80,
Alert = true,
},
new EOIObjectDescription
{
Text = "walls and floor",
BackgroundPrompt = true,
},
},
DetectionConditions = new[]
{
new EOIDetectionCondition
{
Type = "count_greater_than",
Count = 0,
},
},
AlertSeconds = 2f,
ResetSeconds = 10f,
},
},
};
var image = Convert.ToBase64String(File.ReadAllBytes("frame.jpg"));
var inputs = new EOIProcessImageInputs(image, new[] { region })
{
ReturnImage = true,
};
var response = await client.ProcessImage(inputs);
if (!response.Success)
{
throw new InvalidOperationException(response.Message);
}
foreach (var detection in response.Detections ?? new())
{
Console.WriteLine(detection.Region);
}
}
Stream Monitoring Workflow
A typical stream workflow is:
- Build an
EOIAddStreamInputsrequest with the stream URL, regions, and optional lines, notifications, recording, and effects. - Call
AddStream(...). - Call
MonitorStream(...)for the same stream URL. - Query
GetLastDetectionInfo(...),GetVideoFrame(...), orGetStreamDetails(...)as needed. - Call
StopMonitoringStream(...)andRemoveStream(...)when you are done.
Example:
using System;
using System.Threading.Tasks;
using EyesOnItSDK.API;
using EyesOnItSDK.API.Elements;
using EyesOnItSDK.API.Inputs;
public static async Task Main()
{
var client = new EyesOnItAPI("http://localhost:8000");
var addInputs = new EOIAddStreamInputs
{
StreamUrl = "rtsp://camera-01/live",
Name = "Warehouse Camera 01",
FrameRate = 5,
Regions = new[]
{
new EOIRegion
{
Name = "Warehouse Floor",
Polygon = new[]
{
new EOIVertex(0, 0),
new EOIVertex(1280, 0),
new EOIVertex(1280, 720),
new EOIVertex(0, 720),
},
DetectionConfigs = new[]
{
new EOIDetectionConfig
{
ClassName = "person",
DetectionConditions = new[]
{
new EOIDetectionCondition
{
Type = "count_greater_than",
Count = 0,
},
},
},
},
},
},
Notification = new EOINotification
{
IncludeImage = true,
RestUrl = "https://example.com/alerts",
},
};
var addResponse = await client.AddStream(addInputs);
if (!addResponse.Success)
{
throw new InvalidOperationException(addResponse.Message);
}
var monitorResponse = await client.MonitorStream(new EOIMonitorStreamInputs(addInputs.StreamUrl, null));
if (!monitorResponse.Success)
{
throw new InvalidOperationException(monitorResponse.Message);
}
}
Search Workflows
The SDK exposes two search entry points:
SearchArchive(EOIArchiveSearchInputs inputs)SearchLive(EOILiveSearchInputs inputs)
Use EOISearchInputs fields to search by:
- natural language with
ObjectDescription - face recognition with
FaceMatchType,FacePersonId, orFaceGroupId - similarity with
Similarity
EOILiveSearchInputs also supports DurationSeconds and Notification.
Example live search:
using System;
using System.Threading.Tasks;
using EyesOnItSDK.API;
using EyesOnItSDK.API.Inputs;
public static async Task Main()
{
var client = new EyesOnItAPI("http://localhost:8000");
var inputs = new EOILiveSearchInputs
{
ClassName = "person",
SearchType = "natural_language",
ObjectDescription = "person wearing a red backpack",
AlertThreshold = 80,
StreamList = new[] { "rtsp://camera-01/live" },
DurationSeconds = 300,
};
var liveResponse = await client.SearchLive(inputs);
if (!liveResponse.Success)
{
throw new InvalidOperationException(liveResponse.Message);
}
await client.PauseLiveSearch(new EOIUpdateLiveSearchInputs(liveResponse.SearchId));
await client.ResumeLiveSearch(new EOIUpdateLiveSearchInputs(liveResponse.SearchId));
await client.CancelLiveSearch(new EOIUpdateLiveSearchInputs(liveResponse.SearchId));
}
Face Recognition Workflow
Typical face recognition setup is:
- Create a group with
AddFacerecGroup(...). - Create a person with
AddFacerecPerson(...). - Add one or more images for that person.
- Use face recognition in stream detection configuration or search inputs.
- Query groups, people, and person details when needed.
Example:
using System;
using System.IO;
using System.Threading.Tasks;
using EyesOnItSDK.API;
using EyesOnItSDK.API.Inputs;
public static async Task Main()
{
var client = new EyesOnItAPI("http://localhost:8000");
var groupResponse = await client.AddFacerecGroup(
new EOIAddFacerecGroupInputs(
"employees",
"Employees",
"Known employees for building access"
)
);
if (!groupResponse.Success)
{
throw new InvalidOperationException(groupResponse.Message);
}
var person = new EOIAddFacerecPersonInputs(
"person-001",
"Taylor Chen",
new[] { "employees" }
);
person.AddImageBase64(
Convert.ToBase64String(File.ReadAllBytes("taylor-chen.jpg")),
"taylor-chen.jpg"
);
var personResponse = await client.AddFacerecPerson(person);
if (!personResponse.Success)
{
throw new InvalidOperationException(personResponse.Message);
}
}
Real-Time Updates
Use SocketClient when you want stream updates, detections, performance data, or live-search events over Socket.IO.
See Socket Handling for the connection workflow, room subscriptions, handlers, and payload types.
Utility Helpers
EOIAPIUtils includes helpers for common tasks such as:
- finding one stream in a list with
GetInfoForStream(...) - retrieving the minimum supported region size with
GetMinimumRegionSize() - serializing or deserializing lists of
EOIAddStreamInputs