How to access prediction values for different emotions?


#1

I am trying to build off the code provided for https://jsfiddle.net/affectiva/opyh5e8d/show/ by doing different things for the dominant emotion. For example, if the prediction value for joy is > 50, do something. If the prediction value for sadness > 75 do something else, etc. I am trying to do this in a function inside of my main javascript file. So far, my function looks like this:

function printToConsole(face){
if(face.emotions.joy>50){
console.log(“found joy”);
}
}
However, this is not correct and I am unsure how to correctly access the prediction values. I am getting an error that says “Uncaught TypeError: Cannot read property ‘emotions’ of undefined”.

This is my first time using Affectiva and any help would be greatly appreciated.

I’ve already familiarized myself with the code at https://github.com/Affectiva/js-sdk-sample-apps, but am still having trouble understanding how to access the prediction values. I am mostly interested in accessing the values for joy, sadness and anger.


#2

Figured it out :slightly_smiling_face:


#3

Closing this is for now.


#4