Skip to main content

EyesOnIt

The main class for the EyesOnIt SDK. This class contains the methods required to use the SDK.

Namespace: EyesOnItSDK

Methods

AddStream

This method allows you to add a stream to EyesOnIt which you can then monitor. When a stream is added to EyesOnIt, it is ready to be monitored, but monitoring must be initiated manually with the Monitor Stream method below.

Signature 1

public async Task<EOIResponse> AddStream(EOIAddStreamInputs inputs)

Parameters

NameTypeDescription
inputsEOIAddStreamInputsthe input data for the AddStream method

Return

Type: EOIResponse - the response object providing a success flag and other details

Signature 2

public async Task<EOIAddStreamInputs>AddStream(
string streamUrl,
string name,
EOIRegion[] regions,
int objectSize,
EOIObjectDescription[] objectDescriptions,
EOIAlerting alerting,
EOIMotionDetection motionDetection = null,
EOIBoundingBox boundingBox = null,
int? frameRate = 5)

Parameters

NameTypeDescription
streamUrlstringthe RTSP URL for the stream including credentials required to connect to the stream
namestringa friendly name for the stream used in the EyesOnIt Web UI and in alerts
regionsEOIRegion[]an array of rectangle detection regions
objectSizeintthe estimated object size in pixels
objectDescriptionsEOIObjectDescription[]an array of object descriptions describing objects to detect
alertingEOIAlertingthe alerting settings for this stream
motionDetectionEOIMotionDetectionthe motion detection settings for this stream
boundingBoxEOIBoundingBoxthe common object detection settings for this stream
frameRateint?the frame rate for this stream. Set

Return

Type: EOIResponse - the response object providing a success flag and other details

Code Sample

// initialize the EyesOnIt SDK
EyesOnIt eyesOnItSDK = new EyesOnIt("http://192.168.1.11:8000");

// Define video stream to process
EOIAddStreamInputs addStreamInputs = new EOIAddStreamInputs()
{
StreamUrl = "rtsp://192.168.1.54/live0", // specify the stream RTSP URL
Name = "Street Camera", // provide a friendly name for the stream
Regions = new EOIRegion[] // specify the area in the frame to process
{
new EOIRegion(435, 388, 600, 224)
},
ObjectDescriptions = new EOIObjectDescription[] // provide the descriptions of objects to detect
{
new EOIObjectDescription("vehicle", false) { Threshold = 90 },
new EOIObjectDescription("landscape", true)
},
ObjectSize = 250, // provide the estimated object size in pixels
Alerting = new EOIAlerting() // provide the alerting settings
{
AlertSecondsCount = 0.4,
ResetSecondsCount = 2,
PhoneNumber = "+11234567890",
ImageNotification = true
}
};

// Add stream to EyesOnIt
EOIResponse response = await eyesOnItSDK.AddStream(addStreamInputs); // add the stream and await the response

if (response.Success)
{
// Monitor stream
await eyesOnItSDK.MonitorStream(addStreamInputs.StreamUrl, null); // AddStream succeeded. Monitor the stream.
}

RemoveStream

This method removes a stream from EyesOnIt which was previously added with the AddStream method. When a stream is removed from EyesOnIt the license for that stream will be free to use for another stream after 24 hours.

Signature 1

public async Task<EOIResponse> RemoveStream(EOIRemoveStreamInputs inputs)

Parameters

NameTypeDescription
inputsEOIRemoveStreamInputsan object encapsulating the inputs for the RemoveStream call

Return

Type: EOIResponse - the response object providing a success flag and other details

Signature 2

public async Task<EOIResponse> RemoveStream(string streamUrl)

Parameters

NameTypeDescription
streamUrlstringthe URL of the stream to remove. This URL must exactly match the streamUrl provided to the AddStream method.

Return

Type: EOIResponse - the response object providing a success flag and other details

MonitorStream

This method monitors a stream which was previously added to EyesOnIt with the AddStream method. When a stream is being monitored, EyesOnIt processes the stream and generates alerts according to the AddStream parameters.

Signature 1

