Detect and frame faces in an image on Windows

This repository contains the sample discussed in Create a WPF app to detect and frame faces in an image. The sample uses the Windows client library for the Cognitive Services Face service.


This project provides the following features:

  • Detects faces in an image.
  • Draws a rectangle around each face.
  • Displays face attributes in the status bar when the mouse hovers over each face rectangle.


Getting Started



  1. Clone or download the repository.
  2. Open the FaceTutorialCS folder in the repository.
  3. Double-click the FaceTutorialCS.sln file, which opens in Visual Studio.
  4. Expand MainWindow.xaml, then open MainWindow.xaml.cs.
  5. Replace <SubscriptionKey> with your valid subscription key.
  6. Replace or verify the Azure region (faceEndpoint) associated with your key.
  7. Build the project, which installs the Face service NuGet package.
  8. Run the program.
  9. Browse and select an image containing faces.
  10. Wait a few seconds for the Face service to respond.
  11. Move your mouse over a face rectangle to see a description of that face on the status bar.

For more information, see Getting Started with Face API in C# Tutorial.