peterbraden / node-opencv

OpenCV Bindings for node.js
MIT License
4.37k stars 858 forks source link

FaceRecognizer predictSync to return array of closest matching faces #458

Open enijar opened 7 years ago

enijar commented 7 years ago

This is a "Help wanted" issue.

Is there a method on the FaceRecognizer.{algorithm} object to return an array of objects where I can then order them by confidence (lowest to highest).

I'm using predictSync to get the closest matching image in the trained data set; this is working great.

// Run image over trained data.
var faceRecognition = cv.FaceRecognizer.createEigenFaceRecognizer();
faceRecognition.loadSync(path.join(__dirname, 'data/ORL'));

// Get the best prediction.
var whoIsIt = faceRecognition.predictSync(image);
console.log('Identified image', whoIsIt);
0-ali commented 7 years ago

You need this https://www.npmjs.com/package/array-sort

enijar commented 7 years ago

@xc0d3rz I don't need to sort an array. The predictSync method only returns one item, not an array.

kpkpt commented 7 years ago

OpenCV Error: Unspecified error (This Eigenfaces model is not computed yet. Did you call Eigenfaces::train?) in cv::Eigenfaces::predict, file C:\builds\2_4_PackSlave-win64-vc12-shared\opencv\modules\contrib\src\facerec.cpp, line 485 what is going on with "var faceRecognition = cv.FaceRecognizer.createEigenFaceRecognizer(); var whoIsIt = faceRecognition.predictSync(im);" cv.FaceRecognizer or cv.FaceRecognizer.createEagen...... is not working in opencv 2.4.13???? or i am facing another issue??? mean to say liberary configuration???

enijar commented 7 years ago

@kpkpt I already did the training. I didn't include the training code in the issue since it wasn't relevant. data/ORL is the training file.

Everything works perfectly, I just need the returned data to me an array of all images with their matching percentages next to each. Hope this makes sense.

enijar commented 7 years ago

Any news on getting this to return a confidence rating for all images?