public async Task<EOIResponse> MonitorStream(EOIMonitorStreamInputs inputs)

Parameters

NameTypeDescription
inputsEOIMonitorStreamInputsan object encapsulating the inputs for the MonitorStream call

Return

Type: EOIResponse - the response object providing a success flag and other details

Signature 2

public async Task<EOIResponse> MonitorStream(string streamUrl, int? durationSeconds)

Parameters

NameTypeDescription
streamUrlstringthe URL of the stream to monitor. This value must exactly match the stream URL provided to the AddStream method
durationSecondsint?an option parameter indicating the duration in seconds to monitor the stream. If provided, EyesOnIt will monitor the stream for duration_seconds and then automatically stop monitoring. If not provided, the stream is monitored until monitoring is manually terminated by calling StopMonitoring or RemoveStream.

Return

Type: EOIResponse - the response object providing a success flag and other details

StopMonitoringStream

This method stops monitoring of a stream which was previously added to EyesOnIt and monitored with the AddStream and MonitorStream methods.

Signature 1

public async Task<EOIResponse> StopMonitoringStream(EOIStopMonitoringStreamInputs inputs)

Parameters

NameTypeDescription
inputsEOIStopMonitoringStreamInputsan object encapsulating the inputs for the StopMonitoringStream call

Return

Type: EOIResponse - the response object providing a success flag and other details

Signature 2

public async Task<EOIResponse> StopMonitoringStream(string streamUrl)

Parameters

NameTypeDescription
streamUrlstringthe URL of the stream to stop monitoring. This value must exactly match the stream URL provided to the AddStream method

Return

Type: EOIResponse - the response object providing a success flag and other details

GetPreviewVideoFrame

This method gets a video frame from a stream that has not been added to EyesOnIt.

Signature 1

public async Task<EOIResponse> GetPreviewVideoFrame(EOIGetPreviewFrameInputs inputs)

Parameters

NameTypeDescription
inputsEOIGetPreviewFrameInputsan object encapsulating the inputs for the GetPreviewVideoFrame call

Return

Type: EOIResponse - the response object providing a success flag and other details. If successful, the frame is returned as a base64 encoded string in the Image property.

Signature 2

public async Task<EOIResponse> GetPreviewVideoFrame(string streamUrl)

Parameters

NameTypeDescription
streamUrlstringthe RTSP URL of the stream from which to get a video frame

Return

Type: EOIResponse - the response object providing a success flag and other details

GetVideoFrame

This method gets a video frame from a stream that has been added to EyesOnIt and is being monitored. To get a video frame from a stream that is not being monitored, call MonitorStream to monitor the stream temporarily, then call GetVideoFrame, then call StopMonitoringStream.

Signature 1

public async Task<EOIResponse> GetVideoFrame(EOIGetVideoFrameInputs inputs)

Parameters

NameTypeDescription
inputsEOIGetVideoFrameInputsan object encapsulating the inputs for the GetVideoFrame call

Return

Type: EOIResponse - the response object providing a success flag and other details. If successful, the frame is returned as a base64 encoded string in the Image property.

Signature 2

public async Task<> GetVideoFrame(string streamUrl)

Parameters

NameTypeDescription
streamUrlstringthe RTSP URL of the stream from which to get a video frame. The stream must be in the monitoring state.

Return

Type: EOIResponse - the response object providing a success flag and other details. If successful, the frame is returned as a base64 encoded string in the Image property.

ProcessImage

This method uses the EyeOnIt Large Vision Model to process a single base64-encoded image.

Signature 1

public async Task<EOIResponse> ProcessImage(EOIProcessImageInputs inputs)

Parameters

NameTypeDescription
inputsEOIProcessImageInputsan object encapsulating the inputs for the ProcessImage call

Return

Type: EOIResponse - the response object providing a success flag and other details. The confidence levels associated with the provided object descriptions are available in the ConfidenceLevels map property.

Signature 2

public async Task<EOIResponse> ProcessImage(
string base64Image,
EOIRegion[] regions,
int objectSize,
EOIObjectDescription[] objectDescriptions)

Parameters

NameTypeDescription
base64Imagestringthe base64 encoding of the image to process
regionsEOIRegion[]the array of regions to use for processing
objectSizeintthe object size in pixels for processing
objectDescriptionsEOIObjectDescription[]the array of object descriptions to use for processing

Return

Type: EOIResponse - the response object providing a success flag and other details

ProcessImageFromFile

This method uses the EyeOnIt Large Vision Model to process a single image from a file.

Signature 1

public async Task<EOIResponse> ProcessImageFromFile(EOIProcessImageInputs inputs, string filePath)

Parameters

NameTypeDescription
inputsEOIProcessImageInputsan object encapsulating the inputs for the ProcessImage call. The Base64Image property of this object is ignored by ProcessImageFromFile.
filePathstringthe path of the file to process. EyesOnIt supports these file types: png, jpg / jpeg, webp, tif, bmp

Return

Type: EOIResponse - the response object providing a success flag and other details. The confidence levels associated with the provided object descriptions are available in the ConfidenceLevels map property.

Signature 2

public async Task<EOIResponse> ProcessImage(
string filePath,
EOIRegion[] regions,
int objectSize,
EOIObjectDescription[] objectDescriptions)

Parameters

NameTypeDescription
filePathstringthe path of the file to process. EyesOnIt supports these file types: png, jpg / jpeg, webp, tif, bmp
regionsEOIRegion[]the array of regions to use for processing
objectSizeintthe object size in pixels for processing
objectDescriptionsEOIObjectDescription[]the array of object descriptions to use for processing

Return

Type: EOIResponse - the response object providing a success flag and other details

GetStreamsInfo

This method gets information about each stream that is currently added to EyesOnIt

public async Task<EOIResponse> GetStreamsInfo()

Return

Type: EOIResponse - the response object providing a success flag and other details. If the call is successful, the stream info is contained in the Data property of the EOIResponse object. Cast the Data property to List<[EOIStreamInfo](> to get the stream information as follows:

List<EOIStreamInfo> streamInfoList = (List<EOIStreamInfo>)apiResponse.Data;

GetBoundingBoxObjects

This method gets the bounding box classes supported for common object detection

public async Task<EOIResponse> GetBoundingBoxObjects()

Return

Type: EOIResponse - the response object providing a success flag and other details. If the call is successful, the bounding box object list is contained in the BoundingBoxObjects property of the EOIResponse object.

GetLastDetectionInfo

This method gets information about the last detection for the specified stream

Signature 1

public async Task<EOIResponse> GetLastDetectionInfo(EOIGetLastDetectionInfoInputs inputs)

Parameters

NameTypeDescription
inputsEOIGetLastDetectionInfoInputsan object encapsulating the inputs for the GetLastDetectionInfo call.

Return

Type: EOIResponse - the response object providing a success flag and other details. If the call is successful, the stream info is contained in the Data property of the EOIResponse object. Cast the Data property to EOILastDetection to get the stream information as follows:

EOIResponse detectionInfoResponse = await eoiAPI.GetLastDetectionInfo(streamUrl);

if (detectionInfoResponse.Success && detectionInfoResponse.Data != null)
{
EOILastDetection detectionInfo = (EOILastDetection)detectionInfoResponse.Data;

// process detection info
}

Signature 2

public async Task<EOIResponse> GetLastDetectionInfo(string streamUrl)

Parameters

NameTypeDescription
streamUrlstringthe RTSP URL for the stream from which to get the last detection information. This URL must exactly match the URL provided to the AddStream method

Return

Type: EOIResponse - the response object providing a success flag and other details. If the call is successful, the detection info is contained in the Data property of the EOIResponse object. Cast the Data property to EOILastDetection to get the stream information as follows:

EOIResponse detectionInfoResponse = await eoiAPI.GetLastDetectionInfo(streamUrl);

if (detectionInfoResponse.Success && detectionInfoResponse.Data != null)
{
EOILastDetection detectionInfo = (EOILastDetection)detectionInfoResponse.Data;

// process detection info
}