Things used in this project

Hardware components:
DFRobot LattePanda
Software apps and online services:
Microsoft Cognitive Services


Code ExampleC#
Don't forget to replace the API key!
using System;
using System.IO;
using System.Net.Http.Headers;
using System.Net.Http;

namespace CSHttpClientSample
    static class Program
        static void Main()
            Console.Write("Enter the location of your picture:");
            string imageFilePath = Console.ReadLine();


            Console.WriteLine("\n\n\nWait for the result below, then hit ENTER to exit...\n\n\n");

        static byte[] GetImageAsByteArray(string imageFilePath)
            FileStream fileStream = new FileStream(imageFilePath, FileMode.Open, FileAccess.Read);
            BinaryReader binaryReader = new BinaryReader(fileStream);
            return binaryReader.ReadBytes((int)fileStream.Length);

        static async void MakeAnalysisRequest(string imageFilePath)
            var client = new HttpClient();

            // Request headers - replace this example key with your valid key.
            client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "Enter your apikey here");

            // Request parameters and URI string.
            string queryString = "returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=age,gender";
            string uri = "" + queryString;

            HttpResponseMessage response;
            string responseContent;

            // Request body. Try this sample with a locally stored JPEG image.
            byte[] byteData = GetImageAsByteArray(imageFilePath);

            using (var content = new ByteArrayContent(byteData))
                // This example uses content type "application/octet-stream".
                // The other content types you can use are "application/json" and "multipart/form-data".
                content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
                response = await client.PostAsync(uri, content);
                responseContent = response.Content.ReadAsStringAsync().Result;

            //A peak at the JSON response.


13245269 10153668742428652 5499237831655557257 n
Matt Jani

tech head, tinkerer, robo-wrangler


Did you replicate this project? Share it!

Love this project? Think it could be improved? Tell us what you think!

Give feedback


Similar projects you might like

Running Native .NET Core Apps on Raspberry Pi (ARM)
  • 2,335
  • 28


Finally you can run your .NET Core apps on ARM versions of Ubuntu 16.04, 14.04 and Windows 10 IoT. We'll be making a Pi calculation app.

Windows 98 Wrist Watch
  • 3,454
  • 24

Full instructions

Everyone's favourite Operating System. On your wrist!

The Factory at Exhibition - 4.0 and beyond - [Part 1]
  • 398
  • 4

Work in progress

Control and Supervision of a true 4.0 Working Factory that will be visible in a public Exhibition using Raspberry Pi, PowerBerry, Win10Iot

Windows 10 IoT Temperature SMT172
  • 1,391
  • 6


Read temperature from sensor (SMT172) with Windows 10 IOT, Raspberry Pi and C# UWP.

PlatformIO for Visual Studio Code
  • 60
  • 0


PlatformIO is an open source ecosystem for IoT development. And now, PlatformIO for Visual Studio Code is coming!

Get Stared: Intel Edison, Azure IoT Hub and Blink App
  • 188
  • 1

Full instructions

This is a getting started guide on how to use Intel Edison to send data to Azure IoT hub, store data in Azure Storage thru Azure functions.

Add projectSign up / Login
Respect project