public JavaScriptValue RecognizeFaces(JavaScriptValue callee, bool isConstructCall, JavaScriptValue[] arguments, ushort argumentCount, IntPtr callbackData) { if (argumentCount != 4) { return(JavaScriptValue.Invalid); } var recoID = arguments[1].ToString(); if (!faceRecognizers.ContainsKey(recoID)) { faceRecognizers[recoID] = new FaceRecognizer(); } var callback = arguments[3]; if (callback.IsUndefined()) { return(JavaScriptValue.Invalid); } var faces = arguments[2]; var faceCount = faces.Length(); if (!faceCount.HasValue) { return(JavaScriptValue.Invalid); } faceRecognizers[recoID].RecognizeFaces(faces, callback); return(JavaScriptValue.Invalid); }
public JavaScriptValue RegisterFace(JavaScriptValue callee, bool isConstructCall, JavaScriptValue[] arguments, ushort argumentCount, IntPtr callbackData) { if (argumentCount != 4) { return(JavaScriptValue.Invalid); } var recoID = arguments[1].ToString(); var imgPath = arguments[2].ToString(); var name = arguments[3].ToString(); if (!faceRecognizers.ContainsKey(recoID)) { faceRecognizers[recoID] = new FaceRecognizer(); } var imgUrl = new UriBuilder("http", Configuration.PROJECT_SERVER, Configuration.PROJECT_SERVER_PORT, imgPath).Uri; faceRecognizers[recoID].RegisterFace(imgUrl, name); return(JavaScriptValue.Invalid); }