Video Capture application to demonstrate Azure Cognitive Services

Video Capture application to demonstrate Azure Cognitive Services

I regularly demonstrate how to use the Microsoft Azure Cognitive Services and tried to find a way how to send a webcam live stream directly to the Cognitive Services.

The Cognitive-Samples-VideoFrameAnalysis project didn’t fulfill all my requirements, especially I was looking for a .NET Core 3 WPF application with dependency injection and MVVM.

So.. here it is. Feel free to use it, any feedback (or pull request) is welcome!

Videograbber Cognitive Services


The main application uses the OpenCvSharp wrapper to grab frames from the webcam. In a configurable frequency (see constructor of MainViewModel, default is 1 second) the frame is sent to IImageAnalyzer implementations.

Currently two IImageAnalyzers are available: ComputerVision and CustomVision.

.NET Core dependency injection is used to instantiate and configure them.

You can easily extend the application by creating your own IImageAnalyzer implementations.


private void ConfigureServices(IServiceCollection services)
    services.AddSingleton<IVideoGrabber, VideoGrabber>();


    services.AddTransient<IImageAnalyzer, ComputerVisionAnalyzer>();
    services.AddTransient<IImageAnalyzer, CustomVisionAnalyzer>();

        sp => new MainViewModel(


Please specify your endpoint and API key in the appsettings.json file:

    "ComputerVisionSettings": {
        "SubscriptionKey": "[Key]",
        "Endpoint": ""
    "CustomVisionSettings": {
        "PredictionKey": "[Key]",
        "ProjectId": "[GUID]",
        "Iteration": "[IterationName]",
        "Endpoint": "",
        "RecognitionThreshold": 0.75


To get an idea of the approximate costs, I’ve added statistics to the application. Every analyzer specifies the costs per request, the application calculates the total costs and additionally measures the request duration.

Please be aware of the fact that the prices in the repository are in Euro - and might be outdated. The current costs can be found here: Cognitive Services pricing.