Skip to content

This sample contains a library, along with two applications, for analyzing video frames from a webcam in near-real-time using APIs from Microsoft Cognitive Services. The library and applications are implemented in C#, and use the OpenCvSharp package for webcam support.

License

Notifications You must be signed in to change notification settings

cyenite/Cognitive-Video-Frame-Analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Video Frame Analysis Sample

This sample contains a library, along with two applications, for analyzing video frames from a webcam in near-real-time using APIs from Microsoft Cognitive Services. The library and applications are implemented in C#, and use the OpenCvSharp package for webcam support.

Getting Started

  1. Get API keys for the Vision APIs from microsoft.com/cognitive. For video frame analysis, the applicable APIs are:
  2. Open the sample in Visual Studio 2015, build and run the sample applications:
    • For BasicConsoleSample, the Face API key is hard-coded directly in BasicConsoleSample/Program.cs.
    • For LiveCameraSample, the keys should be entered into the Settings pane of the app. They will be persisted across sessions as user data.
  3. Reference the VideoFrameAnalyzer library from your own projects.

Using the VideoFrameAnalyzer Library

You can start using the library with only a few lines of code:

// Create Face API Client. 
FaceServiceClient faceClient = new FaceServiceClient("<subscription key>","<api root>");
// Create grabber, with analysis type Face[]. 
FrameGrabber<Face[]> grabber = new FrameGrabber<Face[]>();
// Set up Face API call, which returns a Face[]. Simply encodes image and submits to Face API. 
grabber.AnalysisFunction = async frame => return await faceClient.DetectAsync(frame.Image.ToMemoryStream(".jpg"));
// Tell grabber to call the Face API every 3 seconds. 
grabber.TriggerAnalysisOnInterval(TimeSpan.FromMilliseconds(3000));
// Start running. 
await grabber.StartProcessingCameraAsync();

License

All Microsoft Cognitive Services SDKs and samples are licensed with the MIT License. For more details, see LICENSE.

About

This sample contains a library, along with two applications, for analyzing video frames from a webcam in near-real-time using APIs from Microsoft Cognitive Services. The library and applications are implemented in C#, and use the OpenCvSharp package for webcam support.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages