accurafaceplugin 1.0.20 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3cf1d585a9059a23d41c.mp3 +0 -0
- package/dist/7b2cb56e7e2d1cb05b60.js +1 -0
- package/{accura.xml → dist/accura.xml} +0 -0
- package/dist/accuraface1.js +1 -0
- package/dist/accuraface2.js +1 -0
- package/dist/accuramain.js +2 -0
- package/dist/accuramain.js.LICENSE.txt +1 -0
- package/dist/bf5207edb33deb842f58.xml +33314 -0
- package/{accuraface1.js → dist/d272f80c62ec7b0c0c98.js} +1 -45
- package/dist/ding.mp3 +0 -0
- package/dist/ea504920311194527a17.js +1 -0
- package/dist/piexif.js +1 -0
- package/package.json +9 -16
- package/accuraface2.js +0 -267
- package/build/accuramain.js +0 -1
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function Utils(errorOutputId){var self=this;this.errorOutput=document.getElementById(errorOutputId),this.apiKey="168508101488d7JV8yvF32yRGRti0hyatBHFwev0KInaUAgtGv";var OPENCV_URL="opencv.js";function onVideoCanPlay(){self.onCameraStartedCallback&&self.onCameraStartedCallback(self.stream,self.video)}this.loadOpenCv=function(e){var t=document.createElement("script");t.setAttribute("async",""),t.setAttribute("type","text/javascript"),t.addEventListener("load",(function(){cv.getBuildInformation?(console.log(cv.getBuildInformation()),e()):cv.onRuntimeInitialized=function(){console.log(cv.getBuildInformation()),e()}})),t.addEventListener("error",(function(){self.printError("Failed to load "+OPENCV_URL)})),t.src=OPENCV_URL;var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)},this.createFileFromUrl=function(e,t,n){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(a){if(4===i.readyState)if(200===i.status){var r=new Uint8Array(i.response);cv.FS_createDataFile("/",e,r,!0,!1,!1),n()}else self.printError("Failed to load "+t+" status: "+i.status)},i.send()},this.loadImageToCanvas=function(e,t){var n=document.getElementById(t),i=n.getContext("2d"),a=new Image;a.crossOrigin="anonymous",a.onload=function(){n.width=a.width,n.height=a.height,i.drawImage(a,0,0,a.width,a.height)},a.src=e},this.executeCode=function(textAreaId){try{this.clearError();var code=document.getElementById(textAreaId).value;eval(code)}catch(e){this.printError(e)}},this.clearError=function(){this.errorOutput.innerHTML=""},this.printError=function(e){if(void 0===e)e="";else if("number"==typeof e)isNaN(e)||"undefined"!=typeof cv&&(e="Exception: "+cv.exceptionFromPtr(e).msg);else if("string"==typeof e){var t=Number(e.split(" ")[0]);isNaN(t)||"undefined"!=typeof cv&&(e="Exception: "+cv.exceptionFromPtr(t).msg)}else e instanceof Error&&(e=e.stack.replace(/\n/g,"<br>"));this.errorOutput.innerHTML=e},this.loadCode=function(e,t){var n=document.getElementById(e),i=document.getElementById(t);if("text/code-snippet"!==n.type)throw Error("Unknown code snippet type");i.value=n.text.replace(/^\n/,"")},this.addFileInputHandler=function(e,t){document.getElementById(e).addEventListener("change",(function(e){var n=e.target.files;if(n.length>0){var i=URL.createObjectURL(n[0]);self.loadImageToCanvas(i,t)}}),!1)},this.startCamera=function(e,t,n){var i=document.getElementById(n);i||(i=document.createElement("video"));var a={qvga:{width:{exact:320},height:{exact:240}},vga:{width:{exact:640},height:{exact:480}}}[e];a||(a=!0),navigator.mediaDevices.getUserMedia({video:a,audio:!1}).then((function(e){i.srcObject=e,i.play(),self.video=i,self.stream=e,self.onCameraStartedCallback=t,i.addEventListener("canplay",onVideoCanPlay,!1)})).catch((function(e){self.printError("Camera Error: "+e.name+" "+e.message)}))},this.stopCamera=function(){this.video&&(this.video.pause(),this.video.srcObject=null,this.video.removeEventListener("canplay",onVideoCanPlay)),this.stream&&this.stream.getVideoTracks()[0].stop()},this.captureImage=function(e){return document.getElementById(e).toDataURL("image/jpeg")},this.stringFunction=function(e){console.log("Dynamic string:",e),document.getElementById("status-text").innerText=e},this.captureAndSend=function(){var e=document.getElementById("cam_input"),t=document.getElementById("canvas_output");e.style.display="none",t.style.display="block",isCanvasVisible=!0;var n=document.createElement("canvas");n.width=e.videoWidth,n.height=e.videoHeight;var i=n.getContext("2d");i.drawImage(e,0,0,n.width,n.height),i.save(),i.beginPath(),i.moveTo(n.width/2,0),i.bezierCurveTo(n.width,0,n.width,n.height,n.width/2,n.height),i.bezierCurveTo(0,n.height,0,0,n.width/2,0),i.clip(),i.drawImage(n,0,0),i.restore();n.toDataURL("image/jpeg")}}
|
|
File without changes
|