Using the Project Oxford Emotion API in C# and JavaScript


This article has been migrated to http://martink.me/articles/using-the-project-oxford-emotion-api

Comments (7)

Cancel reply

  1. o365spo says:

    Excellent. Martin, by chance do you have a JavaScript REST sample returning speech from a text string? Thanks JC

    1. Martin Kearn says:

      Thanks – I don’t have an example like this but a few people have asked for JS examples of the Speech API so may consider it for a future article

  2. Alejandro says:

    Thanks very much Martin:
    I have tried this, but using a canvas to send the binary data form a camera screnshot. I always get the error “{“error”:{“code”:”BadArgument”,”message”:”Invalid Media Type.”}}”

    From my canvas, I get the toDataURL: var dataCanvas=canvas.toDataURL(“image/jpg”); and send it by ajax us:

    $.ajax({
    url: “https://api.projectoxford.ai/emotion/v1.0/recognize?” + $.param(params),
    beforeSend: function(xhrObj){
    // Request headers
    xhrObj.setRequestHeader(“Content-Type”,”application/octect-stream”);
    xhrObj.setRequestHeader(“Ocp-Apim-Subscription-Key”,”MIKEY”);
    },
    type: “POST”,
    processData: false,
    data: {
    imgBase64: dataCanvas
    }

    })

    Have tried lots of options but always get the same error response. Any help?

  3. pesquera says:

    Hi Martin, I really appreciate your help.. I’m new con C# and was looking a UWP sample without much luck until now.. your sample is excellent!
    Now, I want to do some play with the Face API.. I could start with this one.. but, just to know.. do you already have done this sample with the face api? Thanks again

  4. Zic says:

    hello,
    I have read your work.
    It’s excellent .
    I Really appreciate about your help.
    Thanks a lot.
    But I am facing some problem with emotion api with video.
    I do a little bit modification on your code , in order to test emotion api with video.

    I use javascript and I only edit the api url to recognizeinvideo and my insert my own Ocp-Apim-Subscription-Key.
    var apiUrl = “https://api.projectoxford.ai/emotion/v1.0/recognize”;
    => var apiUrl = “https://api.projectoxford.ai/emotion/v1.0/recognizeinvideo”;

    But it detect nothing, and if I upload file which is not a video, it will return me error code.
    So I think I have successfully connect to the api.

    May I ask you that is there any possible problem with my code?

  5. Alan Oxford says:

    HI Martin did you ever get anywhere with JS examples of the Speech API . I could really do with some assistance.

  6. michael says:

    Very impressive.

    Can this API be used with live camera stream?

Skip to main content