Open Bioswami-nfac opened 4 years ago
In case anyone else is facing the issue, here is what I did. I used the lower level functions to draw the box and the expressions.
for (var i = 0; i < resizedDetections.length; i++){
var thisRect = resizedDetections[i].detection.box;
//faceRects.push(resizedDetections[i].detection);
var thisBox = {bottom: thisRect.bottom, left: thisRect.left, top: thisRect.top, right: thisRect.right};
var thisFaceExpressions = resizedDetections[i].expressions;
const maxValue = Math.max(...Object.values(thisFaceExpressions));
const emotion = Object.keys(thisFaceExpressions).filter(
item => thisFaceExpressions[item] === maxValue
);
emotionText = emotion.toString();
if(emotionIndex == 0 || emotionIndex == 1){
color = RED;
}else if (emotionIndex == 2 || emotionIndex == 4 ){
color = ORANGE;
}else if (emotionIndex == 3){
color = DARK_GREEN;
}else if(emotionIndex == 5){
color = LIGHT_GREEN;
}else{
color = YELLOW;
}
var thisBoxOptions = ({boxColor: color, label: emotionText});
var thisDrawBox = new faceapi.draw.DrawBox(thisBox,thisBoxOptions)
thisDrawBox.draw(canvas);
}
I think you used outdated documentation, most recent one for me was here https://github.com/justadudewhohacks/face-api.js/blob/master/README.md
Hi,
I am getting this error when I am trying to create a new Box with custom text.
I am using the usual code for creating the box with text:
I get the following error:
renderer.js:215 Uncaught (in promise) TypeError: faceapi.BoxWithText is not a constructor
Can you point me to any reason for this?
Regards, Arun