I'm trying to implement the use of haarcascade_frontalface_alt.xml for facial recognition via OpenCV.js. However, when I'm trying to use the detectMultiScale() method of the CascadeClassifier object it expects to have an argument of the type of RectVector, but I am unable to find a way to instantiate such an object.
Here is the code I have so far:
var face_cascade = new cv.CascadeClassifier();
face_cascade.load("haarcascade_frontalface_alt.xml");
function face_detector() {
var imgElement = document.getElementById("test");
var img = cv.imread(imgElement);
cv.cvtColor(img, img, cv.COLOR_BGR2GRAY);
face_cascade.detectMultiScale(img, faces); //faces needs to be an obj of RectVector type
//window.alert(faces.length);
}
In my code, I need faces to be an object of type RectVector but I don't know how. Any pointers will help.