Top 2 emotions could be blended together based on their percentages. Right now if one emotion is just slightly above the other, the color will be that emotion. There is no in-between colors for when the API is not really sure which emotion is displayed. The color displayed should be somewhere between the top two, based on the % of each.
For example, if Sadness is at 40% and Anger is at 30%, the total percent would be 70%. 40/70 = 0.57, so the colors will be 50% between sadness and anger. Sadness is [0,0,255] and anger is [255,0,0].
The difference would be calculated between the two [255, 0, -255] and the multiplier multiplied [102, 0, -102] . Then that number would be added/subtracted [102, 0, 153]. This is now 40% between Sadness and Anger.
In order to accomplish this, the RGB color values will probably need to be passed directly into the Arduino, instead of passing the emotion value between 1-7.
Top 2 emotions could be blended together based on their percentages. Right now if one emotion is just slightly above the other, the color will be that emotion. There is no in-between colors for when the API is not really sure which emotion is displayed. The color displayed should be somewhere between the top two, based on the % of each.
For example, if Sadness is at 40% and Anger is at 30%, the total percent would be 70%. 40/70 = 0.57, so the colors will be 50% between sadness and anger. Sadness is [0,0,255] and anger is [255,0,0].
The difference would be calculated between the two [255, 0, -255] and the multiplier multiplied [102, 0, -102] . Then that number would be added/subtracted [102, 0, 153]. This is now 40% between Sadness and Anger.
In order to accomplish this, the RGB color values will probably need to be passed directly into the Arduino, instead of passing the emotion value between 1-7.