How To Recognize Faces With Microsoft Face Cognitive Services API

Face recognition is identifying or confirming the identity of a person using their face. It’s something we humans do from a very early age and we take that process almost for granted. We can do this either in person, using a photo, video, or even a painting or drawing, assuming it’s accurate enough. Getting a computer to perform the same function, though, is an immensely complicated task. In order to have any true success in true facial recognition, recognizing specific faces, rather than the location or area where a face is located, requires artificial intelligence.

Will Microsoft Cognitive Services API built with Native Windows Development recognize faces? Let’s find out all the answers in this post!

The controversy of recognizing faces

As more systems have entered the market with the ability to recognize people’s faces, people began to experience some of the positive benefits, such as the ability to verify the user’s identity when unlocking a smartphone or when carrying out sensitive actions such as accessing a banking app. Before too long law enforcement agencies also began to see how they too might be able to benefit from using this technology to identify wanted criminals or to spot a potential terrorist in a crowded airport. Stopping terrorist attacks and solving crime is of course something we all want. However, like all biometrics, face recognition is not a perfect technology. The face is much more likely to change over time and can also be easily obscured, intentionally or otherwise, with things like masks, hats, and facial hair.

how to use MS Azure Face Recognition

Why is facial recognition so popular around the world?

Other biometric systems like fingerprints and iris scanners can also have challenges that affect their accuracy too, but less so than that of the face. Despite this, facial recognition has some benefits which might make it a good choice – for example, it is contactless, can be used from a significant distance, can be used to recognize persons of interest even if they are no longer physically present, for example via a video recording.

Facial recognition is also passive, which means you don’t need the co-operation of the people whose faces you are recognizing. The downside to that, of course, is that it can be abused by agencies or countries to track their citizens in aid to suppression of their rights, or to keep automated and possibly wide-ranging surveillance of people a government or organization might which to oppress or subjugate.

False negatives or positives can lead to legal troubles

Another downside of face recognition is that it can be “false negative” or “false positive”. False-negative is the situation in which the face recognition system failed to find the matching face from the database even though the database has a matching face. False-positive is the situation in which the system matches a face from a database even though the database doesn’t have any matching face. This can depend on the technology used by face recognition but even organizations with substantial technical resources can apparently make mistakes in recognition. Ultimately it’s the developer’s responsibility to choose and understand the appropriate technology for the use-case of the application they develop.

What is the technology behind face recognition?

The technology behind face recognition is getting a mathematical representation of the face. It uses the distance between eyes and the shape of the chin and then compares that template with existing records in the database. Some systems calculate the probability of the detected face instead of finding a matching.

How To Recognize Faces With Microsoft Face Cognitive Services API

How to use Azure face API for Face recognition?

Azure is a cloud computing platform. They are a great alternative for Amazon Web Services. They provide hundreds of cloud computing services in many categories. They have a category for AI and Machine learning. It has the following AI and Machine learning offers:

  • Machine Learning
  • Cortex Certifai
  • Computer Vision
  • Face
  • Text Analytics
  • Data Science Virtual Machine – Ubuntu 18.04
  • InteliLiving IoT Monitoring for Independent Living
  • DataVisor Enterprise ML for Fraud and AML

In this case, we use the Face API which allows us to implement Face recognition without any machine learning experience. First, you have to create a resource group for your application. So every resource used by the application will bill together. Then create a new Face resource (In AI + Machine learning category). Remember the region you selected. Then go to the resource you just created, and go to the Keys and Endpoint and copy one of the two keys.

There is a great open-source application maintained by Embercardero to show you how to use Azure Face API with your Delphi Application using REST client. It’s a Firemonkey application that can compile to Windows, Mac, iOS, and Android. You can get it from GIT hub:

https://github.com/FMXExpress/MicrosoftFacialRecognition

How To Recognize Faces With Microsoft Face Cognitive Services API

You just have to change the API Key and the URL you want to detect faces. Edit Params of “TRESTRequest” according to your params.


Easily connect to online APIs and similar resources using RAD Studio Delphi and C++ Builder. You can download a trial copy today and try face recognition out for yourself.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free TrialUpgrade Today

Free Delphi Community EditionFree C++Builder Community Edition