From 4dcb8ef38f95edc52e51a14764e67fe48f093b50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Audun=20Mathias=20=C3=98ygard?= Date: Fri, 12 May 2017 21:53:37 +0200 Subject: [PATCH] terminate workers after face is detected --- clmtrackr.js | 1 + clmtrackr.min.js | 2 +- js/jsfeat_detect.js | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/clmtrackr.js b/clmtrackr.js index 38582019..65e944a1 100644 --- a/clmtrackr.js +++ b/clmtrackr.js @@ -3432,6 +3432,7 @@ var jsfeat_face = function(video, maxWorkSize, useWebWorkers) { worker.addEventListener('message', function (e) { this.faceDetected(e, callback); + worker.terminate(); }.bind(this), false); worker.postMessage({ diff --git a/clmtrackr.min.js b/clmtrackr.min.js index b3fc73b6..3f604cc8 100644 --- a/clmtrackr.min.js +++ b/clmtrackr.min.js @@ -1,6 +1,6 @@ "use strict";function mosseFilter(a){var b,c,d,e,f,g,h,i,j,k;this.psr_prev=void 0,this.peak_prev=void 0;var l=!1;if(a||(a={}),void 0===a.drawResponse)a.drawResponse=!1;else if("CANVAS"!=a.drawResponse.tagName)a.drawResponse=!1;else var m=a.drawResponse.getContext("2d");void 0===a.psrThreshold&&(a.psrThreshold=10),void 0===a.eta&&(a.eta=.1),void 0===a.convertToGrayscale&&(a.convertToGrayscale=!0),this.load=function(a){f=a.width,g=a.height,i=f*g,b=[a.real,a.imag],a.top&&a.bottom&&(l=!0,c=[a.top.real,a.top.imag],d=[a.bottom.real,a.bottom.imag]),e=new FFT,e.init(a.width),"undefined"!=typeof Float64Array?(h=new Float64Array(i),k=new Float64Array(i)):(h=new Array(i),k=new Array(i));var m=document.createElement("canvas");m.setAttribute("width",f),m.setAttribute("height",g),j=m.getContext("2d")},this.init=function(a,k){f=a,g=k,i=f*g,b=[[],[]],c=[[],[]],d=[[],[]];for(var m=0;i>m;m++)b[0][m]=0,b[1][m]=0,c[0][m]=0,c[1][m]=0,d[0][m]=0,d[1][m]=0;l=!0,e=new FFT,e.init(a),h="undefined"!=typeof Float64Array?new Float64Array(i):new Array(i);var n=document.createElement("canvas");n.setAttribute("width",f),n.setAttribute("height",g),j=n.getContext("2d")},this.fft=function(a){for(var b=new Array(i),c=0;i>c;c++)b[c]=0;return e.fft2d(a,b),[a,b]},this.fft_inplace=function(a){for(var b=0;i>b;b++)h[b]=0;return e.fft2d(a,h),[a,h]},this.ifft=function(a,b){return e.ifft2d(a,b),a},this.psr=function(a){for(var b,c=0,d=0,e=[],h=0,i=0;f>i;i++)for(var j=0;g>j;j++)b=a[j*f+i],c+=b,h+=b*b,b>d&&(d=b,e=[i,j]);for(var i=-5;6>i;i++)for(var j=-5;6>j;j++)Math.sqrt(i*i+j*j)<5&&(b=a[(e[1]+j)*f+(e[0]+i)],h-=b*b,c-=b);var k=c/a.length,l=Math.sqrt(h/a.length-k*k),m=(d-k)/l;return m},this.getResponse=function(a){var c=n(a);c=o(c);var d=this.fft_inplace(c);q(d,b);var e=this.ifft(d[0],d[1]);return e},this.track=function(e,h,q,t,u,v,w,x){if(!b)return!1;if("VIDEO"==e.tagName||"IMG"==e.tagName){var y=Math.round(h/e.width*e.videoWidth),z=Math.round(q/e.height*e.videoHeight),A=Math.round(t/e.width*e.videoWidth),B=Math.round(u/e.height*e.videoHeight);j.drawImage(e,y,z,A,B,0,0,f,g)}else"CANVAS"==e.tagName&&j.drawImage(e,h,q,t,u,0,0,f,g);var C=j.getImageData(0,0,f,g),D=C.data;if(a.convertToGrayscale)for(var E=0;i>E;E++)k[E]=.3*D[4*E],k[E]+=.59*D[4*E+1],k[E]+=.11*D[4*E+2];else for(var E=0;i>E;E++)k[E]=D[4*E];var F=n(k);F=o(F);var G=this.fft_inplace(F),H=p(G,b),I=this.ifft(H[0],H[1]),J=0,K=0,L=[];if(w)for(var M,N,O,P=128,Q=0;f>Q;Q++)for(var R=0;g>R;R++)N=Q-f/2,O=R-g/2,M=Math.exp(-.5*(N*N+O*O)/P),I[R*f+Q]*M>J&&(J=I[R*f+Q]*M,L=[Q,R]),I[R*f+Q]Q;Q++)for(var R=0;g>R;R++)I[R*f+Q]>J&&(J=I[R*f+Q],L=[Q,R]),I[R*f+Q]X;X++){var Y=I[X];Y=Math.round((Y+Math.abs(K))*(255/S)),W[4*X]=Y,W[4*X+1]=Y,W[4*X+2]=Y,W[4*X+3]=255}U.putImageData(V,0,0),m.drawImage(T,h,q,t,t)}if(x&&(this.psr_prev=this.psr(I)),v)if(l){if(x)var Z=this.psr_prev;else var Z=this.psr(I);if(Z>a.psrThreshold){for(var $=[],_=L[0],aa=L[1],Q=0;f>Q;Q++)for(var R=0;g>R;R++)$[R*f+Q]=Math.exp(-((Q-_)*(Q-_)+(R-aa)*(R-aa))/4);$=this.fft($);for(var ba=r(G),ca=p($,ba),da=p(G,ba),ea=a.eta,E=0;i>E;E++)c[0][E]=ea*ca[0][E]+(1-ea)*c[0][E],c[1][E]=ea*ca[1][E]+(1-ea)*c[1][E],d[0][E]=ea*da[0][E]+(1-ea)*d[0][E],d[1][E]=ea*da[1][E]+(1-ea)*d[1][E];b=s(c,d)}}else;return L[0]=L[0]*(t/f),L[1]=L[1]*(t/g),0>J?!1:L},this.train=function(e,h,m,q,t){if(!l)return!1;if("VIDEO"==e.tagName||"IMG"==e.tagName){var u=Math.round(h/e.width*e.videoWidth),v=Math.round(m/e.height*e.videoHeight),w=Math.round(q/e.width*e.videoWidth),x=Math.round(t/e.height*e.videoHeight);j.drawImage(e,u,v,w,x,0,0,f,g)}else"CANVAS"==e.tagName&&j.drawImage(e,h,m,q,t,0,0,f,g);for(var y=j.getImageData(0,0,f,g),z=y.data,A=0;i>A;A++)k[A]=.3*z[4*A],k[A]+=.59*z[4*A+1],k[A]+=.11*z[4*A+2];var B=n(k);B=o(B);for(var C=[],D=f/2,E=g/2,F=0;f>F;F++)for(var G=0;g>G;G++)C[G*f+F]=Math.exp(-((F-D)*(F-D)+(G-E)*(G-E))/4);C=this.fft(C);for(var H=this.fft(B),I=r(H),J=p(C,I),K=p(H,I),L=a.eta,A=0;i>A;A++)c[0][A]=L*J[0][A]+(1-L)*c[0][A],c[1][A]=L*J[1][A]+(1-L)*c[1][A],d[0][A]=L*K[0][A]+(1-L)*d[0][A],d[1][A]=L*K[1][A]+(1-L)*d[1][A];return b=s(c,d),!0};var n=function(a){for(var b=0;i>b;b++)a[b]=Math.log(a[b]+1);for(var c=0,b=0;i>b;b++)c+=a[b];c/=i;for(var b=0;i>b;b++)a[b]-=c;for(var d=0,b=0;i>b;b++)d+=a[b]*a[b];d=Math.sqrt(d);for(var b=0;i>b;b++)a[b]/=d;return a},o=function(a){for(var b=0,c=0;f>c;c++)for(var d=0;g>d;d++){var e=Math.sin(Math.PI*c/(f-1)),h=Math.sin(Math.PI*d/(g-1));a[b]=Math.min(e,h)*a[b],b++}return a},p=function(a,b){for(var c=new Array(f),d=new Array(f),e=[c,d],g=0;i>g;g++)e[0][g]=a[0][g]*b[0][g]-a[1][g]*b[1][g],e[1][g]=a[0][g]*b[1][g]+a[1][g]*b[0][g];return e},q=function(a,b){for(var c,d,e=0;i>e;e++)c=a[0][e]*b[0][e]-a[1][e]*b[1][e],d=a[0][e]*b[1][e]+a[1][e]*b[0][e],a[0][e]=c,a[1][e]=d},r=function(a){for(var b=[[],[]],c=0;i>c;c++)b[0][c]=a[0][c],b[1][c]=-a[1][c];return b},s=function(a,b){for(var c=[[],[]],d=0;i>d;d++)c[0][d]=(a[0][d]*b[0][d]+a[1][d]*b[1][d])/(b[0][d]*b[0][d]+b[1][d]*b[1][d]),c[1][d]=(a[1][d]*b[0][d]-a[0][d]*b[1][d])/(b[0][d]*b[0][d]+b[1][d]*b[1][d]);return c}}function FFT(){function a(a,b,c){for(var d,e,f,j,k,l,m,n,o,p=g>>2,q=0;g>q;q++)j=h[q],j>q&&(k=a[q],a[q]=a[j],a[j]=k,k=b[q],b[q]=b[j],b[j]=k);for(var r=1;g>r;r<<=1){e=0,d=g/(r<<1);for(var s=0;r>s;s++){l=i[e+p],m=c*i[e];for(var t=s;g>t;t+=r<<1)f=t+r,n=l*a[f]+m*b[f],o=l*b[f]-m*a[f],a[f]=a[t]-n,a[t]+=n,b[f]=b[t]-o,b[t]+=o;e+=d}}}function b(){h="undefined"!=typeof Uint8Array?new Uint8Array(g):new Array(g),"undefined"!=typeof Float64Array?(i=new Float64Array(1.25*g),e=new Float64Array(g*g),f=new Float64Array(g*g)):(i=new Array(1.25*g),e=new Array(g*g),f=new Array(g*g))}function c(){var a=0,b=0,c=0;for(h[0]=0;++a>1;b>=c;)b-=c,c>>=1;b+=c,h[a]=b}}function d(){var a=g>>1,b=g>>2,c=g>>3,d=a+b,e=Math.sin(Math.PI/g),f=2*e*e,h=Math.sqrt(f*(2-f)),j=i[b]=1,k=i[0]=0;e=2*f;for(var l=1;c>l;l++)j-=f,f+=e*j,k+=h,h-=e*k,i[l]=k,i[b-l]=j;0!==c&&(i[c]=Math.sqrt(.5));for(var m=0;b>m;m++)i[a-m]=i[m];for(var n=0;d>n;n++)i[n+a]=-i[n]}var e,f,g=0,h=null,i=null;this.init=function(a){if(0===a||0!==(a&a-1))throw new Error("init: radix-2 required");g=a,b(),c(),d()},this.fft1d=function(b,c){a(b,c,1)},this.ifft1d=function(b,c){var d=1/g;a(b,c,-1);for(var e=0;g>e;e++)b[e]*=d,c[e]*=d},this.fft2d=function(a,b){for(var c=0,d=0;g>d;d++){c=d*g;for(var h=0;g>h;h++)e[h]=a[h+c],f[h]=b[h+c];this.fft1d(e,f);for(var i=0;g>i;i++)a[i+c]=e[i],b[i+c]=f[i]}for(var j=0;g>j;j++){for(var k=0;g>k;k++)c=j+k*g,e[k]=a[c],f[k]=b[c];this.fft1d(e,f);for(var l=0;g>l;l++)c=j+l*g,a[c]=e[l],b[c]=f[l]}},this.ifft2d=function(a,b){for(var c=0,d=0;g>d;d++){c=d*g;for(var h=0;g>h;h++)e[h]=a[h+c],f[h]=b[h+c];this.ifft1d(e,f);for(var i=0;g>i;i++)a[i+c]=e[i],b[i+c]=f[i]}for(var j=0;g>j;j++){for(var k=0;g>k;k++)c=j+k*g,e[k]=a[c],f[k]=b[c];this.ifft1d(e,f);for(var l=0;g>l;l++)c=j+l*g,a[c]=e[l],b[c]=f[l]}}}var clm={tracker:function(a){function b(a,b,c){var d,e,g,h,i;d=2*b,e=H[d/2][0],g=H[d/2][1];for(var j=0;f>j;j++)e+=q.shapeModel.eigenVectors[d][j]*c[j+4],g+=q.shapeModel.eigenVectors[d+1][j]*c[j+4];h=c[0]*e-c[1]*g+c[2],i=c[0]*g+c[1]*e+c[3],e+=h,g+=i,a.beginPath(),a.arc(e,g,1,0,2*Math.PI,!0),a.closePath(),a.fill()}function c(a,b){for(var c=[],d=[],e=0;ec;c++)for(var o=0;f>o;o++)i[c][o]=q.shapeModel.eigenVectors[c][o];for(var c=0;d>c;c++)H[c]=[q.shapeModel.meanShape[c][0],q.shapeModel.meanShape[c][1]];ba=ca=0,_=aa=1e6;for(var c=0;d>c;c++)H[c][0]<_&&(_=H[c][0]),H[c][1]ba&&(ba=H[c][0]),H[c][1]>ca&&(ca=H[c][1]);da=ba-_,ea=ca-aa,q.scoring&&(fa=new Float64Array(q.scoring.coef),ga=q.scoring.bias,pa.width=q.scoring.size[0],pa.height=q.scoring.size[1]),j=q.shapeModel.eigenValues,p=q.patchModel.weights,r=q.patchModel.bias,h=numeric.rep([f+4,f+4],0);for(var c=0;f>c;c++)h[c+4][c+4]=q.shapeModel.nonRegularizedVectors.indexOf(c)>=0?1e-7:1/j[c];for(var c=0;f+4>c;c++)B[c]=0;if("SVM"==g){var s,C=document.createElement("canvas");if(window.WebGLRenderingContext&&(s=C.getContext("webgl")||C.getContext("experimental-webgl"),s&&s.getExtension("OES_texture_float")||(s=null)),s&&a.useWebGL&&"undefined"!=typeof webglFilter){X=new webglFilter;try{X.init(p,r,d,t+e-1,t+e-1,e,e),"lbp"in p&&(A=!0),"sobel"in p&&(z=!0)}catch(D){alert("There was a problem setting up webGL programs, falling back to slightly slower javascript version. :("),X=void 0,Y=new svmFilter,Y.init(p.raw,r.raw,d,e,t)}}else{if("undefined"==typeof svmFilter)throw"Could not initiate filters, please make sure that svmfilter.js or svmfilter_conv_js.js is loaded.";Y=new svmFilter,Y.init(p.raw,r.raw,d,e,t)}}else"MOSSE"==g&&(Z=new mosseFilterResponses,Z.init(p,d,e,e));if(U=V="SVM"==g?e+t-1:t,W=U*V,w=(t-1)/2,y=t*t,"undefined"!=typeof Float64Array){x=new Float64Array(y);for(var c=0;d>c;c++)F[c]=new Float64Array(W)}else{x=new Array(y);for(var c=0;d>c;c++)F[c]=new Array(W)}for(var c=0;d>c;c++)Q[c]=1,R[c]=0;if(a.weightPoints){na=[];for(var c=0;d>c;c++)c in a.weightPoints?(na[2*c]=a.weightPoints[c],na[2*c+1]=a.weightPoints[c]):(na[2*c]=1,na[2*c+1]=1);na=numeric.diag(na)}},this.start=function(b,c){return"undefined"==typeof q?!1:("undefined"==typeof la&&(la=b,ma=c),$=new jsfeat_face(b,a.faceDetection.workSize,a.useWebWorkers),void(ka=Ja(ya)))},this.stop=function(){Ka(ka)};var xa=function(a,b,c){s=c,this.track(a,b)};this.track=function(b,c){var e=document.createEvent("Event");e.initEvent("clmtrackrBeforeTrack",!0,!0),document.dispatchEvent(e);var n,o,p,q,r,u,v;if(N){if(a.useWebWorkers){if(!O)return O=!0,void Ha(b,c,xa.bind(this));if(void 0===s)return;O=!1}else s=Ha(b,c);if(!s){var e=document.createEvent("Event");return e.initEvent("clmtrackrNotFound",!0,!0),document.dispatchEvent(e),s=void 0,!1}n=s[0],q=s[1],o=s[2],p=s[3],s=void 0,N=!1}else{if(oa+=1,a.constantVelocity&&D.length>=2)for(var w=0;wwa&&(q-=Math.PI),n=B[1]/Math.sin(q),o=B[2],p=B[3]}k.save(),k.clearRect(0,0,l,m),k.scale(1/n,1/n),k.rotate(-q),k.translate(-o,-p),k.drawImage(b,0,0,b.width,b.height),k.restore();var y=Ca(B,!1);if(fa&&oa%10==0&&!Ga()){N=!0,ra=[];for(var w=0;ww;w++){u=y[w][0]-U/2,v=y[w][1]-V/2,r=k.getImageData(Math.round(u),Math.round(v),U,V),z=r.data,A=F[w];for(var I=0;W>I;I++)H=.3*z[4*I]+.59*z[4*I+1]+.11*z[4*I+2],A[I]=H}if("SVM"==g)if("undefined"!=typeof X)G=Aa(F);else{if("undefined"==typeof Y)throw"SVM-filters do not seem to be initiated properly.";G=Y.getResponses(F)}else"MOSSE"==g&&(G=Z.getResponses(F));if(a.sharpenResponse)for(var w=0;d>w;w++)for(var I=0;II;I++){R=K[I][0]-(t-1)*n/2,$=K[I][1]-(t-1)*n/2;var _=Ea(t,C[I],S,x,G,R,$,I,L[w],n);Fa(t,T,S,x,_,R,$,n),Q[I]=[T[0]-C[I][0],T[1]-C[I][1]]}for(var aa=numeric.rep([2*d,1],0),ba=0;d>ba;ba++)aa[2*ba][0]=Q[ba][0],aa[2*ba+1][0]=Q[ba][1];var ca=numeric.mul(h,L[w]);if(a.weightPoints)var da=numeric.dot(numeric.transpose(J),numeric.dot(na,J));else var da=numeric.dot(numeric.transpose(J),J);for(var ea=numeric.rep([f+4,1],0),ga=0;f+4>ga;ga++)ea[ga][0]=B[ga];var ha=numeric.dot(ca,ea);if(a.weightPoints)var ia=numeric.dot(numeric.transpose(J),numeric.dot(na,aa));else var ia=numeric.dot(numeric.transpose(J),aa);for(var ja=numeric.add(ca,da),ka=numeric.sub(ha,ia),la=numeric.dot(numeric.inv(ja),ka),ma=C,ba=0;f+4>ba;ba++)B[ba]-=la[ba];for(var pa,ba=0;f>ba;ba++)pa=Math.abs(3*Math.sqrt(j[ba])),Math.abs(B[ba+4])>pa&&(B[ba+4]=B[ba+4]>0?pa:-pa);C=Ca(B,!0);for(var qa,sa,ta=0,ba=0;bata)break}a.constantVelocity&&(D.push(B.slice()),D.splice(0,3==D.length?1:0)),E.splice(0,10==E.length?1:0),E.push(C.slice(0));var e=document.createEvent("Event");if(e.initEvent("clmtrackrIteration",!0,!0),document.dispatchEvent(e),this.getConvergence()<.5&&ra.length>=5){a.stopOnConvergence&&this.stop();var e=document.createEvent("Event");e.initEvent("clmtrackrConverged",!0,!0),document.dispatchEvent(e)}return C},this.reset=function(){N=!0,ra=[];for(var a=0;af;f++)for(var g=0;d>g;g++)a+=E[f][g][0],b+=E[f][g][1];a/=5,b/=5;for(var f=5;10>f;f++)for(var g=0;d>g;g++)c+=E[f][g][0],e+=E[f][g][1];c/=5,e/=5;var h=c-a,i=e-b,j=h*h+i*i;return j/=E.length},this.setResponseMode=function(a,b){if("undefined"!=typeof q&&"undefined"!=typeof X&&!(["single","blend","cycle"].indexOf(a)<0)&&b instanceof Array){for(var c=0;c=J.length&&(K=0),b}for(var c=[],e=0;ee;e++){for(var b=Array(t*t),g=0;t*t>g;g++)b[g]=0;for(var h=0;hg;g++)b[g]+=c[h][e][g]/J.length;f[e]=b}return f},Ba=function(a,b){for(var c,e,g=numeric.rep([2*d,f+4],0),h=0;d>h;h++){c=H[h][0],e=H[h][1];for(var i=0;f>i;i++)c+=a[i+4]*b[2*h][i],e+=a[i+4]*b[2*h+1][i];g[2*h][0]=c,g[2*h+1][0]=e,c=H[h][1],e=H[h][0];for(var i=0;f>i;i++)c+=a[i+4]*b[2*h+1][i],e+=a[i+4]*b[2*h][i];g[2*h][1]=-c,g[2*h+1][1]=e,g[2*h][2]=1,g[2*h+1][2]=0,g[2*h][3]=0,g[2*h+1][3]=1;for(var j=0;f>j;j++)c=a[0]*b[2*h][j]-a[1]*b[2*h+1][j]+b[2*h][j],e=a[0]*b[2*h+1][j]+a[1]*b[2*h][j]+b[2*h+1][j],g[2*h][j+4]=c,g[2*h+1][j+4]=e}return g},Ca=function(a,b){for(var c,e,f,g,h=a.length,i=[],j=0;d>j;j++){c=H[j][0],e=H[j][1];for(var k=0;h-4>k;k++)c+=q.shapeModel.eigenVectors[2*j][k]*a[k+4],e+=q.shapeModel.eigenVectors[2*j+1][k]*a[k+4];b&&(f=a[0]*c-a[1]*e+a[2],g=a[0]*e+a[1]*c+a[3],c+=f,e+=g),i[j]=[c,e]}return i},Da=function(b,c){if(!c)return o=$.findFace(a),o?o:!1;$.faceDetected=function(a,b){return(o=a.data.comp)?void b(o):(b(!1),!1)};$.findFace(a,c)},Ea=function(a,b,c,d,e,f,g,h,i,j){for(var k,l,m=0,n=0,o=0;a>o;o++){c[1]=g+o*j;for(var p=0;a>p;p++)c[0]=f+p*j,k=b[0]-c[0],l=b[1]-c[1],d[m]=e[h][m]*Math.exp(-.5*(k*k+l*l)/(i*j)),n+=d[m],m++}return n},Fa=function(a,b,c,d,e,f,g,h){var i=0,j=0;b[0]=0,b[1]=0;for(var k=0;a>k;k++){c[1]=g+k*h;for(var l=0;a>l;l++)c[0]=f+l*h,j=d[i]/e,b[0]+=j*c[0],b[1]+=j*c[1],i++}},Ga=function(){qa.drawImage(n,Math.round(_+da/4.5),Math.round(aa-ea/12),Math.round(da-2*da/4.5),Math.round(ea-ea/12),0,0,20,22);for(var b=qa.getImageData(0,0,20,22),c=new Array(440),d=b.data,e=0,f=0;440>f;f++)c[f]=.3*d[4*f]+.59*d[4*f+1]+.11*d[4*f+2],c[f]=Math.log(c[f]+1),c[f]>e&&(e=c[f]);if(e>0){for(var g=0,f=0;440>f;f++)g+=c[f];g/=440;for(var h=0,f=0;440>f;f++)h+=(c[f]-g)*(c[f]-g);h/=439,h=Math.sqrt(h);for(var i=0,f=0;440>f;f++)c[f]=(c[f]-g)/h,i+=c[f]*fa[f];if(i+=ga,i=1/(1+Math.exp(-i)),ra.splice(0,5==ra.length?1:0),ra.push(i),ra.length>4){sa=0;for(var f=0;5>f;f++)sa+=ra[f];if(sa/=5,sak;k++)e+=q.shapeModel.eigenVectors[d][k]*c[k+4],g+=q.shapeModel.eigenVectors[d+1][k]*c[k+4];h=c[0]*e-c[1]*g+c[2],i=c[0]*g+c[1]*e+c[3],e+=h,g+=i,0==d?a.moveTo(e,g):a.lineTo(e,g)}a.moveTo(0,0),a.closePath(),a.stroke()},Ja=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){return window.setTimeout(a,1e3/60)}}(),Ka=function(){return window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||window.clearTimeout}();return!0}},webglFilter=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W=!1,X=!1,Y=!1,Z=["attribute vec2 a_texCoord;","attribute vec2 a_position;","","varying vec2 v_texCoord;","","void main() {"," // transform coordinates to regular coordinates"," gl_Position = vec4(a_position,0.0,1.0);"," "," // pass the texCoord to the fragment shader"," v_texCoord = a_texCoord;","}"].join("\n"),$=["attribute vec2 a_texCoord;","attribute vec2 a_position;","","varying vec2 v_texCoord;","","void main() {"," // transform coordinates to regular coordinates"," gl_Position = vec4(a_position,0.0,1.0);"," "," // pass the texCoord to the fragment shader"," v_texCoord = a_texCoord;","}"].join("\n"),_=["attribute vec2 a_texCoord_draw;","attribute vec2 a_position_draw;","attribute float a_patchChoice_draw;","","uniform vec2 u_resolutiondraw;","","varying vec2 v_texCoord;","varying float v_select;","","void main() {"," // convert the rectangle from pixels to 0.0 to 1.0"," vec2 zeroToOne = a_position_draw / u_resolutiondraw;",""," // convert from 0->1 to 0->2"," vec2 zeroToTwo = zeroToOne * 2.0;",""," // convert from 0->2 to -1->+1 (clipspace)"," vec2 clipSpace = zeroToTwo - 1.0;"," "," // transform coordinates to regular coordinates"," gl_Position = vec4(clipSpace * vec2(1.0, 1.0), 0, 1);",""," // pass the texCoord to the fragment shader"," v_texCoord = a_texCoord_draw;"," "," v_select = a_patchChoice_draw;","}"].join("\n"),aa=["precision mediump float;","","// our responses","uniform sampler2D u_responses;","","// the texCoords passed in from the vertex shader.","varying vec2 v_texCoord;","varying float v_select;","","const vec4 bit_shift = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);","const vec4 bit_mask = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);","","// packing code from here http://stackoverflow.com/questions/9882716/packing-float-into-vec4-how-does-this-code-work","void main() {"," vec4 colorSum = texture2D(u_responses, v_texCoord);"," float value = 0.0;"," if (v_select < 0.1) {"," value = colorSum[0];"," } else if (v_select > 0.9 && v_select < 1.1) {"," value = colorSum[1];"," } else if (v_select > 1.9 && v_select < 2.1) {"," value = colorSum[2];"," } else if (v_select > 2.9 && v_select < 3.1) {"," value = colorSum[3];"," } else {"," value = 1.0;"," }"," "," vec4 res = fract(value * bit_shift);"," res -= res.xxyz * bit_mask;"," "," //gl_FragColor = vec4(value, value, value, value);"," //gl_FragColor = vec4(1.0, value, 1.0, 1.0);"," gl_FragColor = res;","}"].join("\n");this.init=function(ba,da,ea,fa,ga,ha,ia){if(ha!=ia)return void alert("filter width and height must be same size!");if(ha%2==0||ia%2==0)return void alert("filters used in svm must be of odd dimensions!");G=da,c=ha,d=ia,e=fa,f=ga,g=ea,m=Math.floor(g/4)+Math.ceil(g%4/4),h=e,i=f*m,v=e-c+1,w=f-c+1,x=w*g,B=Math.floor(g/4)+Math.ceil(g%4/4),C=e,D=f*B,E=e*f,F=new Float32Array(E*B*4);var ja=[1/e,1/(f*m)];if(V=["precision mediump float;","","const vec2 u_onePixelPatches = vec2("+(1/e).toFixed(10)+","+(1/(f*m)).toFixed(10)+");","const vec2 u_onePixelFilters = vec2("+(1/c).toFixed(10)+","+(1/(d*m)).toFixed(10)+");","const float u_halffilterwidth = "+((c-1)/2).toFixed(1)+";","const float u_halffilterheight = "+((d-1)/2).toFixed(1)+";","","// our patches","uniform sampler2D u_patches;","// our filters","uniform sampler2D u_filters;","","// the texCoords passed in from the vertex shader.","varying vec2 v_texCoord;","varying vec2 v_texCoordFilters; // this should give us correct filter","","void main() {"," vec4 colorSum = vec4(0.0, 0.0, 0.0, 0.0);"," vec4 maxn = vec4(0.0, 0.0, 0.0, 0.0);"," vec4 minn = vec4(256.0, 256.0, 256.0, 256.0);"," vec4 scale = vec4(0.0, 0.0, 0.0, 0.0);"," vec4 patchValue = vec4(0.0, 0.0, 0.0, 0.0);"," vec4 filterValue = vec4(0.0, 0.0, 0.0, 0.0);"," vec4 filterTemp = vec4(0.0, 0.0, 0.0, 0.0);"," for (int w = 0;w < "+c+";w++) {"," for (int h = 0;h < "+d+";h++) {"," patchValue = texture2D(u_patches, v_texCoord + u_onePixelPatches * vec2(float(w)-u_halffilterwidth, float(h)-u_halffilterheight));"," filterValue = texture2D(u_filters, v_texCoordFilters + u_onePixelFilters * vec2(float(w)-u_halffilterwidth, float(h)-u_halffilterheight));"," maxn = max(patchValue, maxn);"," minn = min(patchValue, minn);"," colorSum += patchValue*filterValue;"," filterTemp += filterValue;"," } "," }"," scale = maxn-minn;"," colorSum = (colorSum-(minn*filterTemp))/scale;"," // logistic transformation"," colorSum = 1.0/(1.0 + exp(- (colorSum) ));"," gl_FragColor = colorSum;","}"].join("\n"),U=["attribute vec2 a_texCoord;","attribute vec2 a_position;","","const vec2 u_resolution = vec2("+h.toFixed(1)+","+i.toFixed(1)+");","const float u_patchHeight = "+(1/m).toFixed(10)+";","const float u_filterHeight = "+(1/m).toFixed(10)+";","const vec2 u_midpoint = vec2(0.5 ,"+(1/(2*m)).toFixed(10)+");","","varying vec2 v_texCoord;","varying vec2 v_texCoordFilters;","","void main() {"," // convert the rectangle from pixels to 0.0 to 1.0"," vec2 zeroToOne = a_position / u_resolution;",""," // convert from 0->1 to 0->2"," vec2 zeroToTwo = zeroToOne * 2.0;",""," // convert from 0->2 to -1->+1 (clipspace)"," vec2 clipSpace = zeroToTwo - 1.0;"," "," // transform coordinates to regular coordinates"," gl_Position = vec4(clipSpace * vec2(1.0, 1.0), 0, 1);"," "," // pass the texCoord to the fragment shader"," v_texCoord = a_texCoord;"," "," // set the filtertexture coordinate based on number filter to use"," v_texCoordFilters = u_midpoint + vec2(0.0, u_filterHeight * floor(a_texCoord[1]/u_patchHeight));","}"].join("\n"),"lbp"in ba&&(S=["precision mediump float;","","uniform vec2 u_onePixelPatches;","","// our patches","uniform sampler2D u_patches;","","// the texCoords passed in from the vertex shader.","varying vec2 v_texCoord;","","void main() {"," vec4 topLeft = texture2D(u_patches, v_texCoord + vec2(-"+ja[0].toFixed(5)+", -"+ja[1].toFixed(5)+"));"," vec4 topMid = texture2D(u_patches, v_texCoord + vec2(0.0, -"+ja[1].toFixed(5)+"));"," vec4 topRight = texture2D(u_patches, v_texCoord + vec2("+ja[0].toFixed(5)+", -"+ja[1].toFixed(5)+"));"," vec4 midLeft = texture2D(u_patches, v_texCoord + vec2(-"+ja[0].toFixed(5)+", 0.0));"," vec4 midMid = texture2D(u_patches, v_texCoord);"," vec4 midRight = texture2D(u_patches, v_texCoord + vec2("+ja[0].toFixed(5)+", 0.0));"," vec4 bottomLeft = texture2D(u_patches, v_texCoord + vec2(-"+ja[0].toFixed(5)+", "+ja[1].toFixed(5)+"));"," vec4 bottomMid = texture2D(u_patches, v_texCoord + vec2(0.0, "+ja[1].toFixed(5)+"));"," vec4 bottomRight = texture2D(u_patches, v_texCoord + vec2("+ja[0].toFixed(5)+", "+ja[1].toFixed(5)+"));"," vec4 lbp = step(midMid, midRight)*1.0 + step(midMid, topRight)*2.0 + step(midMid, topMid)*4.0;"," lbp = lbp + step(midMid, topLeft)*8.0 + step(midMid, midLeft)*16.0 + step(midMid, bottomLeft)*32.0;"," lbp = lbp + step(midMid, bottomMid)*64.0 + step(midMid, bottomRight)*128.0;"," gl_FragColor = lbp;","}"].join("\n")),"sobel"in ba&&(T=["precision mediump float;","","uniform vec2 u_onePixelPatches;","","// our patches","uniform sampler2D u_patches;","","// the texCoords passed in from the vertex shader.","varying vec2 v_texCoord;","","void main() {"," vec4 bottomLeft = texture2D(u_patches, v_texCoord + vec2(-"+ja[0].toFixed(5)+", "+ja[1].toFixed(5)+"));"," vec4 bottomRight = texture2D(u_patches, v_texCoord + vec2("+ja[0].toFixed(5)+", "+ja[1].toFixed(5)+"));"," vec4 topLeft = texture2D(u_patches, v_texCoord + vec2(-"+ja[0].toFixed(5)+", -"+ja[1].toFixed(5)+"));"," vec4 topRight = texture2D(u_patches, v_texCoord + vec2("+ja[0].toFixed(5)+", -"+ja[1].toFixed(5)+"));"," vec4 dx = ("," bottomLeft +"," (texture2D(u_patches, v_texCoord + vec2(-"+ja[0].toFixed(5)+", 0.0))*vec4(2.0,2.0,2.0,2.0)) +"," topLeft -"," bottomRight -"," (texture2D(u_patches, v_texCoord + vec2("+ja[0].toFixed(5)+", 0.0))*vec4(2.0,2.0,2.0,2.0)) -"," topRight)/4.0;"," vec4 dy = ("," bottomLeft +"," (texture2D(u_patches, v_texCoord + vec2(0.0, "+ja[1].toFixed(5)+"))*vec4(2.0,2.0,2.0,2.0)) +"," bottomRight -"," topLeft -"," (texture2D(u_patches, v_texCoord + vec2(0.0, -"+ja[1].toFixed(5)+"))*vec4(2.0,2.0,2.0,2.0)) -"," topRight)/4.0;"," vec4 gradient = sqrt((dx*dx) + (dy*dy));"," gl_FragColor = gradient;","}"].join("\n")),b=document.createElement("canvas"),b.setAttribute("width",e-c+1+"px"),b.setAttribute("height",(f-d+1)*g+"px"),b.setAttribute("id","renderCanvas"),b.setAttribute("style","display:none;"),document.body.appendChild(b),a=setupWebGL(b,{premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1}),!a.getExtension("OES_texture_float"))return void alert("Your graphics card does not support floating point textures! :(");"raw"in ba&&(ca(ba.raw,a.TEXTURE0),Y=!0),"sobel"in ba&&(ca(ba.sobel,a.TEXTURE4),X=!0),"lbp"in ba&&(ca(ba.lbp,a.TEXTURE5),W=!0);for(var ka,la=[],ma=(c-1)/2,na=0;m>na;na++)ka=na*f,la=la.concat([ma,ka+ma,e-ma,ka+ma,ma,ka+f-ma]),la=la.concat([ma,ka+f-ma,e-ma,ka+ma,e-ma,ka+f-ma]);la=new Float32Array(la);for(var oa=[],na=0;nana;na++)ka=na*(2/m),ra=ra.concat([-1,pa-ka,1,pa-ka,-1,qa-ka]),ra=ra.concat([-1,qa-ka,1,pa-ka,1,qa-ka]);ra=new Float32Array(ra),pa=1-1/(f*m),qa=1-1/m+1/(f*m);for(var sa=[],na=0;m>na;na++)ka=na*(1/m),sa=sa.concat([0,pa-ka,1,pa-ka,0,qa-ka]),sa=sa.concat([0,qa-ka,1,pa-ka,1,qa-ka]);sa=new Float32Array(sa)}y=new Float32Array(12*g);for(var ka,ta,na=0;g>na;na++)ka=na*w,ta=12*na,y[ta]=0,y[ta+1]=ka,y[ta+2]=v,y[ta+3]=ka,y[ta+4]=0,y[ta+5]=ka+w,y[ta+6]=0,y[ta+7]=ka+w,y[ta+8]=v,y[ta+9]=ka,y[ta+10]=v,y[ta+11]=ka+w;z=new Float32Array(12*g);for(var ua=(c-1)/2/e,va=(c-1)/2/(f*B),wa=f/(f*B),na=0;g>na;na++)ka=Math.floor(na/4)*wa,ta=12*na,z[ta]=ua,z[ta+1]=ka+va,z[ta+2]=1-ua,z[ta+3]=ka+va,z[ta+4]=ua,z[ta+5]=ka+wa-va,z[ta+6]=ua,z[ta+7]=ka+wa-va,z[ta+8]=1-ua,z[ta+9]=ka+va,z[ta+10]=1-ua,z[ta+11]=ka+wa-va;A=new Float32Array(6*g);for(var xa,na=0;g>na;na++)xa=na%4,ta=6*na,A[ta]=xa,A[ta+1]=xa,A[ta+2]=xa,A[ta+3]=xa,A[ta+4]=xa,A[ta+5]=xa;if("sobel"in ba){var ya=loadShader(a,$,a.VERTEX_SHADER),za=loadShader(a,T,a.FRAGMENT_SHADER);M=createProgram(a,[ya,za]),a.useProgram(M),Q=a.getAttribLocation(M,"a_position"),R=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,R),a.bufferData(a.ARRAY_BUFFER,ra,a.STATIC_DRAW),a.enableVertexAttribArray(Q),a.vertexAttribPointer(Q,2,a.FLOAT,!1,0,0),O=a.getAttribLocation(M,"a_texCoord"),P=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,P),a.bufferData(a.ARRAY_BUFFER,sa,a.STATIC_DRAW),a.enableVertexAttribArray(O),a.vertexAttribPointer(O,2,a.FLOAT,!1,0,0),a.uniform1i(a.getUniformLocation(M,"u_patches"),1)}if("lbp"in ba){var Aa=loadShader(a,Z,a.VERTEX_SHADER),Ba=loadShader(a,S,a.FRAGMENT_SHADER);H=createProgram(a,[Aa,Ba]),a.useProgram(H),K=a.getAttribLocation(H,"a_position"),L=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,L),a.bufferData(a.ARRAY_BUFFER,ra,a.STATIC_DRAW),a.enableVertexAttribArray(K),a.vertexAttribPointer(K,2,a.FLOAT,!1,0,0),O=a.getAttribLocation(H,"a_texCoord"),J=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,J),a.bufferData(a.ARRAY_BUFFER,sa,a.STATIC_DRAW),a.enableVertexAttribArray(I),a.vertexAttribPointer(I,2,a.FLOAT,!1,0,0),a.uniform1i(a.getUniformLocation(H,"u_patches"),1); -}var Ca=loadShader(a,_,a.VERTEX_SHADER),Da=loadShader(a,aa,a.FRAGMENT_SHADER);k=createProgram(a,[Ca,Da]),a.useProgram(k);var Ea=a.getUniformLocation(k,"u_resolutiondraw");a.uniform2f(Ea,v,x);var Fa=a.getUniformLocation(k,"u_responses");a.uniform1i(Fa,2);var Ga=loadShader(a,U,a.VERTEX_SHADER),Ha=loadShader(a,V,a.FRAGMENT_SHADER);j=createProgram(a,[Ga,Ha]),a.useProgram(j);var Ia=a.getAttribLocation(j,"a_position");if(u=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,u),a.bufferData(a.ARRAY_BUFFER,la,a.STATIC_DRAW),a.enableVertexAttribArray(Ia),a.vertexAttribPointer(Ia,2,a.FLOAT,!1,0,0),t=a.getAttribLocation(j,"a_texCoord"),s=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,s),a.bufferData(a.ARRAY_BUFFER,oa,a.STATIC_DRAW),a.enableVertexAttribArray(t),a.vertexAttribPointer(t,2,a.FLOAT,!1,0,0),"lbp"in ba||"sobel"in ba){a.activeTexture(a.TEXTURE3);var Ja=a.createTexture();a.bindTexture(a.TEXTURE_2D,Ja),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,f*m,0,a.RGBA,a.FLOAT,null),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),N=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,N),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,Ja,0)}a.activeTexture(a.TEXTURE2),r=a.createTexture(),a.bindTexture(a.TEXTURE_2D,r),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,f*m,0,a.RGBA,a.FLOAT,null),l=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,l),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r,0),a.viewport(0,0,e,f*m),n=a.createTexture(),o=a.createBuffer(),q=a.createBuffer(),p=a.createBuffer()},this.getRawResponses=function(b){ba(b),a.useProgram(j),a.uniform1i(a.getUniformLocation(j,"u_patches"),1),a.uniform1i(a.getUniformLocation(j,"u_filters"),0);var c=a.getAttribLocation(j,"a_position");a.bindBuffer(a.ARRAY_BUFFER,u),a.enableVertexAttribArray(c),a.vertexAttribPointer(c,2,a.FLOAT,!1,0,0);var d=a.getAttribLocation(j,"a_texCoord");a.bindBuffer(a.ARRAY_BUFFER,s),a.enableVertexAttribArray(d),a.vertexAttribPointer(d,2,a.FLOAT,!1,0,0),a.bindFramebuffer(a.FRAMEBUFFER,l),a.viewport(0,0,e,f*m),a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER),a.drawArrays(a.TRIANGLES,0,6*B);var g=da("raw");return g},this.getSobelResponses=function(b){if(X){ba(b),a.useProgram(M);var c=a.getAttribLocation(M,"a_position");a.bindBuffer(a.ARRAY_BUFFER,R),a.enableVertexAttribArray(c),a.vertexAttribPointer(c,2,a.FLOAT,!1,0,0);var d=a.getAttribLocation(M,"a_texCoord");a.bindBuffer(a.ARRAY_BUFFER,P),a.enableVertexAttribArray(d),a.vertexAttribPointer(d,2,a.FLOAT,!1,0,0),a.bindFramebuffer(a.FRAMEBUFFER,N),a.viewport(0,0,e,f*m),a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER),a.drawArrays(a.TRIANGLES,0,6*B),a.useProgram(j),a.uniform1i(a.getUniformLocation(j,"u_filters"),4),a.uniform1i(a.getUniformLocation(j,"u_patches"),3);var g=a.getAttribLocation(j,"a_position");a.bindBuffer(a.ARRAY_BUFFER,u),a.enableVertexAttribArray(g),a.vertexAttribPointer(g,2,a.FLOAT,!1,0,0);var h=a.getAttribLocation(j,"a_texCoord");a.bindBuffer(a.ARRAY_BUFFER,s),a.enableVertexAttribArray(h),a.vertexAttribPointer(h,2,a.FLOAT,!1,0,0),a.bindFramebuffer(a.FRAMEBUFFER,l),a.viewport(0,0,e,f*m),a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER),a.drawArrays(a.TRIANGLES,0,6*B);var i=da("sobel");return i}},this.getLBPResponses=function(b){if(W){ba(b),a.useProgram(H);var c=a.getAttribLocation(H,"a_position");a.bindBuffer(a.ARRAY_BUFFER,L),a.enableVertexAttribArray(c),a.vertexAttribPointer(c,2,a.FLOAT,!1,0,0);var d=a.getAttribLocation(H,"a_texCoord");a.bindBuffer(a.ARRAY_BUFFER,J),a.enableVertexAttribArray(d),a.vertexAttribPointer(d,2,a.FLOAT,!1,0,0),a.bindFramebuffer(a.FRAMEBUFFER,N),a.viewport(0,0,e,f*m),a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER),a.drawArrays(a.TRIANGLES,0,6*B),a.useProgram(j),a.uniform1i(a.getUniformLocation(j,"u_filters"),5),a.uniform1i(a.getUniformLocation(j,"u_patches"),3);var g=a.getAttribLocation(j,"a_position");a.bindBuffer(a.ARRAY_BUFFER,u),a.enableVertexAttribArray(g),a.vertexAttribPointer(g,2,a.FLOAT,!1,0,0);var h=a.getAttribLocation(j,"a_texCoord");a.bindBuffer(a.ARRAY_BUFFER,s),a.enableVertexAttribArray(h),a.vertexAttribPointer(h,2,a.FLOAT,!1,0,0),a.bindFramebuffer(a.FRAMEBUFFER,l),a.viewport(0,0,e,f*m),a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER),a.drawArrays(a.TRIANGLES,0,6*B);var i=da("lbp");return i}};var ba=function(b){for(var c=0,d=0,h=0,i=0;B>i;i++)for(var j=0;f>j;j++)for(var k=0;e>k;k++)d=4*i,h=j*e+k,c=4*(E*i+h),F[c]=g>d?b[d][h]:0,F[c+1]=g>d+1?b[d+1][h]:0,F[c+2]=g>d+2?b[d+2][h]:0,F[c+3]=g>d+3?b[d+3][h]:0;a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,n),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,C,D,0,a.RGBA,a.FLOAT,F),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST)},ca=function(b,e){for(var f=c*d,g=new Float32Array(f*m*4),h=0;m>h;h++)for(var i=0;d>i;i++)for(var j=0;c>j;j++)g[4*(f*h+i*c+j)]=4*hi;i++)f[i]=ia(f[i]);return f},ea=function(a,b){for(var c,d=0;dg;g++)g%e==0&&(0!=g&&c.push(f),f=[]),f.push(a[g]);return c.push(f),c},ga=function(){{var c=new Uint8Array(4*b.width*b.height);a.readPixels(0,0,b.width,b.height,a.RGBA,a.UNSIGNED_BYTE,c)}return c},ha=function(a){for(var b=[],c=a.length,d=0;c>d;d+=4)b[d/4>>0]=a[d]/4294967296+a[d+1]/16777216+a[d+2]/65536+a[d+3]/256;return b},ia=function(a){for(var b=a.length,c=0,d=1,e=0;b>e;e++)c=a[e]>c?a[e]:c,d=a[e]e;e++)a[e]=(a[e]-d)/f;return a}};!function(){var a=function(a){throw window.console&&(window.console.error?window.console.error(a):window.console.log&&window.console.log(a)),a},b=function(){return window!=window.top},c=function(a,b){if(!window.WebGLRenderingContext)return null;var c=d(a,b);return c?c:null},d=function(a,b){for(var c=["webgl","experimental-webgl"],d=null,e=0;e>2,q=0;g>q;q++)j=h[q],j>q&&(k=a[q],a[q]=a[j],a[j]=k,k=b[q],b[q]=b[j],b[j]=k);for(var r=1;g>r;r<<=1){e=0,d=g/(r<<1);for(var s=0;r>s;s++){l=i[e+p],m=c*i[e];for(var t=s;g>t;t+=r<<1)f=t+r,n=l*a[f]+m*b[f],o=l*b[f]-m*a[f],a[f]=a[t]-n,a[t]+=n,b[f]=b[t]-o,b[t]+=o;e+=d}}}function b(){h="undefined"!=typeof Uint8Array?new Uint8Array(g):new Array(g),"undefined"!=typeof Float64Array?(i=new Float64Array(1.25*g),e=new Float64Array(g),f=new Float64Array(g)):(i=new Array(1.25*g),e=new Array(g),f=new Array(g))}function c(){var a=0,b=0,c=0;for(h[0]=0;++a>1;b>=c;)b-=c,c>>=1;b+=c,h[a]=b}}function d(){var a=g>>1,b=g>>2,c=g>>3,d=a+b,e=Math.sin(Math.PI/g),f=2*e*e,h=Math.sqrt(f*(2-f)),j=i[b]=1,k=i[0]=0;e=2*f;for(var l=1;c>l;l++)j-=f,f+=e*j,k+=h,h-=e*k,i[l]=k,i[b-l]=j;0!==c&&(i[c]=Math.sqrt(.5));for(var m=0;b>m;m++)i[a-m]=i[m];for(var n=0;d>n;n++)i[n+a]=-i[n]}var e,f,g=0,h=null,i=null;this.init=function(a){if(0===a||0!==(a&a-1))throw new Error("init: radix-2 required");g=a,b(),c(),d()},this.fft1d=function(b,c){a(b,c,1)},this.ifft1d=function(b,c){var d=1/g;a(b,c,-1);for(var e=0;g>e;e++)b[e]*=d,c[e]*=d},this.fft2d=function(a,b){for(var c=0,d=0;g>d;d++){c=d*g;for(var h=0;g>h;h++)e[h]=a[h+c],f[h]=b[h+c];this.fft1d(e,f);for(var i=0;g>i;i++)a[i+c]=e[i],b[i+c]=f[i]}for(var j=0;g>j;j++){for(var k=0;g>k;k++)c=j+k*g,e[k]=a[c],f[k]=b[c];this.fft1d(e,f);for(var l=0;g>l;l++)c=j+l*g,a[c]=e[l],b[c]=f[l]}},this.ifft2d=function(a,b){for(var c=0,d=0;g>d;d++){c=d*g;for(var h=0;g>h;h++)e[h]=a[h+c],f[h]=b[h+c];this.ifft1d(e,f);for(var i=0;g>i;i++)a[i+c]=e[i],b[i+c]=f[i]}for(var j=0;g>j;j++){for(var k=0;g>k;k++)c=j+k*g,e[k]=a[c],f[k]=b[c];this.ifft1d(e,f);for(var l=0;g>l;l++)c=j+l*g,a[c]=e[l],b[c]=f[l]}},this.real_ifft2d=function(a,b){for(var c,d=0,h=0;g>h;h++){d=h*g;for(var i=0;g>i;i++)e[i]=a[i+d],f[i]=b[i+d];this.ifft1d(e,f);for(var j=0;g>j;j++)a[j+d]=e[j],b[j+d]=f[j]}for(var k=g/2,l=0,m=0;g>m;m+=2){d=m,c=m+1,e[0]=a[0+d],f[0]=a[0+c],e[g/2]=a[k*g+d],f[g/2]=a[k*g+c];for(var j=1;k>j;j++)l=j*g,e[j]=a[l+d]-b[l+c],e[g-j]=a[l+d]+b[l+c],f[j]=b[l+d]+a[l+c],f[g-j]=a[l+c]-b[l+d];this.ifft1d(e,f);for(var n=0;g>n;n++)d=m+n*g,c=m+1+n*g,a[d]=e[n],a[c]=f[n]}},this.real_fft2d=function(a,b){for(var c=0,d=0,h=0;g>h;h+=2){c=h*g,d=(h+1)*g;for(var i=0;g>i;i++)e[i]=a[i+c],f[i]=a[i+d];this.fft1d(e,f),a[0+c]=e[0],a[0+d]=f[0],b[0+c]=0,b[0+d]=0,a[g/2+c]=e[g/2],a[g/2+d]=f[g/2],b[g/2+c]=0,b[g/2+d]=0;for(var j=1;g/2>j;j++)a[j+c]=.5*(e[j]+e[g-j]),b[j+c]=.5*(f[j]-f[g-j]),a[j+d]=.5*(f[j]+f[g-j]),b[j+d]=-.5*(e[j]-e[g-j]),a[g-j+c]=a[j+c],b[g-j+c]=-b[j+c],a[g-j+d]=a[j+d],b[g-j+d]=-b[j+d]}for(var k=0;g>k;k++){for(var l=0;g>l;l++)c=k+l*g,e[l]=a[c],f[l]=b[c];this.fft1d(e,f);for(var m=0;g>m;m++)c=k+m*g,a[c]=e[m],b[c]=f[m]}}}var b,c,d,e,f,g,h,i,j,k,l;this.fft_inplace=function(a,c){"undefined"==typeof c&&(c=k);for(var d=0;g>d;d++)c[d]=0;return b.real_fft2d(a,c),[a,c]},this.ifft=function(a,c){return b.real_ifft2d(a,c),a};var m=function(a,b){for(var c,d,e=0;g>e;e++)c=a[0][e]*b[0][e]-a[1][e]*b[1][e],d=a[0][e]*b[1][e]+a[1][e]*b[0][e],a[0][e]=c,a[1][e]=d};this.init=function(m,n,o,q,r){f=p(q-1+r),g=f*f,b=new a,b.init(f),c=Array(o);for(var s,t=(q-1)/2,u=0;o>u;u++){for(var v,w,x=new Float64Array(g),y=new Float64Array(g),z=0;q>z;z++)for(var A=0;q>A;A++)v=t>A?f-t:-t,w=t>z?f-t:-t,x[A+v+(z+w)*f]=m[u][q-1-z+(q-1-A)*q];s=this.fft_inplace(x,y),c[u]=s}e=new Float64Array(o);for(var u=0;o>u;u++)e[u]=n[u];d=Array(o),k=Array(o);for(var u=0;o>u;u++)d[u]=new Float64Array(r*r),k[u]=new Float64Array(r*r);l=new Float64Array(g),j=o,h=q,i=r},this.getResponses=function(a){for(var b,g,k=h-1+i,p=0;j>p;p++){for(var r=0;f*f>r;r++)l[r]=0;a[p]=n(a[p]);for(var r=0;k>r;r++)for(var s=0;k>s;s++)l[r+f*s]=a[p][s+k*r];b=this.fft_inplace(l),m(b,c[p]),b=this.ifft(b[0],b[1]),g=(h-1)/2;for(var r=0;i>r;r++)for(var s=0;i>s;s++)d[p][r+s*i]=b[g+s+(r+g)*f];for(var r=0;i*i>r;r++)d[p][r]+=e[p];d[p]=o(d[p]),q(d[p])}return d};var n=function(a){for(var b,c=h-1+i,d=0,e=1e3,f=0;c>f;f++)for(var g=0;c>g;g++)b=a[g+c*f],e>b&&(e=b),b>d&&(d=b);for(var j=d-e,f=0;c>f;f++)for(var g=0;c>g;g++)a[g+c*f]=(a[g+c*f]-e)/j;return a},o=function(a){for(var b=0;i>b;b++)for(var c=0;i>c;c++)a[b+c*i]=1/(1+Math.exp(-(a[b+c*i]-1)));return a},p=function(a){return a--,a|=a>>1,a|=a>>2,a|=a>>4,a|=a>>8,a|=a>>16,a++,a},q=function(a){for(var b=a.length,c=0,d=1,e=0;b>e;e++)c=a[e]>c?a[e]:c,d=a[e]e;e++)a[e]=(a[e]-d)/f}},mosseFilterResponses=function(){var a=[],b=[],c=0;this.init=function(b,d,e,f){for(var g=0;d>g;g++){var h={};h.width=e,h.height=f;for(var i=e*f,j=new Float64Array(i),k=new Float64Array(i),l=0;i>l;l++)j[l]=b[g][0][l],k[l]=b[g][1][l];h.real=j,h.imag=k,a[g]=new mosseFilter,a[g].load(h)}c=d},this.getResponses=function(e){for(var f=0;c>f;f++)b[f]=a[f].getResponse(e[f]),b[f]=d(b[f]);return b};var d=function(a){for(var b=a.length,c=0,d=1,e=0;b>e;e++)c=a[e]>c?a[e]:c,d=a[e]e;e++)a[e]=(a[e]-d)/f;return a}},jsfeat_face=function(a,b,c){var d=a.width,e=a.height,f=Math.min(b/d,b/e),g=d*f|0,h=e*f|0,i=document.createElement("canvas");i.height=h,i.width=g;var j=i.getContext("2d");if(c)Worker.createURL=function(a){var b="function"==typeof a?a.toString():a,c=new Blob(["'use strict';\nself.onmessage ="+b],{type:"text/javascript"});return window.URL.createObjectURL(c)},Worker.create=function(a){return new Worker(Worker.createURL(a))};else var k=new jsfeat.matrix_t(g,h,jsfeat.U8_t|jsfeat.C1_t),l=new jsfeat.matrix_t(g,h,jsfeat.U8_t|jsfeat.C1_t),m=new Int32Array((g+1)*(h+1)),n=new Int32Array((g+1)*(h+1)),o=new Int32Array((g+1)*(h+1)),p=new Int32Array((g+1)*(h+1)),q=jsfeat.haar.frontalface;this.findFace=function(b,e){j.drawImage(a,0,0,i.width,i.height);var f=j.getImageData(0,0,i.width,i.height);if(!c){jsfeat.imgproc.grayscale(f.data,i.width,i.height,k),b.equalizeHistogram&&jsfeat.imgproc.equalize_histogram(k,k),jsfeat.imgproc.compute_integral_image(k,m,n,q.tilted?o:null),b.useCanny&&(jsfeat.imgproc.canny(k,l,10,50),jsfeat.imgproc.compute_integral_image(l,p,null,null)),jsfeat.haar.edgesDensity=b.edgesDensity;var g=jsfeat.haar.detect_multi_scale(m,n,o,b.useCanny?p:null,k.cols,k.rows,q,b.scaleFactor,b.minScale);g=jsfeat.haar.group_rectangles(g,1);var h=g.length;if(0==h)return!1;for(var r=g[0],s=1;h>s;s++)g[s].neighbors>r.neighbors?r=g[s]:g[s].neighbors==r.neighbors&&g[s].confidence>r.confidence&&(r=g[s]);var t=d/k.cols;return r.x=r.x*t|0,r.y=r.y*t|0,r.width=r.width*t|0,r.height=r.height*t|0,r}var u=Worker.create(findFaceWorker);u.addEventListener("message",function(a){this.faceDetected(a,e)}.bind(this),!1),u.postMessage({w:i.width,h:i.height,videoWidth:d,imageData:f,params:b})}},findFaceWorker=function(a){var b=self,c=c||{REVISION:"ALPHA"};!function(a){var b=1.192092896e-7,d=1e-37,e=256,f=512,g=1024,h=2048,i=4096,j=1,k=2,l=3,m=4,n=new Int32Array([-1,1,4,-1,4,-1,-1,-1,8,-1,-1,-1,-1,-1,-1,-1,8]),o=function(){return function(a){return 65280&a}}(),p=function(){return function(a){return 255&a}}(),q=function(){return function(a){return n[(65280&a)>>8]}}(),r=0,s=1,t=2,u=3,v=1,w=1,x=2,y=function(){function a(a,b){this.size=-8&(a+7|0),"undefined"==typeof b?this.buffer=new ArrayBuffer(this.size):(this.buffer=b,this.size=b.length),this.u8=new Uint8Array(this.buffer),this.i32=new Int32Array(this.buffer),this.f32=new Float32Array(this.buffer),this.f64=new Float64Array(this.buffer)}return a}(),z=function(){function a(a,b,c,d){this.type=0|o(c),this.channel=0|p(c),this.cols=0|a,this.rows=0|b,"undefined"==typeof d?this.allocate():(this.buffer=d,this.data=this.type&e?this.buffer.u8:this.type&f?this.buffer.i32:this.type&g?this.buffer.f32:this.buffer.f64)}return a.prototype.allocate=function(){delete this.data,delete this.buffer,this.buffer=new y(this.cols*q(this.type)*this.channel*this.rows),this.data=this.type&e?this.buffer.u8:this.type&f?this.buffer.i32:this.type&g?this.buffer.f32:this.buffer.f64},a.prototype.copy_to=function(a){for(var b=a.data,c=this.data,d=0,e=this.cols*this.rows*this.channel|0;e-4>d;d+=4)b[d]=c[d],b[d+1]=c[d+1],b[d+2]=c[d+2],b[d+3]=c[d+3];for(;e>d;++d)b[d]=c[d]},a.prototype.resize=function(a,b,c){"undefined"==typeof c&&(c=this.channel);var d=a*q(this.type)*c*b;d>this.buffer.size?(this.cols=a,this.rows=b,this.channel=c,this.allocate()):(this.cols=a,this.rows=b,this.channel=c)},a}(),A=function(){function a(a){this.levels=0|a,this.data=new Array(a),this.pyrdown=c.imgproc.pyrdown}return a.prototype.allocate=function(a,b,c){for(var d=this.levels;--d>=0;)this.data[d]=new z(a>>d,b>>d,c)},a.prototype.build=function(a,b){"undefined"==typeof b&&(b=!0);var c=2,d=a,e=this.data[0];if(!b)for(var f=a.cols*a.rows;--f>=0;)e.data[f]=a.data[f];for(e=this.data[1],this.pyrdown(d,e);cg;++g){var h=new d(f);b=b.next=h,e++}},get_buffer:function(b){var c=a;return a=a.next,e--,b>c.size&&c.resize(b),c},put_buffer:function(a){b=b.next=a,e++}}}();a.cache=b,b.allocate(30,2560)}(c),function(a){var b=function(){var a=new Int32Array(96);return{get_gaussian_kernel:function(a,b,d,e){var f=0,g=0,h=0,i=0,j=0,k=0,l=c.cache.get_buffer(a<<2),m=l.f32;if(1==(1&a)&&7>=a&&0>=b)switch(a>>1){case 0:m[0]=1,k=1;break;case 1:m[0]=.25,m[1]=.5,m[2]=.25,k=1;break;case 2:m[0]=.0625,m[1]=.25,m[2]=.375,m[3]=.25,m[4]=.0625,k=1;break;case 3:m[0]=.03125,m[1]=.109375,m[2]=.21875,m[3]=.28125,m[4]=.21875,m[5]=.109375,m[6]=.03125,k=1}else for(i=b>0?b:.3*(.5*(a-1)-1)+.8,j=-.5/(i*i);a>f;++f)g=f-.5*(a-1),h=Math.exp(j*g*g),m[f]=h,k+=h;if(e&c.U8_t)for(k=256/k,f=0;a>f;++f)d[f]=m[f]*k+.5|0;else for(k=1/k,f=0;a>f;++f)d[f]=m[f]*k;c.cache.put_buffer(l)},perspective_4point_transform:function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){var r=b,s=j,t=g,u=r*s*t,v=o,w=r*v,x=s*w,y=k,z=r*y,A=f,B=c,C=n,D=B*C,E=D*A,F=C*A*y,G=C*t,H=C*y,I=s*t,J=v*s,K=v*A,L=y*A,M=1/(G-H-I+J-K+L),N=r*C,O=B*A,P=t*r,Q=v*P,R=B*s,S=D*y,T=B*y*A,U=t*v*s,V=v*B,W=-(x-u+z*A-A*w-D*s+E-F+G*s)*M,X=(u-x-N*t+N*y+E-s*O+K*s-F)*M,Y=r,Z=(-y*w+Q+R*t-D*t+S-T+K*y-U)*M,$=(-Q+P*y-V*s+S-T+V*A+U-G*y)*M,_=B,aa=(-z+P+R-O+H-G-J+K)*M,ba=(-w+z+D-R+K-L-G+I)*M;r=d,s=l,t=i,u=r*s*t,v=q,w=r*v,x=s*w,y=m,z=r*y,A=h,B=e,C=p,D=B*C,E=D*A,F=C*A*y,G=C*t,H=C*y,I=s*t,J=v*s,K=v*A,L=y*A,M=1/(G-H-I+J-K+L),N=r*C,O=B*A,P=t*r,Q=v*P,R=B*s,S=D*y,T=B*y*A,U=t*v*s,V=v*B;var ca=-(x-u+z*A-A*w-D*s+E-F+G*s)*M,da=(u-x-N*t+N*y+E-s*O+K*s-F)*M,ea=r,fa=(-y*w+Q+R*t-D*t+S-T+K*y-U)*M,ga=(-Q+P*y-V*s+S-T+V*A+U-G*y)*M,ha=B,ia=(-z+P+R-O+H-G-J+K)*M,ja=(-w+z+D-R+K-L-G+I)*M;s=$-ba*_,t=W*$,u=W*_,w=Z*X,x=Y*Z,z=X*aa;var ka=Y*aa;C=1/(t-u*ba-w+x*ba+z*_-ka*$),E=-Z+_*aa;var la=-Z*ba+$*aa;L=-X+Y*ba;var ma=W-ka;O=W*ba-z,P=-X*_+Y*$;var na=u-x,oa=t-w;T=s*C;var pa=L*C,qa=P*C,ra=a.data;ra[0]=ca*T+da*E*C-ea*la*C,ra[1]=ca*pa+da*ma*C-ea*O*C,ra[2]=-ca*qa-da*na*C+ea*oa*C,ra[3]=fa*T+ga*E*C-ha*la*C,ra[4]=fa*pa+ga*ma*C-ha*O*C,ra[5]=-fa*qa-ga*na*C+ha*oa*C,ra[6]=ia*T+ja*E*C-la*C,ra[7]=ia*pa+ja*ma*C-O*C,ra[8]=-ia*qa-ja*na*C+oa*C},qsort:function(b,c,d,e){var f,g,h,i,j=7,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=a;if(!(1>=d-c+1))for(C[0]=c,C[1]=d;k>=0;)for(l=C[k<<1],m=C[(k<<1)+1],k--;;){if(o=m-l+1,j>=o){for(q=l+1;m>=q;q++)for(r=q;r>l&&e(b[r],b[r-1]);r--)f=b[r],b[r]=b[r-1],b[r-1]=f;break}for(B=0,t=l,v=m,x=l+(o>>1),o>40&&(s=o>>3,y=l,z=l+s,A=l+(s<<1),g=b[y],h=b[z],i=b[A],l=e(g,h)?e(h,i)?z:e(g,i)?A:y:e(i,h)?z:e(g,i)?y:A,y=x-s,z=x,A=x+s,g=b[y],h=b[z],i=b[A],x=e(g,h)?e(h,i)?z:e(g,i)?A:y:e(i,h)?z:e(g,i)?y:A,y=m-(s<<1),z=m-s,A=m,g=b[y],h=b[z],i=b[A],m=e(g,h)?e(h,i)?z:e(g,i)?A:y:e(i,h)?z:e(g,i)?y:A),y=l,z=x,A=m,g=b[y],h=b[z],i=b[A],x=e(g,h)?e(h,i)?z:e(g,i)?A:y:e(i,h)?z:e(g,i)?y:A,x!=t&&(f=b[x],b[x]=b[t],b[t]=f,x=t),l=u=t+1,m=w=v,g=b[x];;){for(;m>=l&&!e(g,b[l]);)e(b[l],g)||(l>u&&(f=b[u],b[u]=b[l],b[l]=f),B=1,u++),l++;for(;m>=l&&!e(b[m],g);)e(g,b[m])||(w>m&&(f=b[w],b[w]=b[m],b[m]=f),B=1,w--),m--;if(l>m)break;f=b[l],b[l]=b[m],b[m]=f,B=1,l++,m--}if(0==B){for(l=t,m=v,q=l+1;m>=q;q++)for(r=q;r>l&&e(b[r],b[r-1]);r--)f=b[r],b[r]=b[r-1],b[r-1]=f;break}for(o=Math.min(u-t,l-u),p=l-o|0,n=0;o>n;++n,++p)f=b[t+n],b[t+n]=b[p],b[p]=f;for(o=Math.min(v-w,w-m),p=v-o+1|0,n=0;o>n;++n,++p)f=b[l+n],b[l+n]=b[p],b[p]=f;if(o=l-u,p=w-m,o>1)p>1?o>p?(++k,C[k<<1]=t,C[(k<<1)+1]=t+o-1,l=v-p+1,m=v):(++k,C[k<<1]=v-p+1,C[(k<<1)+1]=v,l=t,m=t+o-1):(l=t,m=t+o-1);else{if(!(p>1))break;l=v-p+1,m=v}}},median:function(a,b,c){for(var d,e=0,f=0,g=0,h=b+c>>1;;){if(b>=c)return a[h];if(c==b+1)return a[b]>a[c]&&(d=a[b],a[b]=a[c],a[c]=d),a[h];for(e=b+c>>1,a[e]>a[c]&&(d=a[e],a[e]=a[c],a[c]=d),a[b]>a[c]&&(d=a[b],a[b]=a[c],a[c]=d),a[e]>a[b]&&(d=a[e],a[e]=a[b],a[b]=d),f=b+1,d=a[e],a[e]=a[f],a[f]=d,g=c;;){do++f;while(a[b]>a[f]);do--g;while(a[g]>a[b]);if(f>g)break;d=a[f],a[f]=a[g],a[g]=d}d=a[b],a[b]=a[g],a[g]=d,h>=g?b=f:g>=h&&(c=g-1)}return 0}}}();a.math=b}(c),function(a){var b=function(){return{identity:function(a,b){"undefined"==typeof b&&(b=1);for(var c=a.data,d=a.rows,e=a.cols,f=e+1|0,g=d*e,h=g;--g>=0;)c[g]=0;for(g=h,h=0;g>h;)c[h]=b,h+=f},transpose:function(a,b){for(var c=0,d=0,e=b.rows,f=b.cols,g=0,h=0,i=0,j=b.data,k=a.data;e>c;h+=1,g+=f,c++)for(i=h,d=0;f>d;i+=e,d++)k[i]=j[g+d]},multiply:function(a,b,c){for(var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=b.cols,m=b.rows,n=c.cols,o=b.data,p=c.data,q=a.data,r=0;m>d;g+=l,d++)for(j=0,e=0;n>e;k++,j++,e++){for(i=j,h=g,r=0,f=0;l>f;h++,i+=n,f++)r+=o[h]*p[i];q[k]=r}},multiply_ABt:function(a,b,c){for(var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=b.cols,l=b.rows,m=c.rows,n=b.data,o=c.data,p=a.data,q=0;l>d;g+=k,d++)for(i=0,e=0;m>e;j++,e++){for(h=g,q=0,f=0;k>f;h++,i++,f++)q+=n[h]*o[i];p[j]=q}},multiply_AtB:function(a,b,c){for(var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=b.cols,m=b.rows,n=c.cols,o=b.data,p=c.data,q=a.data,r=0;l>d;g++,d++)for(j=0,e=0;n>e;k++,j++,e++){for(i=j,h=g,r=0,f=0;m>f;h+=l,i+=n,f++)r+=o[h]*p[i];q[k]=r}},multiply_AAt:function(a,b){for(var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=b.cols,m=b.rows,n=b.data,o=a.data,p=0;m>c;f+=m+1,g=h,c++)for(j=f,k=f,i=g,d=c;m>d;j++,k+=m,d++){for(h=g,p=0,e=0;l>e;e++)p+=n[h++]*n[i++];o[j]=p,o[k]=p}},multiply_AtA:function(a,b){for(var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=b.cols,m=b.rows,n=b.data,o=a.data,p=0;l>c;i+=l,c++)for(f=c,k=i+c,j=k,d=c;l>d;j++,k+=l,d++){for(g=f,h=d,p=0,e=0;m>e;g+=l,h+=l,e++)p+=n[g]*n[h];o[j]=p,o[k]=p}},identity_3x3:function(a,b){"undefined"==typeof b&&(b=1);var c=a.data;c[0]=c[4]=c[8]=b,c[1]=c[2]=c[3]=0,c[5]=c[6]=c[7]=0},invert_3x3:function(a,b){var c=a.data,d=b.data,e=c[4],f=c[8],g=c[5],h=c[7],i=c[0],j=i*e,k=i*g,l=c[3],m=c[1],n=l*m,o=c[2],p=l*o,q=c[6],r=q*m,s=q*o,t=1/(j*f-k*h-n*f+p*h+r*g-s*e);d[0]=(e*f-g*h)*t,d[1]=-(m*f-o*h)*t,d[2]=-(-m*g+o*e)*t,d[3]=-(l*f-g*q)*t,d[4]=(i*f-s)*t,d[5]=-(k-p)*t,d[6]=-(-l*h+e*q)*t,d[7]=-(i*h-r)*t,d[8]=(j-n)*t},multiply_3x3:function(a,b,c){var d=a.data,e=b.data,f=c.data,g=e[0],h=e[1],i=e[2],j=e[3],k=e[4],l=e[5],m=e[6],n=e[7],o=e[8],p=f[0],q=f[1],r=f[2],s=f[3],t=f[4],u=f[5],v=f[6],w=f[7],x=f[8];d[0]=g*p+h*s+i*v,d[1]=g*q+h*t+i*w,d[2]=g*r+h*u+i*x,d[3]=j*p+k*s+l*v,d[4]=j*q+k*t+l*w,d[5]=j*r+k*u+l*x,d[6]=m*p+n*s+o*v,d[7]=m*q+n*t+o*w,d[8]=m*r+n*u+o*x},mat3x3_determinant:function(a){var b=a.data;return b[0]*b[4]*b[8]-b[0]*b[5]*b[7]-b[3]*b[1]*b[8]+b[3]*b[2]*b[7]+b[6]*b[1]*b[5]-b[6]*b[2]*b[4]},determinant_3x3:function(a,b,c,d,e,f,g,h,i){return a*e*i-a*f*h-d*b*i+d*c*h+g*b*f-g*c*e}}}();a.matmath=b}(c),function(a){var b=function(){var a=function(a,b,c,d){d=a[b],a[b]=a[c],a[c]=d},b=function(a,b){return a=Math.abs(a),b=Math.abs(b),a>b?(b/=a,a*Math.sqrt(1+b*b)):b>0?(a/=b,b*Math.sqrt(1+a*a)):0},d=function(d,e,f,g,h,i){var j=c.EPSILON,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=i*i*30,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=c.cache.get_buffer(i<<2),E=c.cache.get_buffer(i<<2),F=D.i32,G=E.i32;if(g)for(;i>k;k++){for(m=k*h,l=0;i>l;l++)g[m+l]=0;g[m+k]=1}for(m=0;i>m;m++){if(f[m]=d[(e+1)*m],i-1>m){for(n=m+1,u=Math.abs(d[e*m+n]),k=m+2;i>k;k++)v=Math.abs(d[e*m+k]),v>u&&(u=v,n=k);F[m]=n}if(m>0){for(n=0,u=Math.abs(d[m]),k=1;m>k;k++)v=Math.abs(d[e*k+m]),v>u&&(u=v,n=k);G[m]=n}}if(i>1)for(;t>s;s++){for(m=0,u=Math.abs(d[F[0]]),k=1;i-1>k;k++)v=Math.abs(d[e*k+F[k]]),v>u&&(u=v,m=k);for(o=F[m],k=1;i>k;k++)v=Math.abs(d[e*G[k]+k]),v>u&&(u=v,m=G[k],o=k);if(w=d[e*m+o],Math.abs(w)<=j)break;for(x=.5*(f[o]-f[m]),y=Math.abs(x)+b(w,x),z=b(w,y),A=y/z,z=w/z,y=w/y*w,0>x&&(z=-z,y=-y),d[e*m+o]=0,f[m]-=y,f[o]+=y,k=0;m>k;k++)q=e*k+m,r=e*k+o,B=d[q],C=d[r],d[q]=B*A-C*z,d[r]=B*z+C*A;for(k=m+1;o>k;k++)q=e*m+k,r=e*k+o,B=d[q],C=d[r],d[q]=B*A-C*z,d[r]=B*z+C*A;for(k=o+1,q=e*m+k,r=e*o+k;i>k;k++,q++,r++)B=d[q],C=d[r],d[q]=B*A-C*z,d[r]=B*z+C*A;if(g)for(q=h*m,r=h*o,k=0;i>k;k++,q++,r++)B=g[q],C=g[r],g[q]=B*A-C*z,g[r]=B*z+C*A;for(l=0;2>l;l++){if(p=0==l?m:o,i-1>p){for(n=p+1,u=Math.abs(d[e*p+n]),k=p+2;i>k;k++)v=Math.abs(d[e*p+k]),v>u&&(u=v,n=k);F[p]=n}if(p>0){for(n=0,u=Math.abs(d[p]),k=1;p>k;k++)v=Math.abs(d[e*k+p]),v>u&&(u=v,n=k);G[p]=n}}}for(m=0;i-1>m;m++){for(n=m,k=m+1;i>k;k++)f[n]k;k++)a(g,h*n+k,h*m+k,u)}c.cache.put_buffer(D),c.cache.put_buffer(E)},e=function(d,e,f,g,h,i,j,k){for(var l=2*c.EPSILON,m=c.FLT_MIN,n=0,o=0,p=0,q=0,r=Math.max(i,30),s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=4660,K=0,L=0,M=0,N=c.cache.get_buffer(j<<3),O=N.f64;j>n;n++){for(p=0,C=0;i>p;p++)z=d[n*e+p],C+=z*z;if(O[n]=C,g){for(p=0;j>p;p++)g[n*h+p]=0;g[n*h+n]=1}}for(;r>q;q++){for(w=0,n=0;j-1>n;n++)for(o=n+1;j>o;o++){for(s=n*e|0,t=o*e|0,G=O[n],H=0,I=O[o],p=2,H+=d[s]*d[t],H+=d[s+1]*d[t+1];i>p;p++)H+=d[s+p]*d[t+p];if(!(Math.abs(H)<=l*Math.sqrt(G*I))){for(H*=2,D=G-I,E=b(H,D),0>D?(F=.5*(E-D),y=Math.sqrt(F/E),x=H/(E*y*2)):(x=Math.sqrt((E+D)/(2*E)),y=H/(E*x*2)),G=0,I=0,p=2,A=x*d[s]+y*d[t],B=-y*d[s]+x*d[t],d[s]=A,d[t]=B,G+=A*A,I+=B*B,A=x*d[s+1]+y*d[t+1],B=-y*d[s+1]+x*d[t+1],d[s+1]=A,d[t+1]=B,G+=A*A,I+=B*B;i>p;p++)A=x*d[s+p]+y*d[t+p],B=-y*d[s+p]+x*d[t+p],d[s+p]=A,d[t+p]=B,G+=A*A,I+=B*B;if(O[n]=G,O[o]=I,w=1,g)for(u=n*h|0,v=o*h|0,p=2,A=x*g[u]+y*g[v],B=-y*g[u]+x*g[v],g[u]=A,g[v]=B,A=x*g[u+1]+y*g[v+1],B=-y*g[u+1]+x*g[v+1],g[u+1]=A,g[v+1]=B;j>p;p++)A=x*g[u+p]+y*g[v+p],B=-y*g[u+p]+x*g[v+p],g[u+p]=A,g[v+p]=B}}if(0==w)break}for(n=0;j>n;n++){for(p=0,C=0;i>p;p++)z=d[n*e+p],C+=z*z;O[n]=Math.sqrt(C)}for(n=0;j-1>n;n++){for(o=n,p=n+1;j>p;p++)O[o]p;p++)a(d,n*e+p,o*e+p,z);for(p=0;j>p;p++)a(g,n*h+p,o*h+p,z)}}for(n=0;j>n;n++)f[n]=O[n];if(!g)return void c.cache.put_buffer(N);for(n=0;k>n;n++){for(C=j>n?O[n]:0;m>=C;){for(L=1/i,p=0;i>p;p++)J=214013*J+2531011,K=0!=(J>>16&32767&256)?L:-L,d[n*e+p]=K;for(q=0;2>q;q++)for(o=0;n>o;o++){for(C=0,p=0;i>p;p++)C+=d[n*e+p]*d[o*e+p];for(M=0,p=0;i>p;p++)z=d[n*e+p]-C*d[o*e+p],d[n*e+p]=z,M+=Math.abs(z);for(M=M?1/M:0,p=0;i>p;p++)d[n*e+p]*=M}for(C=0,p=0;i>p;p++)z=d[n*e+p],C+=z*z;C=Math.sqrt(C)}for(y=1/C,p=0;i>p;p++)d[n*e+p]*=y}c.cache.put_buffer(N)};return{lu_solve:function(b,d){var e,f,g,h,i=0,j=0,k=0,l=1,m=b.cols,n=b.data,o=d.data;for(i=0;m>i;i++){for(k=i,j=i+1;m>j;j++)Math.abs(n[j*m+i])>Math.abs(n[k*m+i])&&(k=j);if(Math.abs(n[k*m+i])j;j++)a(n,i*m+j,k*m+j,e);a(o,i,k,e),l=-l}for(g=-1/n[i*m+i],j=i+1;m>j;j++){for(f=n[j*m+i]*g,k=i+1;m>k;k++)n[j*m+k]+=f*n[i*m+k];o[j]+=f*o[i]}n[i*m+i]=-g}for(i=m-1;i>=0;i--){for(h=o[i],k=i+1;m>k;k++)h-=n[i*m+k]*o[k];o[i]=h*n[i*m+i]}return 1},cholesky_solve:function(a,b){var c,d,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=a.cols,m=a.data,n=b.data;for(e=0;l>e;e++)for(d=1,h=e*l,i=h,f=e;l>f;f++){for(c=m[i+e],g=0;e>g;g++)c-=m[g*l+e]*m[i+g];if(f==e){if(m[i+e]=c,0==c)return 0;d=1/c}else m[h+f]=c,m[i+e]=c*d;i+=l}for(h=0,j=0;l>j;j++){for(c=n[j],k=0;j>k;k++)c-=m[h+k]*n[k];n[j]=c,h+=l}for(h=0,j=0;l>j;j++)n[j]/=m[h+j],h+=l;for(j=l-1;j>=0;j--){for(c=n[j],k=j+1,h=k*l;l>k;k++)c-=m[h+j]*n[k],h+=l;n[j]=c}return 1},svd_decompose:function(a,b,d,f,g){"undefined"==typeof g&&(g=0);var h=0,i=0,j=a.rows,k=a.cols,l=j,m=k,n=a.type|c.C1_t;m>l&&(h=1,i=l,l=m,m=i);var o=c.cache.get_buffer(l*l<<3),p=c.cache.get_buffer(m<<3),q=c.cache.get_buffer(m*m<<3),r=new c.matrix_t(l,l,n,o.data),s=new c.matrix_t(1,m,n,p.data),t=new c.matrix_t(m,m,n,q.data);if(0==h)c.matmath.transpose(r,a);else{for(i=0;k*j>i;i++)r.data[i]=a.data[i];for(;m*l>i;i++)r.data[i]=0}if(e(r.data,l,s.data,t.data,m,l,m,l),b){for(i=0;m>i;i++)b.data[i]=s.data[i];for(;k>i;i++)b.data[i]=0}if(0==h){if(d&&g&c.SVD_U_T)for(i=l*l;--i>=0;)d.data[i]=r.data[i];else d&&c.matmath.transpose(d,r);if(f&&g&c.SVD_V_T)for(i=m*m;--i>=0;)f.data[i]=t.data[i];else f&&c.matmath.transpose(f,t)}else{if(d&&g&c.SVD_U_T)for(i=m*m;--i>=0;)d.data[i]=t.data[i];else d&&c.matmath.transpose(d,t);if(f&&g&c.SVD_V_T)for(i=l*l;--i>=0;)f.data[i]=r.data[i];else f&&c.matmath.transpose(f,r)}c.cache.put_buffer(o),c.cache.put_buffer(p),c.cache.put_buffer(q)},svd_solve:function(a,b,d){var e=0,f=0,g=0,h=0,i=0,j=a.rows,k=a.cols,l=0,m=0,n=0,o=a.type|c.C1_t,p=c.cache.get_buffer(j*j<<3),q=c.cache.get_buffer(k<<3),r=c.cache.get_buffer(k*k<<3),s=new c.matrix_t(j,j,o,p.data),t=new c.matrix_t(1,k,o,q.data),u=new c.matrix_t(k,k,o,r.data),v=d.data,w=s.data,x=t.data,y=u.data;for(this.svd_decompose(a,t,s,u,0),n=c.EPSILON*x[0]*k;k>e;e++,i+=k){for(m=0,f=0;k>f;f++)if(x[f]>n){for(g=0,l=0,h=0;j>g;g++,h+=k)l+=w[h+f]*v[g];m+=l*y[i+f]/x[f]}b.data[e]=m}c.cache.put_buffer(p),c.cache.put_buffer(q),c.cache.put_buffer(r)},svd_invert:function(a,b){var d=0,e=0,f=0,g=0,h=0,i=0,j=b.rows,k=b.cols,l=0,m=0,n=b.type|c.C1_t,o=c.cache.get_buffer(j*j<<3),p=c.cache.get_buffer(k<<3),q=c.cache.get_buffer(k*k<<3),r=new c.matrix_t(j,j,n,o.data),s=new c.matrix_t(1,k,n,p.data),t=new c.matrix_t(k,k,n,q.data),u=a.data,v=r.data,w=s.data,x=t.data;for(this.svd_decompose(b,s,r,t,0),m=c.EPSILON*w[0]*k;k>d;d++, +}var Ca=loadShader(a,_,a.VERTEX_SHADER),Da=loadShader(a,aa,a.FRAGMENT_SHADER);k=createProgram(a,[Ca,Da]),a.useProgram(k);var Ea=a.getUniformLocation(k,"u_resolutiondraw");a.uniform2f(Ea,v,x);var Fa=a.getUniformLocation(k,"u_responses");a.uniform1i(Fa,2);var Ga=loadShader(a,U,a.VERTEX_SHADER),Ha=loadShader(a,V,a.FRAGMENT_SHADER);j=createProgram(a,[Ga,Ha]),a.useProgram(j);var Ia=a.getAttribLocation(j,"a_position");if(u=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,u),a.bufferData(a.ARRAY_BUFFER,la,a.STATIC_DRAW),a.enableVertexAttribArray(Ia),a.vertexAttribPointer(Ia,2,a.FLOAT,!1,0,0),t=a.getAttribLocation(j,"a_texCoord"),s=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,s),a.bufferData(a.ARRAY_BUFFER,oa,a.STATIC_DRAW),a.enableVertexAttribArray(t),a.vertexAttribPointer(t,2,a.FLOAT,!1,0,0),"lbp"in ba||"sobel"in ba){a.activeTexture(a.TEXTURE3);var Ja=a.createTexture();a.bindTexture(a.TEXTURE_2D,Ja),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,f*m,0,a.RGBA,a.FLOAT,null),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),N=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,N),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,Ja,0)}a.activeTexture(a.TEXTURE2),r=a.createTexture(),a.bindTexture(a.TEXTURE_2D,r),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,f*m,0,a.RGBA,a.FLOAT,null),l=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,l),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r,0),a.viewport(0,0,e,f*m),n=a.createTexture(),o=a.createBuffer(),q=a.createBuffer(),p=a.createBuffer()},this.getRawResponses=function(b){ba(b),a.useProgram(j),a.uniform1i(a.getUniformLocation(j,"u_patches"),1),a.uniform1i(a.getUniformLocation(j,"u_filters"),0);var c=a.getAttribLocation(j,"a_position");a.bindBuffer(a.ARRAY_BUFFER,u),a.enableVertexAttribArray(c),a.vertexAttribPointer(c,2,a.FLOAT,!1,0,0);var d=a.getAttribLocation(j,"a_texCoord");a.bindBuffer(a.ARRAY_BUFFER,s),a.enableVertexAttribArray(d),a.vertexAttribPointer(d,2,a.FLOAT,!1,0,0),a.bindFramebuffer(a.FRAMEBUFFER,l),a.viewport(0,0,e,f*m),a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER),a.drawArrays(a.TRIANGLES,0,6*B);var g=da("raw");return g},this.getSobelResponses=function(b){if(X){ba(b),a.useProgram(M);var c=a.getAttribLocation(M,"a_position");a.bindBuffer(a.ARRAY_BUFFER,R),a.enableVertexAttribArray(c),a.vertexAttribPointer(c,2,a.FLOAT,!1,0,0);var d=a.getAttribLocation(M,"a_texCoord");a.bindBuffer(a.ARRAY_BUFFER,P),a.enableVertexAttribArray(d),a.vertexAttribPointer(d,2,a.FLOAT,!1,0,0),a.bindFramebuffer(a.FRAMEBUFFER,N),a.viewport(0,0,e,f*m),a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER),a.drawArrays(a.TRIANGLES,0,6*B),a.useProgram(j),a.uniform1i(a.getUniformLocation(j,"u_filters"),4),a.uniform1i(a.getUniformLocation(j,"u_patches"),3);var g=a.getAttribLocation(j,"a_position");a.bindBuffer(a.ARRAY_BUFFER,u),a.enableVertexAttribArray(g),a.vertexAttribPointer(g,2,a.FLOAT,!1,0,0);var h=a.getAttribLocation(j,"a_texCoord");a.bindBuffer(a.ARRAY_BUFFER,s),a.enableVertexAttribArray(h),a.vertexAttribPointer(h,2,a.FLOAT,!1,0,0),a.bindFramebuffer(a.FRAMEBUFFER,l),a.viewport(0,0,e,f*m),a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER),a.drawArrays(a.TRIANGLES,0,6*B);var i=da("sobel");return i}},this.getLBPResponses=function(b){if(W){ba(b),a.useProgram(H);var c=a.getAttribLocation(H,"a_position");a.bindBuffer(a.ARRAY_BUFFER,L),a.enableVertexAttribArray(c),a.vertexAttribPointer(c,2,a.FLOAT,!1,0,0);var d=a.getAttribLocation(H,"a_texCoord");a.bindBuffer(a.ARRAY_BUFFER,J),a.enableVertexAttribArray(d),a.vertexAttribPointer(d,2,a.FLOAT,!1,0,0),a.bindFramebuffer(a.FRAMEBUFFER,N),a.viewport(0,0,e,f*m),a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER),a.drawArrays(a.TRIANGLES,0,6*B),a.useProgram(j),a.uniform1i(a.getUniformLocation(j,"u_filters"),5),a.uniform1i(a.getUniformLocation(j,"u_patches"),3);var g=a.getAttribLocation(j,"a_position");a.bindBuffer(a.ARRAY_BUFFER,u),a.enableVertexAttribArray(g),a.vertexAttribPointer(g,2,a.FLOAT,!1,0,0);var h=a.getAttribLocation(j,"a_texCoord");a.bindBuffer(a.ARRAY_BUFFER,s),a.enableVertexAttribArray(h),a.vertexAttribPointer(h,2,a.FLOAT,!1,0,0),a.bindFramebuffer(a.FRAMEBUFFER,l),a.viewport(0,0,e,f*m),a.clearColor(0,0,0,1),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER),a.drawArrays(a.TRIANGLES,0,6*B);var i=da("lbp");return i}};var ba=function(b){for(var c=0,d=0,h=0,i=0;B>i;i++)for(var j=0;f>j;j++)for(var k=0;e>k;k++)d=4*i,h=j*e+k,c=4*(E*i+h),F[c]=g>d?b[d][h]:0,F[c+1]=g>d+1?b[d+1][h]:0,F[c+2]=g>d+2?b[d+2][h]:0,F[c+3]=g>d+3?b[d+3][h]:0;a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,n),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,C,D,0,a.RGBA,a.FLOAT,F),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST)},ca=function(b,e){for(var f=c*d,g=new Float32Array(f*m*4),h=0;m>h;h++)for(var i=0;d>i;i++)for(var j=0;c>j;j++)g[4*(f*h+i*c+j)]=4*hi;i++)f[i]=ia(f[i]);return f},ea=function(a,b){for(var c,d=0;dg;g++)g%e==0&&(0!=g&&c.push(f),f=[]),f.push(a[g]);return c.push(f),c},ga=function(){{var c=new Uint8Array(4*b.width*b.height);a.readPixels(0,0,b.width,b.height,a.RGBA,a.UNSIGNED_BYTE,c)}return c},ha=function(a){for(var b=[],c=a.length,d=0;c>d;d+=4)b[d/4>>0]=a[d]/4294967296+a[d+1]/16777216+a[d+2]/65536+a[d+3]/256;return b},ia=function(a){for(var b=a.length,c=0,d=1,e=0;b>e;e++)c=a[e]>c?a[e]:c,d=a[e]e;e++)a[e]=(a[e]-d)/f;return a}};!function(){var a=function(a){throw window.console&&(window.console.error?window.console.error(a):window.console.log&&window.console.log(a)),a},b=function(){return window!=window.top},c=function(a,b){if(!window.WebGLRenderingContext)return null;var c=d(a,b);return c?c:null},d=function(a,b){for(var c=["webgl","experimental-webgl"],d=null,e=0;e>2,q=0;g>q;q++)j=h[q],j>q&&(k=a[q],a[q]=a[j],a[j]=k,k=b[q],b[q]=b[j],b[j]=k);for(var r=1;g>r;r<<=1){e=0,d=g/(r<<1);for(var s=0;r>s;s++){l=i[e+p],m=c*i[e];for(var t=s;g>t;t+=r<<1)f=t+r,n=l*a[f]+m*b[f],o=l*b[f]-m*a[f],a[f]=a[t]-n,a[t]+=n,b[f]=b[t]-o,b[t]+=o;e+=d}}}function b(){h="undefined"!=typeof Uint8Array?new Uint8Array(g):new Array(g),"undefined"!=typeof Float64Array?(i=new Float64Array(1.25*g),e=new Float64Array(g),f=new Float64Array(g)):(i=new Array(1.25*g),e=new Array(g),f=new Array(g))}function c(){var a=0,b=0,c=0;for(h[0]=0;++a>1;b>=c;)b-=c,c>>=1;b+=c,h[a]=b}}function d(){var a=g>>1,b=g>>2,c=g>>3,d=a+b,e=Math.sin(Math.PI/g),f=2*e*e,h=Math.sqrt(f*(2-f)),j=i[b]=1,k=i[0]=0;e=2*f;for(var l=1;c>l;l++)j-=f,f+=e*j,k+=h,h-=e*k,i[l]=k,i[b-l]=j;0!==c&&(i[c]=Math.sqrt(.5));for(var m=0;b>m;m++)i[a-m]=i[m];for(var n=0;d>n;n++)i[n+a]=-i[n]}var e,f,g=0,h=null,i=null;this.init=function(a){if(0===a||0!==(a&a-1))throw new Error("init: radix-2 required");g=a,b(),c(),d()},this.fft1d=function(b,c){a(b,c,1)},this.ifft1d=function(b,c){var d=1/g;a(b,c,-1);for(var e=0;g>e;e++)b[e]*=d,c[e]*=d},this.fft2d=function(a,b){for(var c=0,d=0;g>d;d++){c=d*g;for(var h=0;g>h;h++)e[h]=a[h+c],f[h]=b[h+c];this.fft1d(e,f);for(var i=0;g>i;i++)a[i+c]=e[i],b[i+c]=f[i]}for(var j=0;g>j;j++){for(var k=0;g>k;k++)c=j+k*g,e[k]=a[c],f[k]=b[c];this.fft1d(e,f);for(var l=0;g>l;l++)c=j+l*g,a[c]=e[l],b[c]=f[l]}},this.ifft2d=function(a,b){for(var c=0,d=0;g>d;d++){c=d*g;for(var h=0;g>h;h++)e[h]=a[h+c],f[h]=b[h+c];this.ifft1d(e,f);for(var i=0;g>i;i++)a[i+c]=e[i],b[i+c]=f[i]}for(var j=0;g>j;j++){for(var k=0;g>k;k++)c=j+k*g,e[k]=a[c],f[k]=b[c];this.ifft1d(e,f);for(var l=0;g>l;l++)c=j+l*g,a[c]=e[l],b[c]=f[l]}},this.real_ifft2d=function(a,b){for(var c,d=0,h=0;g>h;h++){d=h*g;for(var i=0;g>i;i++)e[i]=a[i+d],f[i]=b[i+d];this.ifft1d(e,f);for(var j=0;g>j;j++)a[j+d]=e[j],b[j+d]=f[j]}for(var k=g/2,l=0,m=0;g>m;m+=2){d=m,c=m+1,e[0]=a[0+d],f[0]=a[0+c],e[g/2]=a[k*g+d],f[g/2]=a[k*g+c];for(var j=1;k>j;j++)l=j*g,e[j]=a[l+d]-b[l+c],e[g-j]=a[l+d]+b[l+c],f[j]=b[l+d]+a[l+c],f[g-j]=a[l+c]-b[l+d];this.ifft1d(e,f);for(var n=0;g>n;n++)d=m+n*g,c=m+1+n*g,a[d]=e[n],a[c]=f[n]}},this.real_fft2d=function(a,b){for(var c=0,d=0,h=0;g>h;h+=2){c=h*g,d=(h+1)*g;for(var i=0;g>i;i++)e[i]=a[i+c],f[i]=a[i+d];this.fft1d(e,f),a[0+c]=e[0],a[0+d]=f[0],b[0+c]=0,b[0+d]=0,a[g/2+c]=e[g/2],a[g/2+d]=f[g/2],b[g/2+c]=0,b[g/2+d]=0;for(var j=1;g/2>j;j++)a[j+c]=.5*(e[j]+e[g-j]),b[j+c]=.5*(f[j]-f[g-j]),a[j+d]=.5*(f[j]+f[g-j]),b[j+d]=-.5*(e[j]-e[g-j]),a[g-j+c]=a[j+c],b[g-j+c]=-b[j+c],a[g-j+d]=a[j+d],b[g-j+d]=-b[j+d]}for(var k=0;g>k;k++){for(var l=0;g>l;l++)c=k+l*g,e[l]=a[c],f[l]=b[c];this.fft1d(e,f);for(var m=0;g>m;m++)c=k+m*g,a[c]=e[m],b[c]=f[m]}}}var b,c,d,e,f,g,h,i,j,k,l;this.fft_inplace=function(a,c){"undefined"==typeof c&&(c=k);for(var d=0;g>d;d++)c[d]=0;return b.real_fft2d(a,c),[a,c]},this.ifft=function(a,c){return b.real_ifft2d(a,c),a};var m=function(a,b){for(var c,d,e=0;g>e;e++)c=a[0][e]*b[0][e]-a[1][e]*b[1][e],d=a[0][e]*b[1][e]+a[1][e]*b[0][e],a[0][e]=c,a[1][e]=d};this.init=function(m,n,o,q,r){f=p(q-1+r),g=f*f,b=new a,b.init(f),c=Array(o);for(var s,t=(q-1)/2,u=0;o>u;u++){for(var v,w,x=new Float64Array(g),y=new Float64Array(g),z=0;q>z;z++)for(var A=0;q>A;A++)v=t>A?f-t:-t,w=t>z?f-t:-t,x[A+v+(z+w)*f]=m[u][q-1-z+(q-1-A)*q];s=this.fft_inplace(x,y),c[u]=s}e=new Float64Array(o);for(var u=0;o>u;u++)e[u]=n[u];d=Array(o),k=Array(o);for(var u=0;o>u;u++)d[u]=new Float64Array(r*r),k[u]=new Float64Array(r*r);l=new Float64Array(g),j=o,h=q,i=r},this.getResponses=function(a){for(var b,g,k=h-1+i,p=0;j>p;p++){for(var r=0;f*f>r;r++)l[r]=0;a[p]=n(a[p]);for(var r=0;k>r;r++)for(var s=0;k>s;s++)l[r+f*s]=a[p][s+k*r];b=this.fft_inplace(l),m(b,c[p]),b=this.ifft(b[0],b[1]),g=(h-1)/2;for(var r=0;i>r;r++)for(var s=0;i>s;s++)d[p][r+s*i]=b[g+s+(r+g)*f];for(var r=0;i*i>r;r++)d[p][r]+=e[p];d[p]=o(d[p]),q(d[p])}return d};var n=function(a){for(var b,c=h-1+i,d=0,e=1e3,f=0;c>f;f++)for(var g=0;c>g;g++)b=a[g+c*f],e>b&&(e=b),b>d&&(d=b);for(var j=d-e,f=0;c>f;f++)for(var g=0;c>g;g++)a[g+c*f]=(a[g+c*f]-e)/j;return a},o=function(a){for(var b=0;i>b;b++)for(var c=0;i>c;c++)a[b+c*i]=1/(1+Math.exp(-(a[b+c*i]-1)));return a},p=function(a){return a--,a|=a>>1,a|=a>>2,a|=a>>4,a|=a>>8,a|=a>>16,a++,a},q=function(a){for(var b=a.length,c=0,d=1,e=0;b>e;e++)c=a[e]>c?a[e]:c,d=a[e]e;e++)a[e]=(a[e]-d)/f}},mosseFilterResponses=function(){var a=[],b=[],c=0;this.init=function(b,d,e,f){for(var g=0;d>g;g++){var h={};h.width=e,h.height=f;for(var i=e*f,j=new Float64Array(i),k=new Float64Array(i),l=0;i>l;l++)j[l]=b[g][0][l],k[l]=b[g][1][l];h.real=j,h.imag=k,a[g]=new mosseFilter,a[g].load(h)}c=d},this.getResponses=function(e){for(var f=0;c>f;f++)b[f]=a[f].getResponse(e[f]),b[f]=d(b[f]);return b};var d=function(a){for(var b=a.length,c=0,d=1,e=0;b>e;e++)c=a[e]>c?a[e]:c,d=a[e]e;e++)a[e]=(a[e]-d)/f;return a}},jsfeat_face=function(a,b,c){var d=a.width,e=a.height,f=Math.min(b/d,b/e),g=d*f|0,h=e*f|0,i=document.createElement("canvas");i.height=h,i.width=g;var j=i.getContext("2d");if(c)Worker.createURL=function(a){var b="function"==typeof a?a.toString():a,c=new Blob(["'use strict';\nself.onmessage ="+b],{type:"text/javascript"});return window.URL.createObjectURL(c)},Worker.create=function(a){return new Worker(Worker.createURL(a))};else var k=new jsfeat.matrix_t(g,h,jsfeat.U8_t|jsfeat.C1_t),l=new jsfeat.matrix_t(g,h,jsfeat.U8_t|jsfeat.C1_t),m=new Int32Array((g+1)*(h+1)),n=new Int32Array((g+1)*(h+1)),o=new Int32Array((g+1)*(h+1)),p=new Int32Array((g+1)*(h+1)),q=jsfeat.haar.frontalface;this.findFace=function(b,e){j.drawImage(a,0,0,i.width,i.height);var f=j.getImageData(0,0,i.width,i.height);if(!c){jsfeat.imgproc.grayscale(f.data,i.width,i.height,k),b.equalizeHistogram&&jsfeat.imgproc.equalize_histogram(k,k),jsfeat.imgproc.compute_integral_image(k,m,n,q.tilted?o:null),b.useCanny&&(jsfeat.imgproc.canny(k,l,10,50),jsfeat.imgproc.compute_integral_image(l,p,null,null)),jsfeat.haar.edgesDensity=b.edgesDensity;var g=jsfeat.haar.detect_multi_scale(m,n,o,b.useCanny?p:null,k.cols,k.rows,q,b.scaleFactor,b.minScale);g=jsfeat.haar.group_rectangles(g,1);var h=g.length;if(0==h)return!1;for(var r=g[0],s=1;h>s;s++)g[s].neighbors>r.neighbors?r=g[s]:g[s].neighbors==r.neighbors&&g[s].confidence>r.confidence&&(r=g[s]);var t=d/k.cols;return r.x=r.x*t|0,r.y=r.y*t|0,r.width=r.width*t|0,r.height=r.height*t|0,r}var u=Worker.create(findFaceWorker);u.addEventListener("message",function(a){this.faceDetected(a,e),u.terminate()}.bind(this),!1),u.postMessage({w:i.width,h:i.height,videoWidth:d,imageData:f,params:b})}},findFaceWorker=function(a){var b=self,c=c||{REVISION:"ALPHA"};!function(a){var b=1.192092896e-7,d=1e-37,e=256,f=512,g=1024,h=2048,i=4096,j=1,k=2,l=3,m=4,n=new Int32Array([-1,1,4,-1,4,-1,-1,-1,8,-1,-1,-1,-1,-1,-1,-1,8]),o=function(){return function(a){return 65280&a}}(),p=function(){return function(a){return 255&a}}(),q=function(){return function(a){return n[(65280&a)>>8]}}(),r=0,s=1,t=2,u=3,v=1,w=1,x=2,y=function(){function a(a,b){this.size=-8&(a+7|0),"undefined"==typeof b?this.buffer=new ArrayBuffer(this.size):(this.buffer=b,this.size=b.length),this.u8=new Uint8Array(this.buffer),this.i32=new Int32Array(this.buffer),this.f32=new Float32Array(this.buffer),this.f64=new Float64Array(this.buffer)}return a}(),z=function(){function a(a,b,c,d){this.type=0|o(c),this.channel=0|p(c),this.cols=0|a,this.rows=0|b,"undefined"==typeof d?this.allocate():(this.buffer=d,this.data=this.type&e?this.buffer.u8:this.type&f?this.buffer.i32:this.type&g?this.buffer.f32:this.buffer.f64)}return a.prototype.allocate=function(){delete this.data,delete this.buffer,this.buffer=new y(this.cols*q(this.type)*this.channel*this.rows),this.data=this.type&e?this.buffer.u8:this.type&f?this.buffer.i32:this.type&g?this.buffer.f32:this.buffer.f64},a.prototype.copy_to=function(a){for(var b=a.data,c=this.data,d=0,e=this.cols*this.rows*this.channel|0;e-4>d;d+=4)b[d]=c[d],b[d+1]=c[d+1],b[d+2]=c[d+2],b[d+3]=c[d+3];for(;e>d;++d)b[d]=c[d]},a.prototype.resize=function(a,b,c){"undefined"==typeof c&&(c=this.channel);var d=a*q(this.type)*c*b;d>this.buffer.size?(this.cols=a,this.rows=b,this.channel=c,this.allocate()):(this.cols=a,this.rows=b,this.channel=c)},a}(),A=function(){function a(a){this.levels=0|a,this.data=new Array(a),this.pyrdown=c.imgproc.pyrdown}return a.prototype.allocate=function(a,b,c){for(var d=this.levels;--d>=0;)this.data[d]=new z(a>>d,b>>d,c)},a.prototype.build=function(a,b){"undefined"==typeof b&&(b=!0);var c=2,d=a,e=this.data[0];if(!b)for(var f=a.cols*a.rows;--f>=0;)e.data[f]=a.data[f];for(e=this.data[1],this.pyrdown(d,e);cg;++g){var h=new d(f);b=b.next=h,e++}},get_buffer:function(b){var c=a;return a=a.next,e--,b>c.size&&c.resize(b),c},put_buffer:function(a){b=b.next=a,e++}}}();a.cache=b,b.allocate(30,2560)}(c),function(a){var b=function(){var a=new Int32Array(96);return{get_gaussian_kernel:function(a,b,d,e){var f=0,g=0,h=0,i=0,j=0,k=0,l=c.cache.get_buffer(a<<2),m=l.f32;if(1==(1&a)&&7>=a&&0>=b)switch(a>>1){case 0:m[0]=1,k=1;break;case 1:m[0]=.25,m[1]=.5,m[2]=.25,k=1;break;case 2:m[0]=.0625,m[1]=.25,m[2]=.375,m[3]=.25,m[4]=.0625,k=1;break;case 3:m[0]=.03125,m[1]=.109375,m[2]=.21875,m[3]=.28125,m[4]=.21875,m[5]=.109375,m[6]=.03125,k=1}else for(i=b>0?b:.3*(.5*(a-1)-1)+.8,j=-.5/(i*i);a>f;++f)g=f-.5*(a-1),h=Math.exp(j*g*g),m[f]=h,k+=h;if(e&c.U8_t)for(k=256/k,f=0;a>f;++f)d[f]=m[f]*k+.5|0;else for(k=1/k,f=0;a>f;++f)d[f]=m[f]*k;c.cache.put_buffer(l)},perspective_4point_transform:function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){var r=b,s=j,t=g,u=r*s*t,v=o,w=r*v,x=s*w,y=k,z=r*y,A=f,B=c,C=n,D=B*C,E=D*A,F=C*A*y,G=C*t,H=C*y,I=s*t,J=v*s,K=v*A,L=y*A,M=1/(G-H-I+J-K+L),N=r*C,O=B*A,P=t*r,Q=v*P,R=B*s,S=D*y,T=B*y*A,U=t*v*s,V=v*B,W=-(x-u+z*A-A*w-D*s+E-F+G*s)*M,X=(u-x-N*t+N*y+E-s*O+K*s-F)*M,Y=r,Z=(-y*w+Q+R*t-D*t+S-T+K*y-U)*M,$=(-Q+P*y-V*s+S-T+V*A+U-G*y)*M,_=B,aa=(-z+P+R-O+H-G-J+K)*M,ba=(-w+z+D-R+K-L-G+I)*M;r=d,s=l,t=i,u=r*s*t,v=q,w=r*v,x=s*w,y=m,z=r*y,A=h,B=e,C=p,D=B*C,E=D*A,F=C*A*y,G=C*t,H=C*y,I=s*t,J=v*s,K=v*A,L=y*A,M=1/(G-H-I+J-K+L),N=r*C,O=B*A,P=t*r,Q=v*P,R=B*s,S=D*y,T=B*y*A,U=t*v*s,V=v*B;var ca=-(x-u+z*A-A*w-D*s+E-F+G*s)*M,da=(u-x-N*t+N*y+E-s*O+K*s-F)*M,ea=r,fa=(-y*w+Q+R*t-D*t+S-T+K*y-U)*M,ga=(-Q+P*y-V*s+S-T+V*A+U-G*y)*M,ha=B,ia=(-z+P+R-O+H-G-J+K)*M,ja=(-w+z+D-R+K-L-G+I)*M;s=$-ba*_,t=W*$,u=W*_,w=Z*X,x=Y*Z,z=X*aa;var ka=Y*aa;C=1/(t-u*ba-w+x*ba+z*_-ka*$),E=-Z+_*aa;var la=-Z*ba+$*aa;L=-X+Y*ba;var ma=W-ka;O=W*ba-z,P=-X*_+Y*$;var na=u-x,oa=t-w;T=s*C;var pa=L*C,qa=P*C,ra=a.data;ra[0]=ca*T+da*E*C-ea*la*C,ra[1]=ca*pa+da*ma*C-ea*O*C,ra[2]=-ca*qa-da*na*C+ea*oa*C,ra[3]=fa*T+ga*E*C-ha*la*C,ra[4]=fa*pa+ga*ma*C-ha*O*C,ra[5]=-fa*qa-ga*na*C+ha*oa*C,ra[6]=ia*T+ja*E*C-la*C,ra[7]=ia*pa+ja*ma*C-O*C,ra[8]=-ia*qa-ja*na*C+oa*C},qsort:function(b,c,d,e){var f,g,h,i,j=7,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=a;if(!(1>=d-c+1))for(C[0]=c,C[1]=d;k>=0;)for(l=C[k<<1],m=C[(k<<1)+1],k--;;){if(o=m-l+1,j>=o){for(q=l+1;m>=q;q++)for(r=q;r>l&&e(b[r],b[r-1]);r--)f=b[r],b[r]=b[r-1],b[r-1]=f;break}for(B=0,t=l,v=m,x=l+(o>>1),o>40&&(s=o>>3,y=l,z=l+s,A=l+(s<<1),g=b[y],h=b[z],i=b[A],l=e(g,h)?e(h,i)?z:e(g,i)?A:y:e(i,h)?z:e(g,i)?y:A,y=x-s,z=x,A=x+s,g=b[y],h=b[z],i=b[A],x=e(g,h)?e(h,i)?z:e(g,i)?A:y:e(i,h)?z:e(g,i)?y:A,y=m-(s<<1),z=m-s,A=m,g=b[y],h=b[z],i=b[A],m=e(g,h)?e(h,i)?z:e(g,i)?A:y:e(i,h)?z:e(g,i)?y:A),y=l,z=x,A=m,g=b[y],h=b[z],i=b[A],x=e(g,h)?e(h,i)?z:e(g,i)?A:y:e(i,h)?z:e(g,i)?y:A,x!=t&&(f=b[x],b[x]=b[t],b[t]=f,x=t),l=u=t+1,m=w=v,g=b[x];;){for(;m>=l&&!e(g,b[l]);)e(b[l],g)||(l>u&&(f=b[u],b[u]=b[l],b[l]=f),B=1,u++),l++;for(;m>=l&&!e(b[m],g);)e(g,b[m])||(w>m&&(f=b[w],b[w]=b[m],b[m]=f),B=1,w--),m--;if(l>m)break;f=b[l],b[l]=b[m],b[m]=f,B=1,l++,m--}if(0==B){for(l=t,m=v,q=l+1;m>=q;q++)for(r=q;r>l&&e(b[r],b[r-1]);r--)f=b[r],b[r]=b[r-1],b[r-1]=f;break}for(o=Math.min(u-t,l-u),p=l-o|0,n=0;o>n;++n,++p)f=b[t+n],b[t+n]=b[p],b[p]=f;for(o=Math.min(v-w,w-m),p=v-o+1|0,n=0;o>n;++n,++p)f=b[l+n],b[l+n]=b[p],b[p]=f;if(o=l-u,p=w-m,o>1)p>1?o>p?(++k,C[k<<1]=t,C[(k<<1)+1]=t+o-1,l=v-p+1,m=v):(++k,C[k<<1]=v-p+1,C[(k<<1)+1]=v,l=t,m=t+o-1):(l=t,m=t+o-1);else{if(!(p>1))break;l=v-p+1,m=v}}},median:function(a,b,c){for(var d,e=0,f=0,g=0,h=b+c>>1;;){if(b>=c)return a[h];if(c==b+1)return a[b]>a[c]&&(d=a[b],a[b]=a[c],a[c]=d),a[h];for(e=b+c>>1,a[e]>a[c]&&(d=a[e],a[e]=a[c],a[c]=d),a[b]>a[c]&&(d=a[b],a[b]=a[c],a[c]=d),a[e]>a[b]&&(d=a[e],a[e]=a[b],a[b]=d),f=b+1,d=a[e],a[e]=a[f],a[f]=d,g=c;;){do++f;while(a[b]>a[f]);do--g;while(a[g]>a[b]);if(f>g)break;d=a[f],a[f]=a[g],a[g]=d}d=a[b],a[b]=a[g],a[g]=d,h>=g?b=f:g>=h&&(c=g-1)}return 0}}}();a.math=b}(c),function(a){var b=function(){return{identity:function(a,b){"undefined"==typeof b&&(b=1);for(var c=a.data,d=a.rows,e=a.cols,f=e+1|0,g=d*e,h=g;--g>=0;)c[g]=0;for(g=h,h=0;g>h;)c[h]=b,h+=f},transpose:function(a,b){for(var c=0,d=0,e=b.rows,f=b.cols,g=0,h=0,i=0,j=b.data,k=a.data;e>c;h+=1,g+=f,c++)for(i=h,d=0;f>d;i+=e,d++)k[i]=j[g+d]},multiply:function(a,b,c){for(var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=b.cols,m=b.rows,n=c.cols,o=b.data,p=c.data,q=a.data,r=0;m>d;g+=l,d++)for(j=0,e=0;n>e;k++,j++,e++){for(i=j,h=g,r=0,f=0;l>f;h++,i+=n,f++)r+=o[h]*p[i];q[k]=r}},multiply_ABt:function(a,b,c){for(var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=b.cols,l=b.rows,m=c.rows,n=b.data,o=c.data,p=a.data,q=0;l>d;g+=k,d++)for(i=0,e=0;m>e;j++,e++){for(h=g,q=0,f=0;k>f;h++,i++,f++)q+=n[h]*o[i];p[j]=q}},multiply_AtB:function(a,b,c){for(var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=b.cols,m=b.rows,n=c.cols,o=b.data,p=c.data,q=a.data,r=0;l>d;g++,d++)for(j=0,e=0;n>e;k++,j++,e++){for(i=j,h=g,r=0,f=0;m>f;h+=l,i+=n,f++)r+=o[h]*p[i];q[k]=r}},multiply_AAt:function(a,b){for(var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=b.cols,m=b.rows,n=b.data,o=a.data,p=0;m>c;f+=m+1,g=h,c++)for(j=f,k=f,i=g,d=c;m>d;j++,k+=m,d++){for(h=g,p=0,e=0;l>e;e++)p+=n[h++]*n[i++];o[j]=p,o[k]=p}},multiply_AtA:function(a,b){for(var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=b.cols,m=b.rows,n=b.data,o=a.data,p=0;l>c;i+=l,c++)for(f=c,k=i+c,j=k,d=c;l>d;j++,k+=l,d++){for(g=f,h=d,p=0,e=0;m>e;g+=l,h+=l,e++)p+=n[g]*n[h];o[j]=p,o[k]=p}},identity_3x3:function(a,b){"undefined"==typeof b&&(b=1);var c=a.data;c[0]=c[4]=c[8]=b,c[1]=c[2]=c[3]=0,c[5]=c[6]=c[7]=0},invert_3x3:function(a,b){var c=a.data,d=b.data,e=c[4],f=c[8],g=c[5],h=c[7],i=c[0],j=i*e,k=i*g,l=c[3],m=c[1],n=l*m,o=c[2],p=l*o,q=c[6],r=q*m,s=q*o,t=1/(j*f-k*h-n*f+p*h+r*g-s*e);d[0]=(e*f-g*h)*t,d[1]=-(m*f-o*h)*t,d[2]=-(-m*g+o*e)*t,d[3]=-(l*f-g*q)*t,d[4]=(i*f-s)*t,d[5]=-(k-p)*t,d[6]=-(-l*h+e*q)*t,d[7]=-(i*h-r)*t,d[8]=(j-n)*t},multiply_3x3:function(a,b,c){var d=a.data,e=b.data,f=c.data,g=e[0],h=e[1],i=e[2],j=e[3],k=e[4],l=e[5],m=e[6],n=e[7],o=e[8],p=f[0],q=f[1],r=f[2],s=f[3],t=f[4],u=f[5],v=f[6],w=f[7],x=f[8];d[0]=g*p+h*s+i*v,d[1]=g*q+h*t+i*w,d[2]=g*r+h*u+i*x,d[3]=j*p+k*s+l*v,d[4]=j*q+k*t+l*w,d[5]=j*r+k*u+l*x,d[6]=m*p+n*s+o*v,d[7]=m*q+n*t+o*w,d[8]=m*r+n*u+o*x},mat3x3_determinant:function(a){var b=a.data;return b[0]*b[4]*b[8]-b[0]*b[5]*b[7]-b[3]*b[1]*b[8]+b[3]*b[2]*b[7]+b[6]*b[1]*b[5]-b[6]*b[2]*b[4]},determinant_3x3:function(a,b,c,d,e,f,g,h,i){return a*e*i-a*f*h-d*b*i+d*c*h+g*b*f-g*c*e}}}();a.matmath=b}(c),function(a){var b=function(){var a=function(a,b,c,d){d=a[b],a[b]=a[c],a[c]=d},b=function(a,b){return a=Math.abs(a),b=Math.abs(b),a>b?(b/=a,a*Math.sqrt(1+b*b)):b>0?(a/=b,b*Math.sqrt(1+a*a)):0},d=function(d,e,f,g,h,i){var j=c.EPSILON,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=i*i*30,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=c.cache.get_buffer(i<<2),E=c.cache.get_buffer(i<<2),F=D.i32,G=E.i32;if(g)for(;i>k;k++){for(m=k*h,l=0;i>l;l++)g[m+l]=0;g[m+k]=1}for(m=0;i>m;m++){if(f[m]=d[(e+1)*m],i-1>m){for(n=m+1,u=Math.abs(d[e*m+n]),k=m+2;i>k;k++)v=Math.abs(d[e*m+k]),v>u&&(u=v,n=k);F[m]=n}if(m>0){for(n=0,u=Math.abs(d[m]),k=1;m>k;k++)v=Math.abs(d[e*k+m]),v>u&&(u=v,n=k);G[m]=n}}if(i>1)for(;t>s;s++){for(m=0,u=Math.abs(d[F[0]]),k=1;i-1>k;k++)v=Math.abs(d[e*k+F[k]]),v>u&&(u=v,m=k);for(o=F[m],k=1;i>k;k++)v=Math.abs(d[e*G[k]+k]),v>u&&(u=v,m=G[k],o=k);if(w=d[e*m+o],Math.abs(w)<=j)break;for(x=.5*(f[o]-f[m]),y=Math.abs(x)+b(w,x),z=b(w,y),A=y/z,z=w/z,y=w/y*w,0>x&&(z=-z,y=-y),d[e*m+o]=0,f[m]-=y,f[o]+=y,k=0;m>k;k++)q=e*k+m,r=e*k+o,B=d[q],C=d[r],d[q]=B*A-C*z,d[r]=B*z+C*A;for(k=m+1;o>k;k++)q=e*m+k,r=e*k+o,B=d[q],C=d[r],d[q]=B*A-C*z,d[r]=B*z+C*A;for(k=o+1,q=e*m+k,r=e*o+k;i>k;k++,q++,r++)B=d[q],C=d[r],d[q]=B*A-C*z,d[r]=B*z+C*A;if(g)for(q=h*m,r=h*o,k=0;i>k;k++,q++,r++)B=g[q],C=g[r],g[q]=B*A-C*z,g[r]=B*z+C*A;for(l=0;2>l;l++){if(p=0==l?m:o,i-1>p){for(n=p+1,u=Math.abs(d[e*p+n]),k=p+2;i>k;k++)v=Math.abs(d[e*p+k]),v>u&&(u=v,n=k);F[p]=n}if(p>0){for(n=0,u=Math.abs(d[p]),k=1;p>k;k++)v=Math.abs(d[e*k+p]),v>u&&(u=v,n=k);G[p]=n}}}for(m=0;i-1>m;m++){for(n=m,k=m+1;i>k;k++)f[n]k;k++)a(g,h*n+k,h*m+k,u)}c.cache.put_buffer(D),c.cache.put_buffer(E)},e=function(d,e,f,g,h,i,j,k){for(var l=2*c.EPSILON,m=c.FLT_MIN,n=0,o=0,p=0,q=0,r=Math.max(i,30),s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=4660,K=0,L=0,M=0,N=c.cache.get_buffer(j<<3),O=N.f64;j>n;n++){for(p=0,C=0;i>p;p++)z=d[n*e+p],C+=z*z;if(O[n]=C,g){for(p=0;j>p;p++)g[n*h+p]=0;g[n*h+n]=1}}for(;r>q;q++){for(w=0,n=0;j-1>n;n++)for(o=n+1;j>o;o++){for(s=n*e|0,t=o*e|0,G=O[n],H=0,I=O[o],p=2,H+=d[s]*d[t],H+=d[s+1]*d[t+1];i>p;p++)H+=d[s+p]*d[t+p];if(!(Math.abs(H)<=l*Math.sqrt(G*I))){for(H*=2,D=G-I,E=b(H,D),0>D?(F=.5*(E-D),y=Math.sqrt(F/E),x=H/(E*y*2)):(x=Math.sqrt((E+D)/(2*E)),y=H/(E*x*2)),G=0,I=0,p=2,A=x*d[s]+y*d[t],B=-y*d[s]+x*d[t],d[s]=A,d[t]=B,G+=A*A,I+=B*B,A=x*d[s+1]+y*d[t+1],B=-y*d[s+1]+x*d[t+1],d[s+1]=A,d[t+1]=B,G+=A*A,I+=B*B;i>p;p++)A=x*d[s+p]+y*d[t+p],B=-y*d[s+p]+x*d[t+p],d[s+p]=A,d[t+p]=B,G+=A*A,I+=B*B;if(O[n]=G,O[o]=I,w=1,g)for(u=n*h|0,v=o*h|0,p=2,A=x*g[u]+y*g[v],B=-y*g[u]+x*g[v],g[u]=A,g[v]=B,A=x*g[u+1]+y*g[v+1],B=-y*g[u+1]+x*g[v+1],g[u+1]=A,g[v+1]=B;j>p;p++)A=x*g[u+p]+y*g[v+p],B=-y*g[u+p]+x*g[v+p],g[u+p]=A,g[v+p]=B}}if(0==w)break}for(n=0;j>n;n++){for(p=0,C=0;i>p;p++)z=d[n*e+p],C+=z*z;O[n]=Math.sqrt(C)}for(n=0;j-1>n;n++){for(o=n,p=n+1;j>p;p++)O[o]p;p++)a(d,n*e+p,o*e+p,z);for(p=0;j>p;p++)a(g,n*h+p,o*h+p,z)}}for(n=0;j>n;n++)f[n]=O[n];if(!g)return void c.cache.put_buffer(N);for(n=0;k>n;n++){for(C=j>n?O[n]:0;m>=C;){for(L=1/i,p=0;i>p;p++)J=214013*J+2531011,K=0!=(J>>16&32767&256)?L:-L,d[n*e+p]=K;for(q=0;2>q;q++)for(o=0;n>o;o++){for(C=0,p=0;i>p;p++)C+=d[n*e+p]*d[o*e+p];for(M=0,p=0;i>p;p++)z=d[n*e+p]-C*d[o*e+p],d[n*e+p]=z,M+=Math.abs(z);for(M=M?1/M:0,p=0;i>p;p++)d[n*e+p]*=M}for(C=0,p=0;i>p;p++)z=d[n*e+p],C+=z*z;C=Math.sqrt(C)}for(y=1/C,p=0;i>p;p++)d[n*e+p]*=y}c.cache.put_buffer(N)};return{lu_solve:function(b,d){var e,f,g,h,i=0,j=0,k=0,l=1,m=b.cols,n=b.data,o=d.data;for(i=0;m>i;i++){for(k=i,j=i+1;m>j;j++)Math.abs(n[j*m+i])>Math.abs(n[k*m+i])&&(k=j);if(Math.abs(n[k*m+i])j;j++)a(n,i*m+j,k*m+j,e);a(o,i,k,e),l=-l}for(g=-1/n[i*m+i],j=i+1;m>j;j++){for(f=n[j*m+i]*g,k=i+1;m>k;k++)n[j*m+k]+=f*n[i*m+k];o[j]+=f*o[i]}n[i*m+i]=-g}for(i=m-1;i>=0;i--){for(h=o[i],k=i+1;m>k;k++)h-=n[i*m+k]*o[k];o[i]=h*n[i*m+i]}return 1},cholesky_solve:function(a,b){var c,d,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=a.cols,m=a.data,n=b.data;for(e=0;l>e;e++)for(d=1,h=e*l,i=h,f=e;l>f;f++){for(c=m[i+e],g=0;e>g;g++)c-=m[g*l+e]*m[i+g];if(f==e){if(m[i+e]=c,0==c)return 0;d=1/c}else m[h+f]=c,m[i+e]=c*d;i+=l}for(h=0,j=0;l>j;j++){for(c=n[j],k=0;j>k;k++)c-=m[h+k]*n[k];n[j]=c,h+=l}for(h=0,j=0;l>j;j++)n[j]/=m[h+j],h+=l;for(j=l-1;j>=0;j--){for(c=n[j],k=j+1,h=k*l;l>k;k++)c-=m[h+j]*n[k],h+=l;n[j]=c}return 1},svd_decompose:function(a,b,d,f,g){"undefined"==typeof g&&(g=0);var h=0,i=0,j=a.rows,k=a.cols,l=j,m=k,n=a.type|c.C1_t;m>l&&(h=1,i=l,l=m,m=i);var o=c.cache.get_buffer(l*l<<3),p=c.cache.get_buffer(m<<3),q=c.cache.get_buffer(m*m<<3),r=new c.matrix_t(l,l,n,o.data),s=new c.matrix_t(1,m,n,p.data),t=new c.matrix_t(m,m,n,q.data);if(0==h)c.matmath.transpose(r,a);else{for(i=0;k*j>i;i++)r.data[i]=a.data[i];for(;m*l>i;i++)r.data[i]=0}if(e(r.data,l,s.data,t.data,m,l,m,l),b){for(i=0;m>i;i++)b.data[i]=s.data[i];for(;k>i;i++)b.data[i]=0}if(0==h){if(d&&g&c.SVD_U_T)for(i=l*l;--i>=0;)d.data[i]=r.data[i];else d&&c.matmath.transpose(d,r);if(f&&g&c.SVD_V_T)for(i=m*m;--i>=0;)f.data[i]=t.data[i];else f&&c.matmath.transpose(f,t)}else{if(d&&g&c.SVD_U_T)for(i=m*m;--i>=0;)d.data[i]=t.data[i];else d&&c.matmath.transpose(d,t);if(f&&g&c.SVD_V_T)for(i=l*l;--i>=0;)f.data[i]=r.data[i];else f&&c.matmath.transpose(f,r)}c.cache.put_buffer(o),c.cache.put_buffer(p),c.cache.put_buffer(q)},svd_solve:function(a,b,d){var e=0,f=0,g=0,h=0,i=0,j=a.rows,k=a.cols,l=0,m=0,n=0,o=a.type|c.C1_t,p=c.cache.get_buffer(j*j<<3),q=c.cache.get_buffer(k<<3),r=c.cache.get_buffer(k*k<<3),s=new c.matrix_t(j,j,o,p.data),t=new c.matrix_t(1,k,o,q.data),u=new c.matrix_t(k,k,o,r.data),v=d.data,w=s.data,x=t.data,y=u.data;for(this.svd_decompose(a,t,s,u,0),n=c.EPSILON*x[0]*k;k>e;e++,i+=k){for(m=0,f=0;k>f;f++)if(x[f]>n){for(g=0,l=0,h=0;j>g;g++,h+=k)l+=w[h+f]*v[g];m+=l*y[i+f]/x[f]}b.data[e]=m}c.cache.put_buffer(p),c.cache.put_buffer(q),c.cache.put_buffer(r)},svd_invert:function(a,b){var d=0,e=0,f=0,g=0,h=0,i=0,j=b.rows,k=b.cols,l=0,m=0,n=b.type|c.C1_t,o=c.cache.get_buffer(j*j<<3),p=c.cache.get_buffer(k<<3),q=c.cache.get_buffer(k*k<<3),r=new c.matrix_t(j,j,n,o.data),s=new c.matrix_t(1,k,n,p.data),t=new c.matrix_t(k,k,n,q.data),u=a.data,v=r.data,w=s.data,x=t.data;for(this.svd_decompose(b,s,r,t,0),m=c.EPSILON*w[0]*k;k>d;d++, h+=k)for(e=0,g=0;j>e;e++,i++){for(f=0,l=0;k>f;f++,g++)w[f]>m&&(l+=x[h+f]*v[g]/w[f]);u[i]=l}c.cache.put_buffer(o),c.cache.put_buffer(p),c.cache.put_buffer(q)},eigenVV:function(a,b,e){for(var f=a.cols,g=f*f,h=a.type|c.C1_t,i=c.cache.get_buffer(f*f<<3),j=c.cache.get_buffer(f<<3),k=new c.matrix_t(f,f,h,i.data),l=new c.matrix_t(1,f,h,j.data);--g>=0;)k.data[g]=a.data[g];if(d(k.data,f,l.data,b?b.data:null,f,f),e)for(;--f>=0;)e.data[f]=l.data[f];c.cache.put_buffer(i),c.cache.put_buffer(j)}}}();a.linalg=b}(c),function(a){var b=function(){var a=function(a){return a*a},b=function(a,b,c,d,e){for(var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e>f;++f)g+=a[f].x,h+=a[f].y,k+=b[f].x,l+=b[f].y;for(g/=e,h/=e,k/=e,l/=e,f=0;e>f;++f)o=a[f].x-g,p=a[f].y-h,i+=Math.sqrt(o*o+p*p),o=b[f].x-k,p=b[f].y-l,m+=Math.sqrt(o*o+p*p);i/=e,m/=e,j=Math.SQRT2/i,n=Math.SQRT2/m,c[0]=c[4]=j,c[2]=-g*j,c[5]=-h*j,c[1]=c[3]=c[6]=c[7]=0,c[8]=1,d[0]=d[4]=n,d[2]=-k*n,d[5]=-l*n,d[1]=d[3]=d[6]=d[7]=0,d[8]=1},d=new c.matrix_t(3,3,c.F32_t|c.C1_t),e=new c.matrix_t(3,3,c.F32_t|c.C1_t),f=new c.matrix_t(6,6,c.F32_t|c.C1_t),g=new c.matrix_t(6,1,c.F32_t|c.C1_t),h=function(){function h(){}return h.prototype.run=function(a,h,i,j){var k,l,m=0,n=0,o=i.type|c.C1_t,p=i.data,q=d.data,r=e.data,s=0,t=0;b(a,h,q,r,j);for(var u=c.cache.get_buffer(2*j*6<<3),v=c.cache.get_buffer(2*j<<3),w=new c.matrix_t(6,2*j,o,u.data),x=new c.matrix_t(1,2*j,o,v.data),y=w.data,z=x.data;j>m;++m)k=a[m],l=h[m],s=q[0]*k.x+q[1]*k.y+q[2],t=q[3]*k.x+q[4]*k.y+q[5],n=2*m*6,y[n]=s,y[n+1]=t,y[n+2]=1,y[n+3]=0,y[n+4]=0,y[n+5]=0,n+=6,y[n]=0,y[n+1]=0,y[n+2]=0,y[n+3]=s,y[n+4]=t,y[n+5]=1,z[m<<1]=r[0]*l.x+r[1]*l.y+r[2],z[(m<<1)+1]=r[3]*l.x+r[4]*l.y+r[5];return c.matmath.multiply_AtA(f,w),c.matmath.multiply_AtB(g,w,x),c.linalg.lu_solve(f,g),p[0]=g.data[0],p[1]=g.data[1],p[2]=g.data[2],p[3]=g.data[3],p[4]=g.data[4],p[5]=g.data[5],p[6]=0,p[7]=0,p[8]=1,c.matmath.invert_3x3(e,e),c.matmath.multiply_3x3(i,e,i),c.matmath.multiply_3x3(i,i,d),c.cache.put_buffer(u),c.cache.put_buffer(v),1},h.prototype.error=function(b,c,d,e,f){for(var g,h,i=0,j=d.data;f>i;++i)g=b[i],h=c[i],e[i]=a(h.x-j[0]*g.x-j[1]*g.y-j[2])+a(h.y-j[3]*g.x-j[4]*g.y-j[5])},h.prototype.check_subset=function(){return!0},h}(),i=new c.matrix_t(9,9,c.F32_t|c.C1_t),j=new c.matrix_t(9,9,c.F32_t|c.C1_t),k=function(){function a(){}return a.prototype.run=function(a,b,f,g){for(var h=0,k=0,l=f.data,m=d.data,n=e.data,o=i.data,p=j.data,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;g>h;++h)w+=b[h].x,x+=b[h].y,A+=a[h].x,B+=a[h].y;for(w/=g,x/=g,A/=g,B/=g,h=0;g>h;++h)u+=Math.abs(b[h].x-w),v+=Math.abs(b[h].y-x),y+=Math.abs(a[h].x-A),z+=Math.abs(a[h].y-B);if(Math.abs(u)=0;)o[h]=0;for(h=0;g>h;++h)q=(b[h].x-w)*u,r=(b[h].y-x)*v,s=(a[h].x-A)*y,t=(a[h].y-B)*z,o[0]+=s*s,o[1]+=s*t,o[2]+=s,o[6]+=s*-q*s,o[7]+=s*-q*t,o[8]+=s*-q,o[10]+=t*t,o[11]+=t,o[15]+=t*-q*s,o[16]+=t*-q*t,o[17]+=t*-q,o[20]+=1,o[24]+=-q*s,o[25]+=-q*t,o[26]+=-q,o[30]+=s*s,o[31]+=s*t,o[32]+=s,o[33]+=s*-r*s,o[34]+=s*-r*t,o[35]+=s*-r,o[40]+=t*t,o[41]+=t,o[42]+=t*-r*s,o[43]+=t*-r*t,o[44]+=t*-r,o[50]+=1,o[51]+=-r*s,o[52]+=-r*t,o[53]+=-r,o[60]+=-q*s*-q*s+-r*s*-r*s,o[61]+=-q*s*-q*t+-r*s*-r*t,o[62]+=-q*s*-q+-r*s*-r,o[70]+=-q*t*-q*t+-r*t*-r*t,o[71]+=-q*t*-q+-r*t*-r,o[80]+=-q*-q+-r*-r;for(h=0;9>h;++h)for(k=0;h>k;++k)o[9*h+k]=o[9*k+h];return c.linalg.eigenVV(i,j),l[0]=p[72],l[1]=p[73],l[2]=p[74],l[3]=p[75],l[4]=p[76],l[5]=p[77],l[6]=p[78],l[7]=p[79],l[8]=p[80],c.matmath.multiply_3x3(f,e,f),c.matmath.multiply_3x3(f,f,d),q=1/l[8],l[0]*=q,l[1]*=q,l[2]*=q,l[3]*=q,l[4]*=q,l[5]*=q,l[6]*=q,l[7]*=q,l[8]=1,1},a.prototype.error=function(a,b,c,d,e){for(var f,g,h=0,i=0,j=0,k=0,l=c.data;e>h;++h)f=a[h],g=b[h],i=1/(l[6]*f.x+l[7]*f.y+1),j=(l[0]*f.x+l[1]*f.y+l[2])*i-g.x,k=(l[3]*f.x+l[4]*f.y+l[5])*i-g.y,d[h]=j*j+k*k},a.prototype.check_subset=function(a,b,d){if(4==d){var e=0,f=a[0],g=a[1],h=a[2],i=a[3],j=b[0],k=b[1],l=b[2],m=b[3],n=f.x,o=f.y,p=1,q=g.x,r=g.y,s=1,t=h.x,u=h.y,v=1,w=j.x,x=j.y,y=1,z=k.x,A=k.y,B=1,C=l.x,D=l.y,E=1,F=c.matmath.determinant_3x3(n,o,p,q,r,s,t,u,v),G=c.matmath.determinant_3x3(w,x,y,z,A,B,C,D,E);if(0>F*G&&e++,n=g.x,o=g.y,q=h.x,r=h.y,t=i.x,u=i.y,w=k.x,x=k.y,z=l.x,A=l.y,C=m.x,D=m.y,F=c.matmath.determinant_3x3(n,o,p,q,r,s,t,u,v),G=c.matmath.determinant_3x3(w,x,y,z,A,B,C,D,E),0>F*G&&e++,n=f.x,o=f.y,q=h.x,r=h.y,t=i.x,u=i.y,w=j.x,x=j.y,z=l.x,A=l.y,C=m.x,D=m.y,F=c.matmath.determinant_3x3(n,o,p,q,r,s,t,u,v),G=c.matmath.determinant_3x3(w,x,y,z,A,B,C,D,E),0>F*G&&e++,n=f.x,o=f.y,q=g.x,r=g.y,t=i.x,u=i.y,w=j.x,x=j.y,z=k.x,A=k.y,C=m.x,D=m.y,F=c.matmath.determinant_3x3(n,o,p,q,r,s,t,u,v),G=c.matmath.determinant_3x3(w,x,y,z,A,B,C,D,E),0>F*G&&e++,0!=e&&4!=e)return!1}return!0},a}();return{affine2d:h,homography2d:k}}(),d=function(){function a(a,b,c,d){"undefined"==typeof a&&(a=0),"undefined"==typeof b&&(b=.5),"undefined"==typeof c&&(c=.5),"undefined"==typeof d&&(d=.99),this.size=a,this.thresh=b,this.eps=c,this.prob=d}return a.prototype.update_iters=function(a,b){var c=Math.log(1-this.prob),d=Math.log(1-Math.pow(1-a,this.size));return 0|(d>=0||-c>=b*-d?b:Math.round(c/d))},a}(),e=function(){var a=function(a,b,c,d,e,f,g){for(var h=1e3,i=[],j=0,k=0,l=0,m=0,n=!1;h>l;++l){for(j=0;d>j&&h>l;){for(n=!1,m=0;!n;)for(n=!0,m=i[j]=0|Math.floor(Math.random()*e),k=0;j>k;++k)if(m==i[k]){n=!1;break}f[j]=b[m],g[j]=c[m],a.check_subset(f,g,j+1)?++j:l++}break}return j==d&&h>l},b=function(a,b,c,d,e,f,g,h){var i=0,j=0,k=0,l=f*f;for(a.error(c,d,b,g,e);e>j;++j)k=g[j]<=l,h[j]=k,i+=k;return i};return{ransac:function(d,e,f,g,h,i,j,k){if("undefined"==typeof k&&(k=1e3),h=0;)j.data[h]=1;return c.cache.put_buffer(v),c.cache.put_buffer(w),c.cache.put_buffer(x),!0}for(;m>n;++n){if(r=a(e,f,g,l,h,p,q),!r){if(0==n)return c.cache.put_buffer(v),c.cache.put_buffer(w),c.cache.put_buffer(x),!1;break}C=e.run(p,q,y,l),0>=C||(B=b(e,y,f,g,h,d.thresh,D,z.data),B>Math.max(A,l-1)&&(y.copy_to(i),A=B,j&&z.copy_to(j),m=d.update_iters((h-B)/h,m),o=!0))}return c.cache.put_buffer(v),c.cache.put_buffer(w),c.cache.put_buffer(x),o},lmeds:function(d,e,f,g,h,i,j,k){if("undefined"==typeof k&&(k=1e3),h=0;)j.data[h]=1;return c.cache.put_buffer(v),c.cache.put_buffer(w),c.cache.put_buffer(x),!0}for(;m>n;++n){if(r=a(e,f,g,l,h,p,q),!r){if(0==n)return c.cache.put_buffer(v),c.cache.put_buffer(w),c.cache.put_buffer(x),!1;break}B=e.run(p,q,y,l),0>=B||(e.error(f,g,y,C,h),F=c.math.median(C,0,h-1),D>F&&(D=F,y.copy_to(i),o=!0))}return o&&(E=2.5*1.4826*(1+5/(h-l))*Math.sqrt(D),E=Math.max(E,.001),A=b(e,i,f,g,h,E,C,z.data),j&&z.copy_to(j),o=A>=l),c.cache.put_buffer(v),c.cache.put_buffer(w),c.cache.put_buffer(x),o}}}();a.ransac_params_t=d,a.motion_model=b,a.motion_estimator=e}(c),function(a){var b=function(){var a=function(a,b,d,e){for(var f=0,g=a.channel,h=a.cols,i=a.rows,j=a.data,k=b.data,l=h/d,m=i/e,n=l*m*65536|0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=c.cache.get_buffer(d*g<<2),F=c.cache.get_buffer(d*g<<2),G=c.cache.get_buffer(2*h*3<<2),H=E.i32,I=F.i32,J=G.i32;d>o;o++){for(w=o*l,x=w+l,s=w+1-1e-6|0,t=0|x,s=Math.min(s,h-1),t=Math.min(t,h-1),s>w&&(J[v++]=o*g|0,J[v++]=(s-1)*g|0,J[v++]=256*(s-w)|0,f++),q=s;t>q;q++)f++,J[v++]=o*g|0,J[v++]=q*g|0,J[v++]=256;x-t>.001&&(f++,J[v++]=o*g|0,J[v++]=t*g|0,J[v++]=256*(x-t)|0)}for(o=0;d*g>o;o++)H[o]=I[o]=0;for(p=0,r=0;i>r;r++){for(y=h*r,v=0;f>v;v++)for(A=J[3*v],s=J[3*v+1],B=J[3*v+2],u=0;g>u;u++)H[A+u]+=j[y+s+u]*B;if(r+1>=(p+1)*m||r==i-1){if(C=256*Math.max(r+1-(p+1)*m,0)|0,D=256-C,z=d*p,0>=C)for(o=0;d*g>o;o++)k[z+o]=Math.min(Math.max((I[o]+256*H[o])/n,0),255),I[o]=H[o]=0;else for(o=0;d*g>o;o++)k[z+o]=Math.min(Math.max((I[o]+H[o]*D)/n,0),255),I[o]=H[o]*C,H[o]=0;p++}else for(o=0;d*g>o;o++)I[o]+=256*H[o],H[o]=0}c.cache.put_buffer(F),c.cache.put_buffer(E),c.cache.put_buffer(G)},b=function(a,b,d,e){for(var f=0,g=a.channel,h=a.cols,i=a.rows,j=a.data,k=b.data,l=h/d,m=i/e,n=1/(l*m),o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=c.cache.get_buffer(d*g<<2),F=c.cache.get_buffer(d*g<<2),G=c.cache.get_buffer(2*h*3<<2),H=E.f32,I=F.f32,J=G.f32;d>o;o++){for(w=o*l,x=w+l,s=w+1-1e-6|0,t=0|x,s=Math.min(s,h-1),t=Math.min(t,h-1),s>w&&(f++,J[v++]=(s-1)*g|0,J[v++]=o*g|0,J[v++]=(s-w)*n),q=s;t>q;q++)f++,J[v++]=q*g|0,J[v++]=o*g|0,J[v++]=n;x-t>.001&&(f++,J[v++]=t*g|0,J[v++]=o*g|0,J[v++]=(x-t)*n)}for(o=0;d*g>o;o++)H[o]=I[o]=0;for(p=0,r=0;i>r;r++){for(y=h*r,v=0;f>v;v++)for(s=0|J[3*v],A=0|J[3*v+1],B=J[3*v+2],u=0;g>u;u++)H[A+u]+=j[y+s+u]*B;if(r+1>=(p+1)*m||r==i-1){if(C=Math.max(r+1-(p+1)*m,0),D=1-C,z=d*p,Math.abs(C)<.001)for(o=0;d*g>o;o++)k[z+o]=I[o]+H[o],I[o]=H[o]=0;else for(o=0;d*g>o;o++)k[z+o]=I[o]+H[o]*D,I[o]=H[o]*C,H[o]=0;p++}else for(o=0;d*g>o;o++)I[o]+=H[o],H[o]=0}c.cache.put_buffer(F),c.cache.put_buffer(E),c.cache.put_buffer(G)},d=function(a,b,c,d,e,f,g,h){for(var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=f[0],s=0,t=d<<1,u=3*d,v=d<<2;e>i;++i){for(n=b[l],j=0;h>j;++j)a[j]=n;for(j=0;d-2>=j;j+=2)a[j+h]=b[l+j],a[j+h+1]=b[l+j+1];for(;d>j;++j)a[j+h]=b[l+j];for(n=b[l+d-1],j=d;h+d>j;++j)a[j+h]=n;for(j=0;d-4>=j;j+=4){for(n=a[j]*r,o=a[j+1]*r,p=a[j+2]*r,q=a[j+3]*r,k=1;g>k;++k)s=f[k],n+=a[k+j]*s,o+=a[k+j+1]*s,p+=a[k+j+2]*s,q+=a[k+j+3]*s;c[m+j]=Math.min(n>>8,255),c[m+j+1]=Math.min(o>>8,255),c[m+j+2]=Math.min(p>>8,255),c[m+j+3]=Math.min(q>>8,255)}for(;d>j;++j){for(n=a[j]*r,k=1;g>k;++k)n+=a[k+j]*f[k];c[m+j]=Math.min(n>>8,255)}l+=d,m+=d}for(i=0;d>i;++i){for(n=c[i],j=0;h>j;++j)a[j]=n;for(k=i,j=0;e-2>=j;j+=2,k+=t)a[j+h]=c[k],a[j+h+1]=c[k+d];for(;e>j;++j,k+=d)a[j+h]=c[k];for(n=c[(e-1)*d+i],j=e;h+e>j;++j)a[j+h]=n;for(m=i,j=0;e-4>=j;j+=4,m+=v){for(n=a[j]*r,o=a[j+1]*r,p=a[j+2]*r,q=a[j+3]*r,k=1;g>k;++k)s=f[k],n+=a[k+j]*s,o+=a[k+j+1]*s,p+=a[k+j+2]*s,q+=a[k+j+3]*s;c[m]=Math.min(n>>8,255),c[m+d]=Math.min(o>>8,255),c[m+t]=Math.min(p>>8,255),c[m+u]=Math.min(q>>8,255)}for(;e>j;++j,m+=d){for(n=a[j]*r,k=1;g>k;++k)n+=a[k+j]*f[k];c[m]=Math.min(n>>8,255)}}},e=function(a,b,c,d,e,f,g,h){for(var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=f[0],s=0,t=d<<1,u=3*d,v=d<<2;e>i;++i){for(n=b[l],j=0;h>j;++j)a[j]=n;for(j=0;d-2>=j;j+=2)a[j+h]=b[l+j],a[j+h+1]=b[l+j+1];for(;d>j;++j)a[j+h]=b[l+j];for(n=b[l+d-1],j=d;h+d>j;++j)a[j+h]=n;for(j=0;d-4>=j;j+=4){for(n=a[j]*r,o=a[j+1]*r,p=a[j+2]*r,q=a[j+3]*r,k=1;g>k;++k)s=f[k],n+=a[k+j]*s,o+=a[k+j+1]*s,p+=a[k+j+2]*s,q+=a[k+j+3]*s;c[m+j]=n,c[m+j+1]=o,c[m+j+2]=p,c[m+j+3]=q}for(;d>j;++j){for(n=a[j]*r,k=1;g>k;++k)n+=a[k+j]*f[k];c[m+j]=n}l+=d,m+=d}for(i=0;d>i;++i){for(n=c[i],j=0;h>j;++j)a[j]=n;for(k=i,j=0;e-2>=j;j+=2,k+=t)a[j+h]=c[k],a[j+h+1]=c[k+d];for(;e>j;++j,k+=d)a[j+h]=c[k];for(n=c[(e-1)*d+i],j=e;h+e>j;++j)a[j+h]=n;for(m=i,j=0;e-4>=j;j+=4,m+=v){for(n=a[j]*r,o=a[j+1]*r,p=a[j+2]*r,q=a[j+3]*r,k=1;g>k;++k)s=f[k],n+=a[k+j]*s,o+=a[k+j+1]*s,p+=a[k+j+2]*s,q+=a[k+j+3]*s;c[m]=n,c[m+d]=o,c[m+t]=p,c[m+u]=q}for(;e>j;++j,m+=d){for(n=a[j]*r,k=1;g>k;++k)n+=a[k+j]*f[k];c[m]=n}}};return{grayscale:function(a,b,d,e,f){"undefined"==typeof f&&(f=c.COLOR_RGBA2GRAY);var g=0,h=0,i=0,j=0,k=0,l=0,m=4899,n=9617,o=1868,p=4;(f==c.COLOR_BGRA2GRAY||f==c.COLOR_BGR2GRAY)&&(m=1868,o=4899),(f==c.COLOR_RGB2GRAY||f==c.COLOR_BGR2GRAY)&&(p=3);var q=p<<1,r=3*p|0;e.resize(b,d,1);var s=e.data;for(h=0;d>h;++h,j+=b,i+=b*p){for(g=0,k=i,l=j;b-4>=g;g+=4,k+=p<<2,l+=4)s[l]=a[k]*m+a[k+1]*n+a[k+2]*o+8192>>14,s[l+1]=a[k+p]*m+a[k+p+1]*n+a[k+p+2]*o+8192>>14,s[l+2]=a[k+q]*m+a[k+q+1]*n+a[k+q+2]*o+8192>>14,s[l+3]=a[k+r]*m+a[k+r+1]*n+a[k+r+2]*o+8192>>14;for(;b>g;++g,++l,k+=p)s[l]=a[k]*m+a[k+1]*n+a[k+2]*o+8192>>14}},resample:function(d,e,f,g){var h=d.rows,i=d.cols;h>g&&i>f&&(e.resize(f,g,d.channel),d.type&c.U8_t&&e.type&c.U8_t&&256>h*i/(g*f)?a(d,e,f,g):b(d,e,f,g))},box_blur_gray:function(a,b,d,e){"undefined"==typeof e&&(e=0);var f=a.cols,g=a.rows,h=g<<1,i=f<<1,j=0,k=0,l=0,m=0,n=(d<<1)+1|0,o=d+1|0,p=o+1|0,q=e&c.BOX_BLUR_NOSCALE?1:1/(n*n),r=c.cache.get_buffer(f*g<<2),s=0,t=0,u=0,v=0,w=0,x=r.i32,y=a.data,z=0;for(b.resize(f,g,a.channel),l=0;g>l;++l){for(t=l,s=o*y[u],j=u+1|0,m=u+d|0;m>=j;++j)s+=y[j];for(v=u+o|0,w=u,z=y[w],k=0;d>k;++k,t+=g)x[t]=s,s+=y[v]-z,v++;for(;f-p>k;k+=2,t+=h)x[t]=s,s+=y[v]-y[w],x[t+g]=s,s+=y[v+1]-y[w+1],v+=2,w+=2;for(;f-o>k;++k,t+=g)x[t]=s,s+=y[v]-y[w],v++,w++;for(z=y[v-1];f>k;++k,t+=g)x[t]=s,s+=z-y[w],w++;u+=f}if(u=0,y=b.data,1==q)for(l=0;f>l;++l){for(t=l,s=o*x[u],j=u+1|0,m=u+d|0;m>=j;++j)s+=x[j];for(v=u+o,w=u,z=x[w],k=0;d>k;++k,t+=f)y[t]=s,s+=x[v]-z,v++;for(;g-p>k;k+=2,t+=i)y[t]=s,s+=x[v]-x[w],y[t+f]=s,s+=x[v+1]-x[w+1],v+=2,w+=2;for(;g-o>k;++k,t+=f)y[t]=s,s+=x[v]-x[w],v++,w++;for(z=x[v-1];g>k;++k,t+=f)y[t]=s,s+=z-x[w],w++;u+=g}else for(l=0;f>l;++l){for(t=l,s=o*x[u],j=u+1|0,m=u+d|0;m>=j;++j)s+=x[j];for(v=u+o,w=u,z=x[w],k=0;d>k;++k,t+=f)y[t]=s*q,s+=x[v]-z,v++;for(;g-p>k;k+=2,t+=i)y[t]=s*q,s+=x[v]-x[w],y[t+f]=s*q,s+=x[v+1]-x[w+1],v+=2,w+=2;for(;g-o>k;++k,t+=f)y[t]=s*q,s+=x[v]-x[w],v++,w++;for(z=x[v-1];g>k;++k,t+=f)y[t]=s*q,s+=z-x[w],w++;u+=g}c.cache.put_buffer(r)},gaussian_blur:function(a,b,f,g){"undefined"==typeof g&&(g=0),"undefined"==typeof f&&(f=0),f=0==f?2*Math.max(1,4*g+1-1e-8)+1|0:f;var h=f>>1,i=a.cols,j=a.rows,k=a.type,l=k&c.U8_t;b.resize(i,j,a.channel);var m,n,o=a.data,p=b.data,q=f+Math.max(j,i)|0,r=c.cache.get_buffer(q<<2),s=c.cache.get_buffer(f<<2);l?(m=r.i32,n=s.i32):k&c.S32_t?(m=r.i32,n=s.f32):(m=r.f32,n=s.f32),c.math.get_gaussian_kernel(f,g,n,k),l?d(m,o,p,i,j,n,f,h):e(m,o,p,i,j,n,f,h),c.cache.put_buffer(r),c.cache.put_buffer(s)},pyrdown:function(a,b,c,d){"undefined"==typeof c&&(c=0),"undefined"==typeof d&&(d=0);var e=a.cols,f=a.rows,g=e>>1,h=f>>1,i=g-(c<<1),j=h-(d<<1),k=0,l=0,m=c+d*e,n=0,o=0,p=0;b.resize(g,h,a.channel);var q=a.data,r=b.data;for(l=0;j>l;++l){for(n=m,p=o,k=0;i-2>=k;k+=2,p+=2,n+=4)r[p]=q[n]+q[n+1]+q[n+e]+q[n+e+1]+2>>2,r[p+1]=q[n+2]+q[n+3]+q[n+e+2]+q[n+e+3]+2>>2;for(;i>k;++k,++p,n+=2)r[p]=q[n]+q[n+1]+q[n+e]+q[n+e+1]+2>>2;m+=e<<1,o+=g}},scharr_derivatives:function(a,b){var d,e,f,g,h,i,j,k,l=a.cols,m=a.rows,n=l<<1,o=0,p=0,q=0,r=0,s=0,t=0,u=0;b.resize(l,m,2);var v=a.data,w=b.data,x=c.cache.get_buffer(l+2<<2),y=c.cache.get_buffer(l+2<<2);for(a.type&c.U8_t||a.type&c.S32_t?(j=x.i32,k=y.i32):(j=x.f32,k=y.f32);m>p;++p,s+=l){for(r=(p>0?p-1:1)*l|0,t=(m-1>p?p+1:m-2)*l|0,u=p*n|0,o=0,q=1;l-2>=o;o+=2,q+=2)d=v[r+o],e=v[t+o],j[q]=3*(d+e)+10*v[s+o],k[q]=e-d,d=v[r+o+1],e=v[t+o+1],j[q+1]=3*(d+e)+10*v[s+o+1],k[q+1]=e-d;for(;l>o;++o,++q)d=v[r+o],e=v[t+o],j[q]=3*(d+e)+10*v[s+o],k[q]=e-d;for(o=l+1|0,j[0]=j[1],j[o]=j[l],k[0]=k[1],k[o]=k[l],o=0;l-4>=o;o+=4)d=k[o+2],e=k[o+1],f=k[o+3],g=k[o+4],h=j[o+2],i=j[o+3],w[u++]=h-j[o],w[u++]=3*(d+k[o])+10*e,w[u++]=i-j[o+1],w[u++]=3*(f+e)+10*d,w[u++]=j[o+4]-h,w[u++]=3*(g+d)+10*f,w[u++]=j[o+5]-i,w[u++]=3*(k[o+5]+f)+10*g;for(;l>o;++o)w[u++]=j[o+2]-j[o],w[u++]=3*(k[o+2]+k[o])+10*k[o+1]}c.cache.put_buffer(x),c.cache.put_buffer(y)},sobel_derivatives:function(a,b){var d,e,f,g,h,i,j,k,l=a.cols,m=a.rows,n=l<<1,o=0,p=0,q=0,r=0,s=0,t=0,u=0;b.resize(l,m,2);var v=a.data,w=b.data,x=c.cache.get_buffer(l+2<<2),y=c.cache.get_buffer(l+2<<2);for(a.type&c.U8_t||a.type&c.S32_t?(j=x.i32,k=y.i32):(j=x.f32,k=y.f32);m>p;++p,s+=l){for(r=(p>0?p-1:1)*l|0,t=(m-1>p?p+1:m-2)*l|0,u=p*n|0,o=0,q=1;l-2>=o;o+=2,q+=2)d=v[r+o],e=v[t+o],j[q]=d+e+2*v[s+o],k[q]=e-d,d=v[r+o+1],e=v[t+o+1],j[q+1]=d+e+2*v[s+o+1],k[q+1]=e-d;for(;l>o;++o,++q)d=v[r+o],e=v[t+o],j[q]=d+e+2*v[s+o],k[q]=e-d;for(o=l+1|0,j[0]=j[1],j[o]=j[l],k[0]=k[1],k[o]=k[l],o=0;l-4>=o;o+=4)d=k[o+2],e=k[o+1],f=k[o+3],g=k[o+4],h=j[o+2],i=j[o+3],w[u++]=h-j[o],w[u++]=d+k[o]+2*e,w[u++]=i-j[o+1],w[u++]=f+e+2*d,w[u++]=j[o+4]-h,w[u++]=g+d+2*f,w[u++]=j[o+5]-i,w[u++]=k[o+5]+f+2*g;for(;l>o;++o)w[u++]=j[o+2]-j[o],w[u++]=k[o+2]+k[o]+2*k[o+1]}c.cache.put_buffer(x),c.cache.put_buffer(y)},compute_integral_image:function(a,b,c,d){var e=0|a.cols,f=0|a.rows,g=a.data,h=e+1|0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;if(b&&c){for(;h>m;++m)b[m]=0,c[m]=0;for(k=h+1|0,l=1,m=0,p=0;f>m;++m,++k,++l){for(i=j=0,n=0;e-2>=n;n+=2,p+=2,k+=2,l+=2)o=g[p],i+=o,j+=o*o,b[k]=b[l]+i,c[k]=c[l]+j,o=g[p+1],i+=o,j+=o*o,b[k+1]=b[l+1]+i,c[k+1]=c[l+1]+j;for(;e>n;++n,++p,++k,++l)o=g[p],i+=o,j+=o*o,b[k]=b[l]+i,c[k]=c[l]+j}}else if(b){for(;h>m;++m)b[m]=0;for(k=h+1|0,l=1,m=0,p=0;f>m;++m,++k,++l){for(i=0,n=0;e-2>=n;n+=2,p+=2,k+=2,l+=2)i+=g[p],b[k]=b[l]+i,i+=g[p+1],b[k+1]=b[l+1]+i;for(;e>n;++n,++p,++k,++l)i+=g[p],b[k]=b[l]+i}}else if(c){for(;h>m;++m)c[m]=0;for(k=h+1|0,l=1,m=0,p=0;f>m;++m,++k,++l){for(j=0,n=0;e-2>=n;n+=2,p+=2,k+=2,l+=2)o=g[p],j+=o*o,c[k]=c[l]+j,o=g[p+1],j+=o*o,c[k+1]=c[l+1]+j;for(;e>n;++n,++p,++k,++l)o=g[p],j+=o*o,c[k]=c[l]+j}}if(d){for(m=0;h>m;++m)d[m]=0;for(k=h+1|0,l=0,m=0,p=0;f>m;++m,++k,++l){for(n=0;e-2>=n;n+=2,p+=2,k+=2,l+=2)d[k]=g[p]+d[l],d[k+1]=g[p+1]+d[l+1];for(;e>n;++n,++p,++k,++l)d[k]=g[p]+d[l]}for(k=h+e|0,l=e,m=0;f>m;++m,k+=h,l+=h)d[k]+=d[l];for(n=e-1;n>0;--n)for(k=n+f*h,l=k-h,m=f;m>0;--m,k-=h,l-=h)d[k]+=d[l]+d[l+1]}},equalize_histogram:function(a,b){var d=a.cols,e=a.rows,f=a.data;b.resize(d,e,a.channel);var g,h,i=b.data,j=d*e,k=0,l=0,m=c.cache.get_buffer(1024);for(g=m.i32;256>k;++k)g[k]=0;for(k=0;j>k;++k)++g[f[k]];for(l=g[0],k=1;256>k;++k)l=g[k]+=l;for(h=255/j,k=0;j>k;++k)i[k]=g[f[k]]*h+.5|0;c.cache.put_buffer(m)},canny:function(a,b,d,e){{var f=a.cols,g=a.rows;a.data}b.resize(f,g,a.channel);var h=b.data,i=0,j=0,k=0,l=f<<1,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=c.cache.get_buffer(g*l<<2),v=c.cache.get_buffer(3*(f+2)<<2),w=c.cache.get_buffer((g+2)*(f+2)<<2),x=c.cache.get_buffer(g*f<<2),y=v.i32,z=w.i32,A=x.i32,B=u.i32,C=new c.matrix_t(f,g,c.S32C2_t,u.data),D=1,E=f+2+1|0,F=2*(f+2)+1|0,G=f+2|0,H=G+1|0,I=0;for(this.sobel_derivatives(a,C),d>e&&(i=d,d=e,e=i),i=3*(f+2)|0;--i>=0;)y[i]=0;for(i=(g+2)*(f+2)|0;--i>=0;)z[i]=0;for(;f>j;++j,k+=2)p=B[k],q=B[k+1],y[E+j]=(p^p>>31)-(p>>31)+((q^q>>31)-(q>>31));for(i=1;g>=i;++i,k+=l){if(i==g)for(j=F+f;--j>=F;)y[j]=0;else for(j=0;f>j;j++)p=B[k+(j<<1)],q=B[k+(j<<1)+1],y[F+j]=(p^p>>31)-(p>>31)+((q^q>>31)-(q>>31));for(m=k-l|0,z[H-1]=0,n=0,j=0;f>j;++j,m+=2){if(o=y[E+j],o>d)if(p=B[m],q=B[m+1],r=p^q,p=(p^p>>31)-(p>>31)|0,q=(q^q>>31)-(q>>31)|0,s=13573*p,t=s+(p+p<<15),q<<=15,s>q){if(o>y[E+j-1]&&o>=y[E+j+1]){o>e&&!n&&2!=z[H+j-G]?(z[H+j]=2,n=1,A[I++]=H+j):z[H+j]=1;continue}}else if(q>t){if(o>y[D+j]&&o>=y[F+j]){o>e&&!n&&2!=z[H+j-G]?(z[H+j]=2,n=1,A[I++]=H+j):z[H+j]=1;continue}}else if(r=0>r?-1:1,o>y[D+j-r]&&o>y[F+j+r]){o>e&&!n&&2!=z[H+j-G]?(z[H+j]=2,n=1,A[I++]=H+j):z[H+j]=1;continue}z[H+j]=0,n=0}z[H+f]=0,H+=G,j=D,D=E,E=F,F=j}for(j=H-G-1,i=0;G>i;++i,++j)z[j]=0;for(;I>0;)H=A[--I],H-=G+1,1==z[H]&&(z[H]=2,A[I++]=H),H+=1,1==z[H]&&(z[H]=2,A[I++]=H),H+=1,1==z[H]&&(z[H]=2,A[I++]=H),H+=G,1==z[H]&&(z[H]=2,A[I++]=H),H-=2,1==z[H]&&(z[H]=2,A[I++]=H),H+=G,1==z[H]&&(z[H]=2,A[I++]=H),H+=1,1==z[H]&&(z[H]=2,A[I++]=H),H+=1,1==z[H]&&(z[H]=2,A[I++]=H);for(H=G+1,D=0,i=0;g>i;++i,H+=G)for(j=0;f>j;++j)h[D++]=255*(2==z[H+j]);c.cache.put_buffer(u),c.cache.put_buffer(v),c.cache.put_buffer(w),c.cache.put_buffer(x)},warp_perspective:function(a,b,c,d){"undefined"==typeof d&&(d=0);for(var e=0|a.cols,f=0|a.rows,g=0|b.cols,h=0|b.rows,i=a.data,j=b.data,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=c.data,A=z[0],B=z[1],C=z[2],D=z[3],E=z[4],F=z[5],G=z[6],H=z[7],I=z[8],J=0;h>l;++l)for(r=B*l+C,s=E*l+F,t=H*l+I,k=0;g>k;++k,++J,r+=A,s+=D,t+=G)u=1/t,p=r*u,q=s*u,n=0|p,o=0|q,p>0&&q>0&&e-1>n&&f-1>o?(v=Math.max(p-n,0),w=Math.max(q-o,0),m=e*o+n|0,x=i[m]+v*(i[m+1]-i[m]),y=i[m+e]+v*(i[m+e+1]-i[m+e]),j[J]=x+w*(y-x)):j[J]=d},warp_affine:function(a,b,c,d){"undefined"==typeof d&&(d=0);for(var e=a.cols,f=a.rows,g=b.cols,h=b.rows,i=a.data,j=b.data,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=c.data,w=v[0],x=v[1],y=v[2],z=v[3],A=v[4],B=v[5],C=0;h>l;++l)for(p=x*l+y,q=A*l+B,k=0;g>k;++k,++C,p+=w,q+=z)n=0|p,o=0|q,n>=0&&o>=0&&e-1>n&&f-1>o?(r=p-n,s=q-o,m=e*o+n,t=i[m]+r*(i[m+1]-i[m]),u=i[m+e]+r*(i[m+e+1]-i[m+e]),j[C]=t+s*(u-t)):j[C]=d},skindetector:function(a,b){for(var c,d,e,f,g=a.width*a.height;g--;)f=4*g,c=a.data[f],d=a.data[f+1],e=a.data[f+2],b[g]=c>95&&d>40&&e>20&&c>d&&c>e&&c-Math.min(d,e)>15&&Math.abs(c-d)>15?255:0}}}();a.imgproc=b}(c),function(a){var b=function(){var a=new Int32Array([0,3,1,3,2,2,3,1,3,0,3,-1,2,-2,1,-3,0,-3,-1,-3,-2,-2,-3,-1,-3,0,-3,1,-2,2,-1,3]),b=new Uint8Array(512),d=new Int32Array(25),e=new Int32Array(25),f=function(b,c,d){for(var e=0,f=a;d>e;++e)b[e]=f[e<<1]+f[(e<<1)+1]*c;for(;25>e;++e)b[e]=b[e-d]},g=function(a,b,c,d,e){for(var f=25,g=0,h=a[b],i=e,j=0,k=0,l=0;f>g;++g)d[g]=h-a[b+c[g]];for(g=0;16>g;g+=2)j=Math.min(d[g+1],d[g+2]),j=Math.min(j,d[g+3]),i>=j||(j=Math.min(j,d[g+4]),j=Math.min(j,d[g+5]),j=Math.min(j,d[g+6]),j=Math.min(j,d[g+7]),j=Math.min(j,d[g+8]),i=Math.max(i,Math.min(j,d[g])),i=Math.max(i,Math.min(j,d[g+9])));for(k=-i,g=0;16>g;g+=2)l=Math.max(d[g+1],d[g+2]),l=Math.max(l,d[g+3]),l=Math.max(l,d[g+4]),l=Math.max(l,d[g+5]),l>=k||(l=Math.max(l,d[g+6]),l=Math.max(l,d[g+7]),l=Math.max(l,d[g+8]),k=Math.min(k,Math.max(l,d[g])),k=Math.min(k,Math.max(l,d[g+9])));return-k-1},h=20;return{set_threshold:function(a){h=Math.min(Math.max(a,0),255);for(var c=-255;255>=c;++c)b[c+255]=-h>c?1:c>h?2:0;return h},detect:function(a,i,j){"undefined"==typeof j&&(j=3);var k,l=8,m=25,n=a.data,o=a.cols,p=a.rows,q=0,r=0,s=0,t=0,u=0,v=0,w=c.cache.get_buffer(3*o),x=c.cache.get_buffer(3*(o+1)<<2),y=w.u8,z=x.i32,A=d,B=e,C=Math.max(3,j),D=Math.min(p-2,p-j),E=Math.max(3,j),F=Math.min(o-3,o-j),G=0,H=0,I=g,J=b,K=h,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0;f(A,o,16);var X=A[0],Y=A[1],Z=A[2],$=A[3],_=A[4],aa=A[5],ba=A[6],ca=A[7],da=A[8],ea=A[9],fa=A[10],ga=A[11],ha=A[12],ia=A[13],ja=A[14],ka=A[15];for(q=0;3*o>q;++q)y[q]=0;for(q=C;D>q;++q){for(R=q*o+E|0,v=(q-3)%3,Q=v*o|0,P=v*(o+1)|0,r=0;o>r;++r)y[Q+r]=0;if(O=0,D-1>q)for(r=E;F>r;++r,++R)if(L=n[R],M=-L+255,N=J[M+n[R+X]]|J[M+n[R+da]],0!=N&&(N&=J[M+n[R+Z]]|J[M+n[R+fa]],N&=J[M+n[R+_]]|J[M+n[R+ha]],N&=J[M+n[R+ba]]|J[M+n[R+ja]],0!=N)){if(N&=J[M+n[R+Y]]|J[M+n[R+ea]],N&=J[M+n[R+$]]|J[M+n[R+ga]],N&=J[M+n[R+aa]]|J[M+n[R+ia]],N&=J[M+n[R+ca]]|J[M+n[R+ka]],1&N)for(t=L-K,G=0,s=0;m>s;++s)if(u=n[R+A[s]],t>u){if(++G,G>l){++O,z[P+O]=r,y[Q+r]=I(n,R,A,B,K);break}}else G=0;if(2&N)for(t=L+K,G=0,s=0;m>s;++s)if(u=n[R+A[s]],u>t){if(++G,G>l){++O,z[P+O]=r,y[Q+r]=I(n,R,A,B,K);break}}else G=0}if(z[P+o]=O,q!=C)for(v=(q-4+3)%3,S=v*o|0,P=v*(o+1)|0,v=(q-5+3)%3,T=v*o|0,O=z[P+o],s=0;O>s;++s)r=z[P+s],U=r+1|0,V=r-1|0,W=y[S+r],W>y[S+U]&&W>y[S+V]&&W>y[T+V]&&W>y[T+r]&&W>y[T+U]&&W>y[Q+V]&&W>y[Q+r]&&W>y[Q+U]&&(k=i[H],k.x=r,k.y=q-1,k.score=W,H++)}return c.cache.put_buffer(w),c.cache.put_buffer(x),H}}}();a.fast_corners=b,b.set_threshold(20)}(c),function(a){var b=function(){var a=function(a,b,c,d,e,f,g,h,i,j){var k=0,l=0,m=h*c+g|0,n=m;for(k=h;j>k;++k,m+=c,n=m)for(l=g;i>l;++l,++n)b[n]=-4*a[n]+a[n+e]+a[n-e]+a[n+f]+a[n-f]},b=function(a,b,c,d,e,f,g){var h=-2*a[b]+a[b+d]+a[b-d],i=-2*a[b]+a[b+e]+a[b-e],j=a[b+f]+a[b-f]-a[b+g]-a[b-g],k=0|Math.sqrt((h-i)*(h-i)+4*j*j);return Math.min(Math.abs(c-k),Math.abs(-(c+k)))};return{laplacian_threshold:30,min_eigen_value_threshold:25,detect:function(d,e,f){"undefined"==typeof f&&(f=5);var g,h=0,i=0,j=d.cols,k=d.rows,l=d.data,m=5,n=5*j|0,o=3+3*j|0,p=3-3*j|0,q=c.cache.get_buffer(j*k<<2),r=q.i32,s=0,t=0,u=0,v=0,w=0,x=this.laplacian_threshold,y=this.min_eigen_value_threshold,z=0|Math.max(5,f),A=0|Math.max(3,f),B=0|Math.min(j-5,j-f),C=0|Math.min(k-3,k-f);for(h=j*k;--h>=0;)r[h]=0;for(a(l,r,j,k,m,n,z,A,B,C),t=A*j+z|0,i=A;C>i;++i,t+=j)for(h=z,u=t;B>h;++h,++u)s=r[u],(-x>s&&sx&&s>r[u-1]&&s>r[u+1]&&s>r[u-j]&&s>r[u+j]&&s>r[u-j-1]&&s>r[u+j-1]&&s>r[u-j+1]&&s>r[u+j+1])&&(v=b(l,u,s,m,n,o,p),v>y&&(g=e[w],g.x=h,g.y=i,g.score=v,++w,++h,++u));return c.cache.put_buffer(q),w}}}();a.yape06=b}(c),function(a){var b=function(){var a=function(a,b,c){var d,e,f=0;for(d=c,e=0;d>e;e++,f++)d=Math.sqrt(c*c-e*e)+.5|0,b[f]=d+a*e;for(d--;e>d&&d>=0;d--,f++)e=Math.sqrt(c*c-d*d)+.5|0,b[f]=d+a*e;for(;e>-d;d--,f++)e=Math.sqrt(c*c-d*d)+.5|0,b[f]=d+a*e;for(e--;e>=0;e--,f++)d=-Math.sqrt(c*c-e*e)-.5|0,b[f]=d+a*e;for(;e>d;e--,f++)d=-Math.sqrt(c*c-e*e)-.5|0,b[f]=d+a*e;for(d++;0>=d;d++,f++)e=-Math.sqrt(c*c-d*d)-.5|0,b[f]=d+a*e;for(;-e>d;d++,f++)e=-Math.sqrt(c*c-d*d)-.5|0,b[f]=d+a*e;for(e++;0>e;e++,f++)d=Math.sqrt(c*c-e*e)+.5|0,b[f]=d+a*e;return b[f]=b[0],b[f+1]=b[1],f},b=function(a,b,c){var d=0;return 0!=a[b+1]&&d++,0!=a[b-1]&&d++,0!=a[b+c]&&d++,0!=a[b+c+1]&&d++,0!=a[b+c-1]&&d++,0!=a[b-c]&&d++,0!=a[b-c+1]&&d++,0!=a[b-c-1]&&d++,d},c=function(a,b,c,d,e){var f,g;if(c>0)for(b-=d*e,g=-e;e>=g;++g){for(f=-e;e>=f;++f)if(a[b+f]>c)return!1;b+=d}else for(b-=d*e,g=-e;e>=g;++g){for(f=-e;e>=f;++f)if(a[b+f]=l)if(l>=d)if(m=a[b+f[k]],e>=m){if(m>=d)return void(c[b]=0);if(k++,n=a[b+f[k]],n>e)if(k++,o=a[b+f[k]],o>e)p=3;else{if(!(d>o))return void(c[b]=0);p=6}else if(k++,o=a[b+f[k]],o>e)p=7;else{if(!(d>o))return void(c[b]=0);p=2}}else if(k++,n=a[b+f[k]],n>e)if(k++,o=a[b+f[k]],o>e)p=3;else{if(!(d>o))return void(c[b]=0);p=6}else{if(!(d>n))return void(c[b]=0);if(k++,o=a[b+f[k]],o>e)p=7;else{if(!(d>o))return void(c[b]=0);p=2}}else{if(m=a[b+f[k]],m>e)return void(c[b]=0);if(k++,n=a[b+f[k]],n>e)return void(c[b]=0);if(k++,o=a[b+f[k]],o>e)return void(c[b]=0);p=1}else{if(m=a[b+f[k]],d>m)return void(c[b]=0);if(k++,n=a[b+f[k]],d>n)return void(c[b]=0);if(k++,o=a[b+f[k]],d>o)return void(c[b]=0);p=0}for(j=1;g>=j;j++)switch(l=a[b+f[j]],p){case 0:if(l>e){if(n=o,k++,o=a[b+f[k]],d>o)return void(c[b]=0);i-=l+n,p=0;break}if(d>l){if(n>e)return void(c[b]=0);if(o>e)return void(c[b]=0);if(n=o,k++,o=a[b+f[k]],o>e)return void(c[b]=0);i-=l+n,p=8;break}if(e>=n)return void(c[b]=0);if(e>=o)return void(c[b]=0);if(n=o,k++,o=a[b+f[k]],o>e){i-=l+n,p=3;break}if(d>o){i-=l+n,p=6;break}return void(c[b]=0);case 1:if(d>l){if(n=o,k++,o=a[b+f[k]],o>e)return void(c[b]=0);i-=l+n,p=1;break}if(l>e){if(d>n)return void(c[b]=0);if(d>o)return void(c[b]=0);if(n=o,k++,o=a[b+f[k]],d>o)return void(c[b]=0);i-=l+n,p=9;break}if(n>=d)return void(c[b]=0);if(o>=d)return void(c[b]=0);if(n=o,k++,o=a[b+f[k]],d>o){i-=l+n,p=2;break}if(o>e){i-=l+n,p=7;break}return void(c[b]=0);case 2:if(l>e)return void(c[b]=0);if(n=o,k++,o=a[b+f[k]],d>l){if(o>e)return void(c[b]=0);i-=l+n,p=4;break}if(o>e){i-=l+n,p=7;break}if(d>o){i-=l+n,p=2;break}return void(c[b]=0);case 3:if(d>l)return void(c[b]=0);if(n=o,k++,o=a[b+f[k]],l>e){if(d>o)return void(c[b]=0);i-=l+n,p=5;break}if(o>e){i-=l+n,p=3;break}if(d>o){i-=l+n,p=6;break}return void(c[b]=0);case 4:if(l>e)return void(c[b]=0);if(d>l){if(n=o,k++,o=a[b+f[k]],o>e)return void(c[b]=0);i-=l+n,p=1;break}if(o>=d)return void(c[b]=0);if(n=o,k++,o=a[b+f[k]],d>o){i-=l+n,p=2;break}if(o>e){i-=l+n,p=7;break}return void(c[b]=0);case 5:if(d>l)return void(c[b]=0);if(l>e){if(n=o,k++,o=a[b+f[k]],d>o)return void(c[b]=0);i-=l+n,p=0;break}if(e>=o)return void(c[b]=0);if(n=o,k++,o=a[b+f[k]],o>e){i-=l+n,p=3;break}if(d>o){i-=l+n,p=6;break}return void(c[b]=0);case 7:if(l>e)return void(c[b]=0);if(d>l)return void(c[b]=0);if(n=o,k++,o=a[b+f[k]],o>e){i-=l+n,p=3;break}if(d>o){i-=l+n,p=6;break}return void(c[b]=0);case 6:if(l>e)return void(c[b]=0);if(d>l)return void(c[b]=0);if(n=o,k++,o=a[b+f[k]],d>o){i-=l+n,p=2;break}if(o>e){i-=l+n,p=7;break}return void(c[b]=0);case 8:if(l>e){if(d>o)return void(c[b]=0);if(n=o,k++,o=a[b+f[k]],d>o)return void(c[b]=0);i-=l+n,p=9;break}if(d>l){if(n=o,k++,o=a[b+f[k]],o>e)return void(c[b]=0);i-=l+n,p=1;break}return void(c[b]=0);case 9:if(d>l){if(o>e)return void(c[b]=0);if(n=o,k++,o=a[b+f[k]],o>e)return void(c[b]=0);i-=l+n,p=8;break}if(l>e){if(n=o,k++,o=a[b+f[k]],d>o)return void(c[b]=0);i-=l+n,p=0;break}return void(c[b]=0)}c[b]=i+h*a[b]},e=function(){function b(b,c,d){this.dirs=new Int32Array(1024),this.dirs_count=0|a(b,this.dirs,d),this.scores=new Int32Array(b*c),this.radius=0|d}return b}();return{level_tables:[],tau:7,init:function(a,b,c,d){"undefined"==typeof d&&(d=1);var f;for(c=Math.min(c,7),c=Math.max(c,3),f=0;d>f;++f)this.level_tables[f]=new e(a>>f,b>>f,c)},detect:function(a,e,f){"undefined"==typeof f&&(f=4);var g,h=this.level_tables[0],i=0|h.radius,j=i-1|0,k=h.dirs,l=0|h.dirs_count,m=l>>1,n=a.data,o=0|a.cols,p=0|a.rows,q=o>>1,r=h.scores,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0|this.tau,B=0,C=0|Math.max(i+1,f),D=0|Math.max(i+1,f),E=0|Math.min(o-i-2,o-f),F=0|Math.min(p-i-2,p-f);for(u=D*o+C|0,t=D;F>t;++t,u+=o)for(s=C,v=u;E>s;++s,++v)w=n[v]+A,x=n[v]-A,xt;++t,u+=o)for(s=C,v=u;E>s;++s,++v)z=r[v],y=Math.abs(z),5>y?(++s,++v):b(r,v,o)>=3&&c(r,v,z,q,i)&&(g=e[B],g.x=s,g.y=t,g.score=y,++B,s+=j,v+=j);return B}}}();a.yape=b}(c),function(a){var b=function(){var a=new Int32Array([8,-3,9,5,4,2,7,-12,-11,9,-8,2,7,-12,12,-13,2,-13,2,12,1,-7,1,6,-2,-10,-2,-4,-13,-13,-11,-8,-13,-3,-12,-9,10,4,11,9,-13,-8,-8,-9,-11,7,-9,12,7,7,12,6,-4,-5,-3,0,-13,2,-12,-3,-9,0,-7,5,12,-6,12,-1,-3,6,-2,12,-6,-13,-4,-8,11,-13,12,-8,4,7,5,1,5,-3,10,-3,3,-7,6,12,-8,-7,-6,-2,-2,11,-1,-10,-13,12,-8,10,-7,3,-5,-3,-4,2,-3,7,-10,-12,-6,11,5,-12,6,-7,5,-6,7,-1,1,0,4,-5,9,11,11,-13,4,7,4,12,2,-1,4,4,-4,-12,-2,7,-8,-5,-7,-10,4,11,9,12,0,-8,1,-13,-13,-2,-8,2,-3,-2,-2,3,-6,9,-4,-9,8,12,10,7,0,9,1,3,7,-5,11,-10,-13,-6,-11,0,10,7,12,1,-6,-3,-6,12,10,-9,12,-4,-13,8,-8,-12,-13,0,-8,-4,3,3,7,8,5,7,10,-7,-1,7,1,-12,3,-10,5,6,2,-4,3,-10,-13,0,-13,5,-13,-7,-12,12,-13,3,-11,8,-7,12,-4,7,6,-10,12,8,-9,-1,-7,-6,-2,-5,0,12,-12,5,-7,5,3,-10,8,-13,-7,-7,-4,5,-3,-2,-1,-7,2,9,5,-11,-11,-13,-5,-13,-1,6,0,-1,5,-3,5,2,-4,-13,-4,12,-9,-6,-9,6,-12,-10,-8,-4,10,2,12,-3,7,12,12,12,-7,-13,-6,5,-4,9,-3,4,7,-1,12,2,-7,6,-5,1,-13,11,-12,5,-3,7,-2,-6,7,-8,12,-7,-13,-7,-11,-12,1,-3,12,12,2,-6,3,0,-4,3,-2,-13,-1,-13,1,9,7,1,8,-6,1,-1,3,12,9,1,12,6,-1,-9,-1,3,-13,-13,-10,5,7,7,10,12,12,-5,12,9,6,3,7,11,5,-13,6,10,2,-12,2,3,3,8,4,-6,2,6,12,-13,9,-12,10,3,-8,4,-7,9,-11,12,-4,-6,1,12,2,-8,6,-9,7,-4,2,3,3,-2,6,3,11,0,3,-3,8,-8,7,8,9,3,-11,-5,-6,-4,-10,11,-5,10,-5,-8,-3,12,-10,5,-9,0,8,-1,12,-6,4,-6,6,-11,-10,12,-8,7,4,-2,6,7,-2,0,-2,12,-5,-8,-5,2,7,-6,10,12,-9,-13,-8,-8,-5,-13,-5,-2,8,-8,9,-13,-9,-11,-9,0,1,-8,1,-2,7,-4,9,1,-2,1,-1,-4,11,-6,12,-11,-12,-9,-6,4,3,7,7,12,5,5,10,8,0,-4,2,8,-9,12,-5,-13,0,7,2,12,-1,2,1,7,5,11,7,-9,3,5,6,-8,-13,-4,-8,9,-5,9,-3,-3,-4,-7,-3,-12,6,5,8,0,-7,6,-6,12,-13,6,-5,-2,1,-10,3,10,4,1,8,-4,-2,-2,2,-13,2,-12,12,12,-2,-13,0,-6,4,1,9,3,-6,-10,-3,-5,-3,-13,-1,1,7,5,12,-11,4,-2,5,-7,-13,9,-9,-5,7,1,8,6,7,-8,7,6,-7,-4,-7,1,-8,11,-7,-8,-13,6,-12,-8,2,4,3,9,10,-5,12,3,-6,-5,-6,7,8,-3,9,-8,2,-12,2,8,-11,-2,-10,3,-12,-13,-7,-9,-11,0,-10,-5,5,-3,11,8,-2,-13,-1,12,-1,-8,0,9,-13,-11,-12,-5,-10,-2,-10,11,-3,9,-2,-13,2,-3,3,2,-9,-13,-4,0,-4,6,-3,-10,-4,12,-2,-7,-6,-11,-4,9,6,-3,6,11,-13,11,-5,5,11,11,12,6,7,-5,12,-2,-1,12,0,7,-4,-8,-3,-2,-7,1,-6,7,-13,-12,-8,-13,-7,-2,-6,-8,-8,5,-6,-9,-5,-1,-4,5,-13,7,-8,10,1,5,5,-13,1,0,10,-13,9,12,10,-1,5,-8,10,-9,-1,11,1,-13,-9,-3,-6,2,-1,-10,1,12,-13,1,-8,-10,8,-11,10,-6,2,-13,3,-6,7,-13,12,-9,-10,-10,-5,-7,-10,-8,-8,-13,4,-6,8,5,3,12,8,-13,-4,2,-3,-3,5,-13,10,-12,4,-13,5,-1,-9,9,-4,3,0,3,3,-9,-12,1,-6,1,3,2,4,-8,-10,-10,-10,9,8,-13,12,12,-8,-12,-6,-5,2,2,3,7,10,6,11,-8,6,8,8,-12,-7,10,-6,5,-3,-9,-3,9,-1,-13,-1,5,-3,-7,-3,4,-8,-2,-8,3,4,2,12,12,2,-5,3,11,6,-9,11,-13,3,-1,7,12,11,-1,12,4,-3,0,-3,6,4,-11,4,12,2,-4,2,1,-10,-6,-8,1,-13,7,-11,1,-13,12,-11,-13,6,0,11,-13,0,-1,1,4,-13,3,-9,-2,-9,8,-6,-3,-13,-6,-8,-2,5,-9,8,10,2,7,3,-9,-1,-6,-1,-1,9,5,11,-2,11,-3,12,-8,3,0,3,5,-1,4,0,10,3,-6,4,5,-13,0,-10,5,5,8,12,11,8,9,9,-6,7,-4,8,-12,-10,4,-10,9,7,3,12,4,9,-7,10,-2,7,0,12,-2,-1,-6,0,-11]),b=new c.matrix_t(3,3,c.F32_t|c.C1_t),d=new c.matrix_t(32,32,c.U8_t|c.C1_t),e=function(a,d,e,f,g,h){ var i=Math.cos(e),j=Math.sin(e);b.data[0]=i,b.data[1]=-j,b.data[2]=(-i+j)*h*.5+f,b.data[3]=j,b.data[4]=i,b.data[5]=(-j-i)*h*.5+g,c.imgproc.warp_affine(a,d,b,128)};return{describe:function(b,f,g,h){var i=32,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=(b.data,b.cols,b.rows,d.data),s=528,t=0;h.type&c.U8_t?h.resize(i,g,1):(h.type=c.U8_t,h.cols=i,h.rows=g,h.channel=1,h.allocate());var u=h.data,v=0;for(j=0;g>j;++j){for(l=f[j].x,m=f[j].y,n=f[j].angle,e(b,d,n,l,m,32),t=0,k=0;i>k;++k)o=r[s+32*a[t+1]+a[t]],t+=2,p=r[s+32*a[t+1]+a[t]],t+=2,q=p>o|0,o=r[s+32*a[t+1]+a[t]],t+=2,p=r[s+32*a[t+1]+a[t]],t+=2,q|=(p>o)<<1,o=r[s+32*a[t+1]+a[t]],t+=2,p=r[s+32*a[t+1]+a[t]],t+=2,q|=(p>o)<<2,o=r[s+32*a[t+1]+a[t]],t+=2,p=r[s+32*a[t+1]+a[t]],t+=2,q|=(p>o)<<3,o=r[s+32*a[t+1]+a[t]],t+=2,p=r[s+32*a[t+1]+a[t]],t+=2,q|=(p>o)<<4,o=r[s+32*a[t+1]+a[t]],t+=2,p=r[s+32*a[t+1]+a[t]],t+=2,q|=(p>o)<<5,o=r[s+32*a[t+1]+a[t]],t+=2,p=r[s+32*a[t+1]+a[t]],t+=2,q|=(p>o)<<6,o=r[s+32*a[t+1]+a[t]],t+=2,p=r[s+32*a[t+1]+a[t]],t+=2,q|=(p>o)<<7,u[v+k]=q;v+=i}}}}();a.orb=b}(c),function(a){var b=function(){var a=c.imgproc.scharr_derivatives;return{track:function(b,d,e,f,g,h,i,j,k,l){"undefined"==typeof i&&(i=30),"undefined"==typeof j&&(j=new Uint8Array(g)),"undefined"==typeof k&&(k=.01),"undefined"==typeof l&&(l=1e-4);var m=.5*(h-1),n=h*h|0,o=n<<1,p=b.data,q=d.data,r=p[0].data,s=q[0].data,t=p[0].cols,u=p[0].rows,v=0,w=0,x=c.cache.get_buffer(n<<2),y=c.cache.get_buffer(o<<2),z=c.cache.get_buffer(u*(t<<1)<<2),A=new c.matrix_t(t,u,c.S32C2_t,z.data),B=x.i32,C=y.i32,D=z.i32,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=14,ka=14,la=ka-5,ma=1<X;++X)j[X]=1;var Da=b.levels-1|0;for(_=Da;_>=0;--_)for(K=1/(1<<_),v=t>>_,w=u>>_,E=v<<1,r=p[_].data,s=q[_].data,da=v-h|0,ea=w-h|0,a(p[_],A),aa=0;g>aa;++aa)if(X=aa<<1,Y=X+1,L=e[X]*K,M=e[Y]*K,_==Da?(N=L,O=M):(N=2*f[X],O=2*f[Y]),f[X]=N,f[Y]=O,L-=m,M-=m,T=0|L,U=0|M,Z=ca>=T|T>=da|ca>=U|U>=ea,0==Z){for(fa=L-T,ga=M-U,qa=(1-fa)*(1-ga)*na+.5|0,ra=fa*(1-ga)*na+.5|0,sa=(1-fa)*ga*na+.5|0,ta=na-qa-ra-sa,xa=0,ya=0,za=0,$=0;h>$;++$)for(F=($+U)*v+T|0,G=F<<1,H=$*h|0,I=H<<1,Z=0;h>Z;++Z,++F,++H,G+=2)ua=r[F]*qa+r[F+1]*ra+r[F+v]*sa+r[F+v+1]*ta,ua=ua+ma>>la,va=D[G]*qa+D[G+2]*ra+D[G+E]*sa+D[G+E+2]*ta,va=va+oa>>ka,wa=D[G+1]*qa+D[G+3]*ra+D[G+E+1]*sa+D[G+E+3]*ta,wa=wa+oa>>ka,B[H]=ua,C[I++]=va,C[I++]=wa,xa+=va*va,ya+=va*wa,za+=wa*wa;if(xa*=pa,ya*=pa,za*=pa,Aa=xa*za-ya*ya,Ba=(za+xa-Math.sqrt((xa-za)*(xa-za)+4*ya*ya))/o,l>Ba||Ca>Aa)0==_&&(j[aa]=0);else for(Aa=1/Aa,N-=m,O-=m,P=0,Q=0,ba=0;i>ba;++ba){if(V=0|N,W=0|O,Z=ca>=V|V>=da|ca>=W|W>=ea,0!=Z){0==_&&(j[aa]=0);break}for(fa=N-V,ga=O-W,qa=(1-fa)*(1-ga)*na+.5|0,ra=fa*(1-ga)*na+.5|0,sa=(1-fa)*ga*na+.5|0,ta=na-qa-ra-sa,ha=0,ia=0,$=0;h>$;++$)for(J=($+W)*v+V|0,H=$*h|0,I=H<<1,Z=0;h>Z;++Z,++J,++H)ua=s[J]*qa+s[J+1]*ra+s[J+v]*sa+s[J+v+1]*ta,ua=ua+ma>>la,ua-=B[H],ha+=ua*C[I++],ia+=ua*C[I++];if(ha*=pa,ia*=pa,R=(ya*ia-za*ha)*Aa,S=(ya*ha-xa*ia)*Aa,N+=R,O+=S,f[X]=N+m,f[Y]=O+m,k>=R*R+S*S)break;if(ba>0&&Math.abs(R+P)<.01&&Math.abs(S+Q)<.01){f[X]-=.5*R,f[Y]-=.5*S;break}P=R,Q=S}}else 0==_&&(j[aa]=0);c.cache.put_buffer(x),c.cache.put_buffer(y),c.cache.put_buffer(z)}}}();a.optical_flow_lk=b}(c),function(a){var b=function(){var a=function(a,b){var c=.25*a.width+.5|0;return b.x<=a.x+c&&b.x>=a.x-c&&b.y<=a.y+c&&b.y>=a.y-c&&b.width<=1.5*a.width+.5|0&&1.5*b.width+.5|0>=a.width};return{edges_density:.07,detect_single_scale:function(a,b,c,d,e,f,g,h){var i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=h.size[0]*g|0,J=h.size[1]*g|0,K=.5*g+1.5|0,L=K,M=e-I|0,N=f-J|0,O=e+1|0,P=1/(I*J),Q=!0,R=0,S=I,T=J*O,U=T+I,V=I*J*255*this.edges_density|0,W=[];for(m=0;N>m;m+=L)for(R=m*O,l=0;M>l;l+=K,R+=K)if(o=a[R]-a[R+S]-a[R+T]+a[R+U],d&&(n=d[R]-d[R+S]-d[R+T]+d[R+U],V>n||20>o))l+=K,R+=K;else{for(o*=P,p=(b[R]-b[R+S]-b[R+T]+b[R+U])*P-o*o,q=p>0?Math.sqrt(p):1,r=h.complexClassifiers,v=r.length,Q=!0,i=0;v>i;++i){for(s=r[i],y=s.threshold,t=s.simpleClassifiers,w=t.length,z=0,j=0;w>j;++j){if(u=t[j],A=0,C=u.features,x=C.length,1===u.tilted)for(k=0;x>k;++k)B=C[k],D=~~(l+B[0]*g)+~~(m+B[1]*g)*O,G=~~(B[2]*g),H=~~(B[3]*g),E=G*O,F=H*O,A+=(c[D]-c[D+G+E]-c[D-H+F]+c[D+G-H+E+F])*B[4];else for(k=0;x>k;++k)B=C[k],D=~~(l+B[0]*g)+~~(m+B[1]*g)*O,G=~~(B[2]*g),H=~~(B[3]*g),F=H*O,A+=(a[D]-a[D+G]-a[D+F]+a[D+F+G])*B[4];z+=A*Pz){Q=!1;break}}Q&&(W.push({x:l,y:m,width:I,height:J,neighbor:1,confidence:z}),l+=K,R+=K)}return W},detect_multi_scale:function(a,b,c,d,e,f,g,h,i){"undefined"==typeof h&&(h=1.2),"undefined"==typeof i&&(i=1);for(var j=g.size[0],k=g.size[1],l=[];e>i*j&&f>i*k;)l=l.concat(this.detect_single_scale(a,b,c,d,e,f,i,g)),i*=h;return l},group_rectangles:function(b,c){"undefined"==typeof c&&(c=1);var d,e,f=b.length,g=[];for(d=0;f>d;++d)g[d]={parent:-1,element:b[d],rank:0};for(d=0;f>d;++d)if(g[d].element){for(var h=d;-1!=g[h].parent;)h=g[h].parent;for(e=0;f>e;++e)if(d!=e&&g[e].element&&a(g[d].element,g[e].element)){for(var i=e;-1!=g[i].parent;)i=g[i].parent;if(i!=h){g[h].rank>g[i].rank?g[i].parent=h:(g[h].parent=i,g[h].rank==g[i].rank&&g[i].rank++,h=i);for(var j,k=e;-1!=g[k].parent;)j=k,k=g[k].parent,g[j].parent=h;for(k=d;-1!=g[k].parent;)j=k,k=g[k].parent,g[j].parent=h}}}var l=[],m=0;for(d=0;f>d;d++){e=-1;var n=d;if(g[n].element){for(;-1!=g[n].parent;)n=g[n].parent;g[n].rank>=0&&(g[n].rank=~m++),e=~g[n].rank}l[d]=e}var o=[];for(d=0;m+1>d;++d)o[d]={neighbors:0,x:0,y:0,width:0,height:0,confidence:0};for(d=0;f>d;++d){var p=b[d],q=l[d];0==o[q].neighbors&&(o[q].confidence=p.confidence),++o[q].neighbors,o[q].x+=p.x,o[q].y+=p.y,o[q].width+=p.width,o[q].height+=p.height,o[q].confidence=Math.max(o[q].confidence,p.confidence)}var r=[];for(d=0;m>d;++d)f=o[d].neighbors,f>=c&&r.push({x:(2*o[d].x+f)/(2*f),y:(2*o[d].y+f)/(2*f),width:(2*o[d].width+f)/(2*f),height:(2*o[d].height+f)/(2*f),neighbors:o[d].neighbors,confidence:o[d].confidence});var s=[];for(f=r.length,d=0;f>d;++d){var p=r[d],t=!0;for(e=0;f>e;++e){var u=r[e],v=.25*u.width+.5|0;if(d!=e&&p.x>=u.x-v&&p.y>=u.y-v&&p.x+p.width<=u.x+u.width+v&&p.y+p.height<=u.y+u.height+v&&(u.neighbors>Math.max(3,p.neighbors)||p.neighbors<3)){t=!1;break}}t&&s.push(p)}return s}}}();a.haar=b}(c),function(a){var b=function(){var a=function(a,b){var c=.25*a.width+.5|0;return b.x<=a.x+c&&b.x>=a.x-c&&b.y<=a.y+c&&b.y>=a.y-c&&b.width<=1.5*a.width+.5|0&&1.5*b.width+.5|0>=a.width},b=new c.pyramid_t(1);return{interval:4,scale:1.1486,next:5,scale_to:1,prepare_cascade:function(a){for(var b=a.stage_classifier.length,c=0;b>c;c++)for(var d=a.stage_classifier[c].feature,e=a.stage_classifier[c].count,f=a.stage_classifier[c]._feature=new Array(e),g=0;e>g;g++)f[g]={size:d[g].size,px:new Array(d[g].size),pz:new Array(d[g].size),nx:new Array(d[g].size),nz:new Array(d[g].size)}},build_pyramid:function(a,d,e,f){"undefined"==typeof f&&(f=4);var g=a.cols,h=a.rows,i=0,j=0,k=0,l=!1,m=a,n=a,o=c.U8_t|c.C1_t;this.interval=f,this.scale=Math.pow(2,1/(this.interval+1)),this.next=this.interval+1|0,this.scale_to=Math.log(Math.min(g/d,h/e))/Math.log(this.scale)|0;var p=4*(this.scale_to+2*this.next)|0;for(b.levels!=p&&(b.levels=p,b.data=new Array(p),l=!0,b.data[0]=a),i=1;i<=this.interval;++i)j=g/Math.pow(this.scale,i)|0,k=h/Math.pow(this.scale,i)|0,m=b.data[i<<2],(l||j!=m.cols||k!=m.rows)&&(b.data[i<<2]=new c.matrix_t(j,k,o),m=b.data[i<<2]),c.imgproc.resample(a,m,j,k);for(i=this.next;i>1,k=n.rows>>1,(l||j!=m.cols||k!=m.rows)&&(b.data[i<<2]=new c.matrix_t(j,k,o),m=b.data[i<<2]),c.imgproc.pyrdown(n,m);for(i=2*this.next;i>1,k=n.rows>>1,m=b.data[(i<<2)+1],(l||j!=m.cols||k!=m.rows)&&(b.data[(i<<2)+1]=new c.matrix_t(j,k,o),m=b.data[(i<<2)+1]),c.imgproc.pyrdown(n,m,1,0),m=b.data[(i<<2)+2],(l||j!=m.cols||k!=m.rows)&&(b.data[(i<<2)+2]=new c.matrix_t(j,k,o),m=b.data[(i<<2)+2]),c.imgproc.pyrdown(n,m,0,1),m=b.data[(i<<2)+3],(l||j!=m.cols||k!=m.rows)&&(b.data[(i<<2)+3]=new c.matrix_t(j,k,o),m=b.data[(i<<2)+3]),c.imgproc.pyrdown(n,m,1,1);return b},detect:function(a,b){var c,d,e,f,g,h=(this.interval,this.scale),i=this.next,j=this.scale_to,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=!0,D=!0,E=1,F=1,G=[0,1,0,1],H=[0,0,1,1],I=[],J=a.data,K=1,L=2,M=4,N=[],O=[0,0,0],P=[0,0,0],Q=[0,0,0];for(k=0;j>k;k++){for(y=k<<2,z=J[y+(i<<3)].cols-(b.width>>2),A=J[y+(i<<3)].rows-(b.height>>2),P[0]=J[y].cols*K,P[1]=J[y+(i<<2)].cols*K,P[2]=J[y+(i<<3)].cols*K,Q[0]=J[y].cols*M-z*M,Q[1]=J[y+(i<<2)].cols*L-z*L,Q[2]=J[y+(i<<3)].cols*K-z*K,r=b.stage_classifier.length,l=0;r>l;l++)for(e=b.stage_classifier[l].feature,d=b.stage_classifier[l]._feature,s=b.stage_classifier[l].count,m=0;s>m;m++)for(f=d[m],g=e[m],t=0|g.size,q=0;t>q;q++)f.px[q]=g.px[q]*K+g.py[q]*P[g.pz[q]],f.pz[q]=g.pz[q],f.nx[q]=g.nx[q]*K+g.ny[q]*P[g.nz[q]],f.nz[q]=g.nz[q];for(N[0]=J[y].data,N[1]=J[y+(i<<2)].data,q=0;4>q;q++)for(N[2]=J[y+(i<<3)+q].data,O[0]=G[q]*L+H[q]*J[y].cols*L,O[1]=G[q]*K+H[q]*J[y+(i<<2)].cols*K,O[2]=0,p=0;A>p;p++){for(o=0;z>o;o++){for(B=0,C=!0,r=b.stage_classifier.length,l=0;r>l;l++){for(B=0,c=b.stage_classifier[l].alpha,d=b.stage_classifier[l]._feature,s=b.stage_classifier[l].count,m=0;s>m;m++)if(f=d[m],v=N[f.pz[0]][O[f.pz[0]]+f.px[0]],w=N[f.nz[0]][O[f.nz[0]]+f.nx[0]],w>=v)B+=c[m<<1];else{for(D=!0,t=f.size,x=1;t>x;x++){if(f.pz[x]>=0&&(u=N[f.pz[x]][O[f.pz[x]]+f.px[x]],v>u)){if(w>=u){D=!1;break}v=u}if(f.nz[x]>=0&&(n=N[f.nz[x]][O[f.nz[x]]+f.nx[x]],n>w)){if(n>=v){D=!1;break}w=n}}B+=D?c[(m<<1)+1]:c[m<<1]}if(Bd;++d)g[d]={parent:-1,element:b[d],rank:0};for(d=0;f>d;++d)if(g[d].element){for(var h=d;-1!=g[h].parent;)h=g[h].parent;for(e=0;f>e;++e)if(d!=e&&g[e].element&&a(g[d].element,g[e].element)){for(var i=e;-1!=g[i].parent;)i=g[i].parent;if(i!=h){g[h].rank>g[i].rank?g[i].parent=h:(g[h].parent=i,g[h].rank==g[i].rank&&g[i].rank++,h=i);for(var j,k=e;-1!=g[k].parent;)j=k,k=g[k].parent,g[j].parent=h;for(k=d;-1!=g[k].parent;)j=k,k=g[k].parent,g[j].parent=h}}}var l=[],m=0;for(d=0;f>d;d++){e=-1;var n=d;if(g[n].element){for(;-1!=g[n].parent;)n=g[n].parent;g[n].rank>=0&&(g[n].rank=~m++),e=~g[n].rank}l[d]=e}var o=[];for(d=0;m+1>d;++d)o[d]={neighbors:0,x:0,y:0,width:0,height:0,confidence:0};for(d=0;f>d;++d){var p=b[d],q=l[d];0==o[q].neighbors&&(o[q].confidence=p.confidence),++o[q].neighbors,o[q].x+=p.x,o[q].y+=p.y,o[q].width+=p.width,o[q].height+=p.height,o[q].confidence=Math.max(o[q].confidence,p.confidence)}var r=[];for(d=0;m>d;++d)f=o[d].neighbors,f>=c&&r.push({x:(2*o[d].x+f)/(2*f),y:(2*o[d].y+f)/(2*f),width:(2*o[d].width+f)/(2*f),height:(2*o[d].height+f)/(2*f),neighbors:o[d].neighbors,confidence:o[d].confidence});var s=[];for(f=r.length,d=0;f>d;++d){var p=r[d],t=!0;for(e=0;f>e;++e){var u=r[e],v=.25*u.width+.5|0;if(d!=e&&p.x>=u.x-v&&p.y>=u.y-v&&p.x+p.width<=u.x+u.width+v&&p.y+p.height<=u.y+u.height+v&&(u.neighbors>Math.max(3,p.neighbors)||p.neighbors<3)){t=!1;break}}t&&s.push(p)}return s}}}();a.bbf=b}(c),function(a){"undefined"==typeof module||"undefined"==typeof module.exports?b.jsfeat=a:module.exports=a}(c),function(a){a.frontalface={complexClassifiers:[{simpleClassifiers:[{features:[[3,7,14,4,-1],[3,9,14,2,2]],threshold:.004014195874333382,right_val:.8378106951713562,left_val:.0337941907346249},{features:[[1,2,18,4,-1],[7,2,6,4,3]],threshold:.0151513395830989,right_val:.7488812208175659,left_val:.1514132022857666},{features:[[1,7,15,9,-1],[1,10,15,3,3]],threshold:.004210993181914091,right_val:.6374819874763489,left_val:.0900492817163467}],threshold:.822689414024353},{simpleClassifiers:[{features:[[5,6,2,6,-1],[5,9,2,3,2]],threshold:.0016227109590545297,right_val:.7110946178436279,left_val:.0693085864186287},{features:[[7,5,6,3,-1],[9,5,2,3,3]],threshold:.002290664939209819,right_val:.6668692231178284,left_val:.1795803010463715},{features:[[4,0,12,9,-1],[4,3,12,3,3]],threshold:.005002570804208517,right_val:.6554006934165955,left_val:.1693672984838486},{features:[[6,9,10,8,-1],[6,13,10,4,2]],threshold:.007965989410877228,right_val:.0914145186543465,left_val:.5866332054138184},{features:[[3,6,14,8,-1],[3,10,14,4,2]],threshold:-.003522701095789671,right_val:.6031895875930786,left_val:.1413166970014572},{features:[[14,1,6,10,-1],[14,1,3,10,2]],threshold:.0366676896810532,right_val:.7920318245887756,left_val:.3675672113895416},{features:[[7,8,5,12,-1],[7,12,5,4,3]],threshold:.009336147457361221,right_val:.2088509947061539,left_val:.6161385774612427},{features:[[1,1,18,3,-1],[7,1,6,3,3]],threshold:.008696131408214569,right_val:.6360273957252502,left_val:.2836230993270874},{features:[[1,8,17,2,-1],[1,9,17,1,2]],threshold:.0011488880263641477,right_val:.5800700783729553,left_val:.2223580926656723},{features:[[16,6,4,2,-1],[16,7,4,1,2]],threshold:-.002148468978703022,right_val:.5787054896354675,left_val:.2406464070081711},{features:[[5,17,2,2,-1],[5,18,2,1,2]],threshold:.002121906029060483,right_val:.136223703622818,left_val:.5559654831886292},{features:[[14,2,6,12,-1],[14,2,3,12,2]],threshold:-.0939491465687752,right_val:.4717740118503571,left_val:.8502737283706665},{features:[[4,0,4,12,-1],[4,0,2,6,2],[6,6,2,6,2]],threshold:.0013777789426967502,right_val:.2834529876708984,left_val:.5993673801422119},{features:[[2,11,18,8,-1],[8,11,6,8,3]],threshold:.0730631574988365,right_val:.7060034275054932,left_val:.4341886043548584},{features:[[5,7,10,2,-1],[5,8,10,1,2]],threshold:.00036767389974556863,right_val:.6051574945449829,left_val:.3027887940406799},{features:[[15,11,5,3,-1],[15,12,5,1,3]],threshold:-.0060479710809886456,right_val:.5675256848335266,left_val:.17984339594841}],threshold:6.956608772277832},{simpleClassifiers:[{features:[[5,3,10,9,-1],[5,6,10,3,3]],threshold:-.0165106896311045,right_val:.1424857974052429,left_val:.6644225120544434},{features:[[9,4,2,14,-1],[9,11,2,7,2]],threshold:.002705249935388565,right_val:.1288477033376694,left_val:.6325352191925049},{features:[[3,5,4,12,-1],[3,9,4,4,3]],threshold:.002806986914947629,right_val:.6193193197250366,left_val:.1240288019180298},{features:[[4,5,12,5,-1],[8,5,4,5,3]],threshold:-.0015402400167658925,right_val:.5670015811920166,left_val:.1432143002748489},{features:[[5,6,10,8,-1],[5,10,10,4,2]],threshold:-.0005638627917505801,right_val:.5905207991600037,left_val:.1657433062791824},{features:[[8,0,6,9,-1],[8,3,6,3,3]],threshold:.0019253729842603207,right_val:.5738824009895325,left_val:.2695507109165192},{features:[[9,12,1,8,-1],[9,16,1,4,2]],threshold:-.005021484103053808,right_val:.5782774090766907,left_val:.1893538981676102},{features:[[0,7,20,6,-1],[0,9,20,2,3]],threshold:.0026365420781075954,right_val:.5695425868034363,left_val:.2309329062700272},{features:[[7,0,6,17,-1],[9,0,2,17,3]],threshold:-.0015127769438549876,right_val:.5956642031669617,left_val:.2759602069854736},{features:[[9,0,6,4,-1],[11,0,2,4,3]],threshold:-.0101574398577213,right_val:.5522047281265259,left_val:.1732538044452667},{features:[[5,1,6,4,-1],[7,1,2,4,3]],threshold:-.011953660286963,right_val:.5559014081954956,left_val:.1339409947395325},{features:[[12,1,6,16,-1],[14,1,2,16,3]],threshold:.004885949194431305,right_val:.6188849210739136,left_val:.3628703951835632},{features:[[0,5,18,8,-1],[0,5,9,4,2],[9,9,9,4,2]],threshold:-.0801329165697098,right_val:.5475944876670837,left_val:.0912110507488251},{features:[[8,15,10,4,-1],[13,15,5,2,2],[8,17,5,2,2]],threshold:.0010643280111253262,right_val:.5711399912834167,left_val:.3715142905712128},{features:[[3,1,4,8,-1],[3,1,2,4,2],[5,5,2,4,2]],threshold:-.0013419450260698795,right_val:.331809788942337,left_val:.5953313708305359},{features:[[3,6,14,10,-1],[10,6,7,5,2],[3,11,7,5,2]],threshold:-.0546011403203011,right_val:.5602846145629883,left_val:.1844065934419632},{features:[[2,1,6,16,-1],[4,1,2,16,3]],threshold:.0029071690514683723,right_val:.6131715178489685,left_val:.3594244122505188},{features:[[0,18,20,2,-1],[0,19,20,1,2]],threshold:.0007471871795132756,right_val:.3459562957286835,left_val:.5994353294372559},{features:[[8,13,4,3,-1],[8,14,4,1,3]],threshold:.004301380831748247,right_val:.6990845203399658,left_val:.4172652065753937},{features:[[9,14,2,3,-1],[9,15,2,1,3]],threshold:.004501757211983204,right_val:.7801457047462463,left_val:.4509715139865875},{features:[[0,12,9,6,-1],[0,14,9,2,3]],threshold:.0241385009139776,right_val:.1319826990365982,left_val:.5438212752342224}],threshold:9.498542785644531},{simpleClassifiers:[{features:[[5,7,3,4,-1],[5,9,3,2,2]],threshold:.001921223010867834,right_val:.6199870705604553,left_val:.1415266990661621},{features:[[9,3,2,16,-1],[9,11,2,8,2]],threshold:-.00012748669541906565,right_val:.1884928941726685,left_val:.6191074252128601},{features:[[3,6,13,8,-1],[3,10,13,4,2]],threshold:.0005140993162058294,right_val:.5857927799224854,left_val:.1487396955490112},{features:[[12,3,8,2,-1],[12,3,4,2,2]],threshold:.004187860991805792,right_val:.6359239816665649,left_val:.2746909856796265},{features:[[8,8,4,12,-1],[8,12,4,4,3]],threshold:.005101571790874004,right_val:.2175628989934921,left_val:.5870851278305054},{features:[[11,3,8,6,-1],[15,3,4,3,2],[11,6,4,3,2]],threshold:-.002144844038411975,right_val:.2979590892791748,left_val:.5880944728851318},{features:[[7,1,6,19,-1],[9,1,2,19,3]],threshold:-.0028977119363844395,right_val:.5876647233963013,left_val:.2373327016830444},{features:[[9,0,6,4,-1],[11,0,2,4,3]],threshold:-.0216106791049242,right_val:.5194202065467834,left_val:.1220654994249344},{features:[[3,1,9,3,-1],[6,1,3,3,3]],threshold:-.004629931878298521,right_val:.5817409157752991,left_val:.263123095035553},{features:[[8,15,10,4,-1],[13,15,5,2,2],[8,17,5,2,2]],threshold:.000593937118537724,right_val:.5698544979095459,left_val:.363862007856369},{features:[[0,3,6,10,-1],[3,3,3,10,2]],threshold:.0538786612451077,right_val:.7559366226196289,left_val:.4303531050682068},{features:[[3,4,15,15,-1],[3,9,15,5,3]],threshold:.0018887349870055914,right_val:.561342716217041,left_val:.2122603058815002},{features:[[6,5,8,6,-1],[6,7,8,2,3]],threshold:-.0023635339457541704,right_val:.2642767131328583,left_val:.563184916973114},{features:[[4,4,12,10,-1],[10,4,6,5,2],[4,9,6,5,2]],threshold:.0240177996456623,right_val:.2751705944538117,left_val:.5797107815742493},{features:[[6,4,4,4,-1],[8,4,2,4,2]],threshold:.00020543030404951423,right_val:.575256884098053,left_val:.2705242037773132},{features:[[15,11,1,2,-1],[15,12,1,1,2]],threshold:.0008479019743390381,right_val:.2334876954555512,left_val:.5435624718666077},{features:[[3,11,2,2,-1],[3,12,2,1,2]],threshold:.0014091329649090767,right_val:.2063155025243759,left_val:.5319424867630005},{features:[[16,11,1,3,-1],[16,12,1,1,3]],threshold:.0014642629539594054,right_val:.3068861067295075,left_val:.5418980717658997},{features:[[3,15,6,4,-1],[3,15,3,2,2],[6,17,3,2,2]],threshold:.0016352549428120255,right_val:.6112868189811707,left_val:.3695372939109802},{features:[[6,7,8,2,-1],[6,8,8,1,2]],threshold:.0008317275205627084,right_val:.6025236248970032,left_val:.3565036952495575},{features:[[3,11,1,3,-1],[3,12,1,1,3]],threshold:-.0020998890977352858,right_val:.5362827181816101,left_val:.1913982033729553},{features:[[6,0,12,2,-1],[6,1,12,1,2]],threshold:-.0007421398186124861,right_val:.552931010723114,left_val:.3835555016994476},{features:[[9,14,2,3,-1],[9,15,2,1,3]],threshold:.0032655049581080675,right_val:.7101895809173584,left_val:.4312896132469177},{features:[[7,15,6,2,-1],[7,16,6,1,2]],threshold:.0008913499186746776,right_val:.6391963958740234,left_val:.3984830975532532},{features:[[0,5,4,6,-1],[0,7,4,2,3]],threshold:-.0152841797098517,right_val:.5433713793754578,left_val:.2366732954978943},{features:[[4,12,12,2,-1],[8,12,4,2,3]],threshold:.004838141147047281,right_val:.3239189088344574,left_val:.5817500948905945},{features:[[6,3,1,9,-1],[6,6,1,3,3]],threshold:-.0009109317907132208,right_val:.2911868989467621,left_val:.5540593862533569},{features:[[10,17,3,2,-1],[11,17,1,2,3]],threshold:-.006127506028860807,right_val:.5196629166603088,left_val:.1775255054235458},{features:[[9,9,2,2,-1],[9,10,2,1,2]],threshold:-.00044576259097084403,right_val:.5533593893051147,left_val:.3024170100688934},{features:[[7,6,6,4,-1],[9,6,2,4,3]],threshold:.0226465407758951,right_val:.6975377202033997,left_val:.4414930939674377},{features:[[7,17,3,2,-1],[8,17,1,2,3]],threshold:-.0018804960418492556,right_val:.5497952103614807,left_val:.2791394889354706},{features:[[10,17,3,3,-1],[11,17,1,3,3]],threshold:.007088910788297653,right_val:.2385547012090683,left_val:.5263199210166931},{features:[[8,12,3,2,-1],[8,13,3,1,2]],threshold:.0017318050377070904,right_val:.6983600854873657,left_val:.4319379031658173},{features:[[9,3,6,2,-1],[11,3,2,2,3]],threshold:-.006848270073533058,right_val:.5390920042991638,left_val:.3082042932510376},{features:[[3,11,14,4,-1],[3,13,14,2,2]],threshold:-15062530110299122e-21,right_val:.3120366036891937,left_val:.552192211151123},{features:[[1,10,18,4,-1],[10,10,9,2,2],[1,12,9,2,2]],threshold:.0294755697250366,right_val:.1770603060722351,left_val:.5401322841644287},{features:[[0,10,3,3,-1],[0,11,3,1,3]],threshold:.008138732984662056,right_val:.121101900935173,left_val:.5178617835044861},{features:[[9,1,6,6,-1],[11,1,2,6,3]],threshold:.0209429506212473,right_val:.3311221897602081,left_val:.5290294289588928},{features:[[8,7,3,6,-1],[9,7,1,6,3]],threshold:-.009566552937030792,right_val:.4451968967914581,left_val:.7471994161605835}],threshold:18.4129695892334},{simpleClassifiers:[{features:[[1,0,18,9,-1],[1,3,18,3,3]],threshold:-.00028206960996612906,right_val:.6076732277870178,left_val:.2064086049795151},{features:[[12,10,2,6,-1],[12,13,2,3,2]],threshold:.00167906004935503,right_val:.1255383938550949,left_val:.5851997137069702},{features:[[0,5,19,8,-1],[0,9,19,4,2]],threshold:.0006982791237533092,right_val:.5728961229324341,left_val:.094018429517746},{features:[[7,0,6,9,-1],[9,0,2,9,3]],threshold:.0007895901217125356,right_val:.5694308876991272,left_val:.1781987994909287},{features:[[5,3,6,1,-1],[7,3,2,1,3]],threshold:-.002856049919500947,right_val:.5788664817810059,left_val:.1638399064540863},{features:[[11,3,6,1,-1],[13,3,2,1,3]],threshold:-.0038122469559311867,right_val:.5508564710617065,left_val:.2085440009832382},{features:[[5,10,4,6,-1],[5,13,4,3,2]],threshold:.0015896620461717248,right_val:.1857215017080307,left_val:.5702760815620422},{features:[[11,3,6,1,-1],[13,3,2,1,3]],threshold:.0100783398374915,right_val:.2189770042896271,left_val:.5116943120956421},{features:[[4,4,12,6,-1],[4,6,12,2,3]],threshold:-.0635263025760651,right_val:.4043813049793243,left_val:.7131379842758179},{features:[[15,12,2,6,-1],[15,14,2,2,3]],threshold:-.009103149175643921,right_val:.54639732837677,left_val:.2567181885242462},{features:[[9,3,2,2,-1],[10,3,1,2,2]],threshold:-.002403500024229288,right_val:.559097409248352,left_val:.1700665950775147},{features:[[9,3,3,1,-1],[10,3,1,1,3]],threshold:.001522636041045189,right_val:.2619054019451141,left_val:.5410556793212891},{features:[[1,1,4,14,-1],[3,1,2,14,2]],threshold:.0179974399507046,right_val:.6535220742225647,left_val:.3732436895370483},{features:[[9,0,4,4,-1],[11,0,2,2,2],[9,2,2,2,2]],threshold:-.00645381910726428,right_val:.5537446141242981,left_val:.2626481950283051},{features:[[7,5,1,14,-1],[7,12,1,7,2]],threshold:-.0118807600811124,right_val:.5544745922088623,left_val:.2003753930330277},{features:[[19,0,1,4,-1],[19,2,1,2,2]],threshold:.0012713660253211856,right_val:.303197592496872,left_val:.5591902732849121},{features:[[5,5,6,4,-1],[8,5,3,4,2]],threshold:.0011376109905540943,right_val:.5646508932113647,left_val:.2730407118797302},{features:[[9,18,3,2,-1],[10,18,1,2,3]],threshold:-.00426519988104701,right_val:.5461820960044861,left_val:.1405909061431885},{features:[[8,18,3,2,-1],[9,18,1,2,3]],threshold:-.0029602861031889915,right_val:.5459290146827698,left_val:.1795035004615784},{features:[[4,5,12,6,-1],[4,7,12,2,3]],threshold:-.008844822645187378,right_val:.280921995639801,left_val:.5736783146858215},{features:[[3,12,2,6,-1],[3,14,2,2,3]],threshold:-.006643068976700306,right_val:.5503826141357422,left_val:.2370675951242447},{features:[[10,8,2,12,-1],[10,12,2,4,3]],threshold:.003999780863523483,right_val:.3304282128810883,left_val:.5608199834823608},{features:[[7,18,3,2,-1],[8,18,1,2,3]],threshold:-.004122172016650438,right_val:.5378993153572083,left_val:.1640105992555618},{features:[[9,0,6,2,-1],[11,0,2,2,3]],threshold:.0156249096617103,right_val:.2288603931665421,left_val:.5227649211883545},{features:[[5,11,9,3,-1],[5,12,9,1,3]],threshold:-.0103564197197557,right_val:.4252927899360657,left_val:.7016193866729736},{features:[[9,0,6,2,-1],[11,0,2,2,3]],threshold:-.008796080946922302,right_val:.5355830192565918,left_val:.2767347097396851},{features:[[1,1,18,5,-1],[7,1,6,5,3]],threshold:.1622693985700607,right_val:.744257926940918,left_val:.434224009513855},{features:[[8,0,4,4,-1],[10,0,2,2,2],[8,2,2,2,2]],threshold:.0045542530715465546,right_val:.2582125067710877,left_val:.5726485848426819},{features:[[3,12,1,3,-1],[3,13,1,1,3]],threshold:-.002130920998752117,right_val:.5361018776893616,left_val:.2106848061084747},{features:[[8,14,5,3,-1],[8,15,5,1,3]],threshold:-.0132084200158715,right_val:.4552468061447144,left_val:.7593790888786316},{features:[[5,4,10,12,-1],[5,4,5,6,2],[10,10,5,6,2]],threshold:-.0659966766834259,right_val:.5344039797782898,left_val:.125247597694397},{features:[[9,6,9,12,-1],[9,10,9,4,3]],threshold:.007914265617728233,right_val:.5601043105125427,left_val:.3315384089946747},{features:[[2,2,12,14,-1],[2,2,6,7,2],[8,9,6,7,2]],threshold:.0208942797034979,right_val:.2768838107585907,left_val:.5506049990653992}],threshold:15.324139595031738},{simpleClassifiers:[{features:[[4,7,12,2,-1],[8,7,4,2,3]],threshold:.0011961159761995077,right_val:.6156241297721863,left_val:.1762690991163254},{features:[[7,4,6,4,-1],[7,6,6,2,2]],threshold:-.0018679830245673656,right_val:.1832399964332581,left_val:.6118106842041016},{features:[[4,5,11,8,-1],[4,9,11,4,2]],threshold:-.00019579799845814705,right_val:.5723816156387329,left_val:.0990442633628845},{features:[[3,10,16,4,-1],[3,12,16,2,2]],threshold:-.0008025565766729414,right_val:.2377282977104187,left_val:.5579879879951477},{features:[[0,0,16,2,-1],[0,1,16,1,2]],threshold:-.0024510810617357492,right_val:.5858935117721558,left_val:.2231457978487015},{features:[[7,5,6,2,-1],[9,5,2,2,3]],threshold:.0005036185029894114,right_val:.5794103741645813,left_val:.2653993964195252},{features:[[3,2,6,10,-1],[3,2,3,5,2],[6,7,3,5,2]],threshold:.0040293349884450436,right_val:.2484865039587021,left_val:.5803827047348022},{features:[[10,5,8,15,-1],[10,10,8,5,3]],threshold:-.0144517095759511,right_val:.5484204888343811,left_val:.1830351948738098},{features:[[3,14,8,6,-1],[3,14,4,3,2],[7,17,4,3,2]],threshold:.0020380979403853416,right_val:.6051092743873596,left_val:.3363558948040009},{features:[[14,2,2,2,-1],[14,3,2,1,2]],threshold:-.0016155190533027053,right_val:.5441246032714844,left_val:.2286642044782639},{features:[[1,10,7,6,-1],[1,13,7,3,2]],threshold:.0033458340913057327,right_val:.2392338067293167,left_val:.5625913143157959},{features:[[15,4,4,3,-1],[15,4,2,3,2]],threshold:.0016379579901695251,right_val:.5964621901512146,left_val:.3906993865966797},{features:[[2,9,14,6,-1],[2,9,7,3,2],[9,12,7,3,2]],threshold:.0302512105554342,right_val:.1575746983289719,left_val:.524848222732544},{features:[[5,7,10,4,-1],[5,9,10,2,2]],threshold:.037251990288496,right_val:.6748418807983398,left_val:.4194310903549194},{features:[[6,9,8,8,-1],[6,9,4,4,2],[10,13,4,4,2]],threshold:-.0251097902655602,right_val:.5473451018333435,left_val:.1882549971342087},{features:[[14,1,3,2,-1],[14,2,3,1,2]],threshold:-.005309905856847763,right_val:.5227110981941223,left_val:.133997306227684},{features:[[1,4,4,2,-1],[3,4,2,2,2]],threshold:.0012086479691788554,right_val:.6109635829925537,left_val:.3762088119983673},{features:[[11,10,2,8,-1],[11,14,2,4,2]],threshold:-.0219076797366142,right_val:.5404006838798523,left_val:.266314297914505},{features:[[0,0,5,3,-1],[0,1,5,1,3]],threshold:.0054116579703986645,right_val:.2232273072004318,left_val:.5363578796386719},{features:[[2,5,18,8,-1],[11,5,9,4,2],[2,9,9,4,2]],threshold:.069946326315403,right_val:.2453698068857193,left_val:.5358232855796814},{features:[[6,6,1,6,-1],[6,9,1,3,2]],threshold:.00034520021290518343,right_val:.5376930236816406,left_val:.2409671992063522},{features:[[19,1,1,3,-1],[19,2,1,1,3]],threshold:.0012627709656953812,right_val:.3155693113803864,left_val:.5425856709480286},{features:[[7,6,6,6,-1],[9,6,2,6,3]],threshold:.0227195098996162,right_val:.6597865223884583,left_val:.4158405959606171},{features:[[19,1,1,3,-1],[19,2,1,1,3]],threshold:-.001811100053600967,right_val:.5505244731903076,left_val:.2811253070831299},{features:[[3,13,2,3,-1],[3,14,2,1,3]],threshold:.0033469670452177525,right_val:.1891465038061142,left_val:.526002824306488},{features:[[8,4,8,12,-1],[12,4,4,6,2],[8,10,4,6,2]],threshold:.00040791751234792173,right_val:.3344210088253021,left_val:.5673509240150452},{features:[[5,2,6,3,-1],[7,2,2,3,3]],threshold:.0127347996458411,right_val:.2395612001419067,left_val:.5343592166900635},{features:[[6,1,9,10,-1],[6,6,9,5,2]],threshold:-.007311972789466381,right_val:.4022207856178284,left_val:.6010890007019043},{features:[[0,4,6,12,-1],[2,4,2,12,3]],threshold:-.0569487512111664,right_val:.4543190896511078,left_val:.8199151158332825},{features:[[15,13,2,3,-1],[15,14,2,1,3]],threshold:-.005011659115552902,right_val:.5357710719108582,left_val:.2200281023979187},{features:[[7,14,5,3,-1],[7,15,5,1,3]],threshold:.006033436860889196,right_val:.7181751132011414,left_val:.4413081109523773},{features:[[15,13,3,3,-1],[15,14,3,1,3]],threshold:.0039437441155314445,right_val:.2791733145713806,left_val:.547886073589325},{features:[[6,14,8,3,-1],[6,15,8,1,3]],threshold:-.0036591119132936,right_val:.3989723920822144,left_val:.635786771774292},{features:[[15,13,3,3,-1],[15,14,3,1,3]],threshold:-.0038456181064248085,right_val:.5300664901733398,left_val:.3493686020374298},{features:[[2,13,3,3,-1],[2,14,3,1,3]],threshold:-.007192626129835844,right_val:.5229672789573669,left_val:.1119614988565445},{features:[[4,7,12,12,-1],[10,7,6,6,2],[4,13,6,6,2]],threshold:-.0527989417314529,right_val:.54534512758255,left_val:.2387102991342545},{features:[[9,7,2,6,-1],[10,7,1,6,2]],threshold:-.007953766733407974,right_val:.4439376890659332,left_val:.7586917877197266},{features:[[8,9,5,2,-1],[8,10,5,1,2]],threshold:-.0027344180271029472,right_val:.5489321947097778,left_val:.2565476894378662},{features:[[8,6,3,4,-1],[9,6,1,4,3]],threshold:-.0018507939530536532,right_val:.4252474904060364,left_val:.6734347939491272},{features:[[9,6,2,8,-1],[9,10,2,4,2]],threshold:.0159189198166132,right_val:.2292661964893341,left_val:.548835277557373},{features:[[7,7,3,6,-1],[8,7,1,6,3]],threshold:-.0012687679845839739,right_val:.4022389948368073,left_val:.6104331016540527},{features:[[11,3,3,3,-1],[12,3,1,3,3]],threshold:.006288391072303057,right_val:.1536193042993546,left_val:.5310853123664856},{features:[[5,4,6,1,-1],[7,4,2,1,3]],threshold:-.0062259892001748085,right_val:.524160623550415,left_val:.1729111969470978},{features:[[5,6,10,3,-1],[5,7,10,1,3]],threshold:-.0121325999498367,right_val:.4325182139873505,left_val:.659775972366333}],threshold:21.010639190673828},{simpleClassifiers:[{features:[[7,3,6,9,-1],[7,6,6,3,3]],threshold:-.0039184908382594585,right_val:.1469330936670303,left_val:.6103435158729553},{features:[[6,7,9,1,-1],[9,7,3,1,3]],threshold:.0015971299726516008,right_val:.5896466970443726,left_val:.2632363140583038},{features:[[2,8,16,8,-1],[2,12,16,4,2]],threshold:.0177801102399826,right_val:.1760361939668655, left_val:.587287425994873},{features:[[14,6,2,6,-1],[14,9,2,3,2]],threshold:.0006533476989716291,right_val:.5596066117286682,left_val:.1567801982164383},{features:[[1,5,6,15,-1],[1,10,6,5,3]],threshold:-.00028353091329336166,right_val:.5732036232948303,left_val:.1913153976202011},{features:[[10,0,6,9,-1],[10,3,6,3,3]],threshold:.0016104689566418529,right_val:.5623080730438232,left_val:.2914913892745972},{features:[[6,6,7,14,-1],[6,13,7,7,2]],threshold:-.0977506190538406,right_val:.5648233294487,left_val:.194347694516182},{features:[[13,7,3,6,-1],[13,9,3,2,3]],threshold:.0005518235848285258,right_val:.5504639744758606,left_val:.3134616911411285},{features:[[1,8,15,4,-1],[6,8,5,4,3]],threshold:-.0128582203760743,right_val:.5760142803192139,left_val:.253648191690445},{features:[[11,2,3,10,-1],[11,7,3,5,2]],threshold:.004153023939579725,right_val:.36597740650177,left_val:.5767722129821777},{features:[[3,7,4,6,-1],[3,9,4,2,3]],threshold:.0017092459602281451,right_val:.5918939113616943,left_val:.2843191027641296},{features:[[13,3,6,10,-1],[15,3,2,10,3]],threshold:.007521735969930887,right_val:.6183109283447266,left_val:.4052427113056183},{features:[[5,7,8,10,-1],[5,7,4,5,2],[9,12,4,5,2]],threshold:.0022479810286313295,right_val:.3135401010513306,left_val:.578375518321991},{features:[[4,4,12,12,-1],[10,4,6,6,2],[4,10,6,6,2]],threshold:.0520062111318111,right_val:.1916636973619461,left_val:.5541312098503113},{features:[[1,4,6,9,-1],[3,4,2,9,3]],threshold:.0120855299755931,right_val:.6644591093063354,left_val:.4032655954360962},{features:[[11,3,2,5,-1],[11,3,1,5,2]],threshold:14687820112158079e-21,right_val:.5709382891654968,left_val:.3535977900028229},{features:[[7,3,2,5,-1],[8,3,1,5,2]],threshold:7139518857002258e-21,right_val:.5610269904136658,left_val:.3037444949150085},{features:[[10,14,2,3,-1],[10,15,2,1,3]],threshold:-.0046001640148460865,right_val:.4580326080322266,left_val:.7181087136268616},{features:[[5,12,6,2,-1],[8,12,3,2,2]],threshold:.0020058949012309313,right_val:.2953684031963348,left_val:.5621951818466187},{features:[[9,14,2,3,-1],[9,15,2,1,3]],threshold:.004505027085542679,right_val:.7619017958641052,left_val:.4615387916564941},{features:[[4,11,12,6,-1],[4,14,12,3,2]],threshold:.0117468303069472,right_val:.1772529035806656,left_val:.5343837141990662},{features:[[11,11,5,9,-1],[11,14,5,3,3]],threshold:-.0583163388073444,right_val:.5340772271156311,left_val:.1686245948076248},{features:[[6,15,3,2,-1],[6,16,3,1,2]],threshold:.00023629379575140774,right_val:.6026803851127625,left_val:.3792056143283844},{features:[[11,0,3,5,-1],[12,0,1,5,3]],threshold:-.007815618067979813,right_val:.5324323773384094,left_val:.151286706328392},{features:[[5,5,6,7,-1],[8,5,3,7,2]],threshold:-.0108761601150036,right_val:.5319945216178894,left_val:.2081822007894516},{features:[[13,0,1,9,-1],[13,3,1,3,3]],threshold:-.0027745519764721394,right_val:.5210328102111816,left_val:.4098246991634369},{features:[[3,2,4,8,-1],[3,2,2,4,2],[5,6,2,4,2]],threshold:-.0007827638182789087,right_val:.3478842079639435,left_val:.5693274140357971},{features:[[13,12,4,6,-1],[13,14,4,2,3]],threshold:.0138704096898437,right_val:.2257698029279709,left_val:.5326750874519348},{features:[[3,12,4,6,-1],[3,14,4,2,3]],threshold:-.0236749108880758,right_val:.5200707912445068,left_val:.1551305055618286},{features:[[13,11,3,4,-1],[13,13,3,2,2]],threshold:-14879409718560055e-21,right_val:.3820176124572754,left_val:.5500566959381104},{features:[[4,4,4,3,-1],[4,5,4,1,3]],threshold:.00361906411126256,right_val:.6639748215675354,left_val:.4238683879375458},{features:[[7,5,11,8,-1],[7,9,11,4,2]],threshold:-.0198171101510525,right_val:.5382357835769653,left_val:.2150038033723831},{features:[[7,8,3,4,-1],[8,8,1,4,3]],threshold:-.0038154039066284895,right_val:.4215297102928162,left_val:.6675711274147034},{features:[[9,1,6,1,-1],[11,1,2,1,3]],threshold:-.0049775829538702965,right_val:.5386328101158142,left_val:.2267289012670517},{features:[[5,5,3,3,-1],[5,6,3,1,3]],threshold:.002244102070108056,right_val:.6855735778808594,left_val:.4308691024780273},{features:[[0,9,20,6,-1],[10,9,10,3,2],[0,12,10,3,2]],threshold:.0122824599966407,right_val:.3467479050159454,left_val:.5836614966392517},{features:[[8,6,3,5,-1],[9,6,1,5,3]],threshold:-.002854869933798909,right_val:.4311453998088837,left_val:.7016944885253906},{features:[[11,0,1,3,-1],[11,1,1,1,3]],threshold:-.0037875669077038765,right_val:.5224946141242981,left_val:.2895345091819763},{features:[[4,2,4,2,-1],[4,3,4,1,2]],threshold:-.0012201230274513364,right_val:.5481644868850708,left_val:.2975570857524872},{features:[[12,6,4,3,-1],[12,7,4,1,3]],threshold:.010160599835217,right_val:.8182697892189026,left_val:.4888817965984345},{features:[[5,0,6,4,-1],[7,0,2,4,3]],threshold:-.0161745697259903,right_val:.5239992737770081,left_val:.1481492966413498},{features:[[9,7,3,8,-1],[10,7,1,8,3]],threshold:.0192924607545137,right_val:.7378190755844116,left_val:.4786309897899628},{features:[[9,7,2,2,-1],[10,7,1,2,2]],threshold:-.003247953951358795,right_val:.4470643997192383,left_val:.7374222874641418},{features:[[6,7,14,4,-1],[13,7,7,2,2],[6,9,7,2,2]],threshold:-.009380348026752472,right_val:.5537996292114258,left_val:.3489154875278473},{features:[[0,5,3,6,-1],[0,7,3,2,3]],threshold:-.0126061299815774,right_val:.5315443277359009,left_val:.2379686981439591},{features:[[13,11,3,4,-1],[13,13,3,2,2]],threshold:-.0256219301372766,right_val:.5138769745826721,left_val:.1964688003063202},{features:[[4,11,3,4,-1],[4,13,3,2,2]],threshold:-7574149640277028e-20,right_val:.3365853130817413,left_val:.5590522885322571},{features:[[5,9,12,8,-1],[11,9,6,4,2],[5,13,6,4,2]],threshold:-.0892108827829361,right_val:.516263484954834,left_val:.0634046569466591},{features:[[9,12,1,3,-1],[9,13,1,1,3]],threshold:-.002767048077657819,right_val:.4490706026554108,left_val:.732346773147583},{features:[[10,15,2,4,-1],[10,17,2,2,2]],threshold:.0002715257869567722,right_val:.5985518097877502,left_val:.411483496427536}],threshold:23.918790817260742},{simpleClassifiers:[{features:[[7,7,6,1,-1],[9,7,2,1,3]],threshold:.001478621968999505,right_val:.6643316745758057,left_val:.266354501247406},{features:[[12,3,6,6,-1],[15,3,3,3,2],[12,6,3,3,2]],threshold:-.001874165958724916,right_val:.2518512904644013,left_val:.6143848896026611},{features:[[0,4,10,6,-1],[0,6,10,2,3]],threshold:-.001715100952424109,right_val:.2397463023662567,left_val:.5766341090202332},{features:[[8,3,8,14,-1],[12,3,4,7,2],[8,10,4,7,2]],threshold:-.0018939269939437509,right_val:.2529144883155823,left_val:.5682045817375183},{features:[[4,4,7,15,-1],[4,9,7,5,3]],threshold:-.005300605203956366,right_val:.5556079745292664,left_val:.1640675961971283},{features:[[12,2,6,8,-1],[15,2,3,4,2],[12,6,3,4,2]],threshold:-.0466625317931175,right_val:.4762830138206482,left_val:.6123154163360596},{features:[[2,2,6,8,-1],[2,2,3,4,2],[5,6,3,4,2]],threshold:-.000794313324149698,right_val:.2839404046535492,left_val:.5707858800888062},{features:[[2,13,18,7,-1],[8,13,6,7,3]],threshold:.0148916700854898,right_val:.6006367206573486,left_val:.4089672863483429},{features:[[4,3,8,14,-1],[4,3,4,7,2],[8,10,4,7,2]],threshold:-.0012046529445797205,right_val:.2705289125442505,left_val:.5712450742721558},{features:[[18,1,2,6,-1],[18,3,2,2,3]],threshold:.006061938125640154,right_val:.3262225985527039,left_val:.526250422000885},{features:[[9,11,2,3,-1],[9,12,2,1,3]],threshold:-.0025286648888140917,right_val:.4199256896972656,left_val:.6853830814361572},{features:[[18,1,2,6,-1],[18,3,2,2,3]],threshold:-.005901021882891655,right_val:.5434812903404236,left_val:.3266282081604004},{features:[[0,1,2,6,-1],[0,3,2,2,3]],threshold:.005670276004821062,right_val:.2319003939628601,left_val:.5468410849571228},{features:[[1,5,18,6,-1],[1,7,18,2,3]],threshold:-.003030410036444664,right_val:.2708238065242767,left_val:.557066798210144},{features:[[0,2,6,7,-1],[3,2,3,7,2]],threshold:.002980364952236414,right_val:.5890625715255737,left_val:.3700568974018097},{features:[[7,3,6,14,-1],[7,10,6,7,2]],threshold:-.0758405104279518,right_val:.5419948101043701,left_val:.2140070050954819},{features:[[3,7,13,10,-1],[3,12,13,5,2]],threshold:.0192625392228365,right_val:.2726590037345886,left_val:.5526772141456604},{features:[[11,15,2,2,-1],[11,16,2,1,2]],threshold:.00018888259364757687,right_val:.6017209887504578,left_val:.3958011865615845},{features:[[2,11,16,4,-1],[2,11,8,2,2],[10,13,8,2,2]],threshold:.0293695498257875,right_val:.1435758024454117,left_val:.5241373777389526},{features:[[13,7,6,4,-1],[16,7,3,2,2],[13,9,3,2,2]],threshold:.0010417619487270713,right_val:.5929983258247375,left_val:.3385409116744995},{features:[[6,10,3,9,-1],[6,13,3,3,3]],threshold:.0026125640142709017,right_val:.3021597862243652,left_val:.5485377907752991},{features:[[14,6,1,6,-1],[14,9,1,3,2]],threshold:.0009697746718302369,right_val:.553203284740448,left_val:.3375276029109955},{features:[[5,10,4,1,-1],[7,10,2,1,2]],threshold:.0005951265920884907,right_val:.3359399139881134,left_val:.563174307346344},{features:[[3,8,15,5,-1],[8,8,5,5,3]],threshold:-.1015655994415283,right_val:.5230425000190735,left_val:.0637350380420685},{features:[[1,6,5,4,-1],[1,8,5,2,2]],threshold:.0361566990613937,right_val:.1029528975486755,left_val:.5136963129043579},{features:[[3,1,17,6,-1],[3,3,17,2,3]],threshold:.003462414024397731,right_val:.5558289289474487,left_val:.3879320025444031},{features:[[6,7,8,2,-1],[10,7,4,2,2]],threshold:.0195549800992012,right_val:.1875859946012497,left_val:.5250086784362793},{features:[[9,7,3,2,-1],[10,7,1,2,3]],threshold:-.0023121440317481756,right_val:.4679641127586365,left_val:.667202889919281},{features:[[8,7,3,2,-1],[9,7,1,2,3]],threshold:-.001860528951510787,right_val:.4334670901298523,left_val:.7163379192352295},{features:[[8,9,4,2,-1],[8,10,4,1,2]],threshold:-.0009402636205777526,right_val:.5650203227996826,left_val:.302136093378067},{features:[[8,8,4,3,-1],[8,9,4,1,3]],threshold:-.005241833161562681,right_val:.5250256061553955,left_val:.1820009052753449},{features:[[9,5,6,4,-1],[9,5,3,4,2]],threshold:.00011729019752237946,right_val:.544597327709198,left_val:.3389188051223755},{features:[[8,13,4,3,-1],[8,14,4,1,3]],threshold:.0011878840159624815,right_val:.6253563165664673,left_val:.4085349142551422},{features:[[4,7,12,6,-1],[10,7,6,3,2],[4,10,6,3,2]],threshold:-.0108813596889377,right_val:.5700082778930664,left_val:.3378399014472961},{features:[[8,14,4,3,-1],[8,15,4,1,3]],threshold:.0017354859737679362,right_val:.6523038744926453,left_val:.4204635918140411},{features:[[9,7,3,3,-1],[9,8,3,1,3]],threshold:-.00651190523058176,right_val:.5428143739700317,left_val:.2595216035842896},{features:[[7,4,3,8,-1],[8,4,1,8,3]],threshold:-.0012136430013924837,right_val:.3977893888950348,left_val:.6165143847465515},{features:[[10,0,3,6,-1],[11,0,1,6,3]],threshold:-.010354240424931,right_val:.5219504833221436,left_val:.1628028005361557},{features:[[6,3,4,8,-1],[8,3,2,8,2]],threshold:.0005585883045569062,right_val:.5503574013710022,left_val:.3199650943279266},{features:[[14,3,6,13,-1],[14,3,3,13,2]],threshold:.0152996499091387,right_val:.6122388243675232,left_val:.4103994071483612},{features:[[8,13,3,6,-1],[8,16,3,3,2]],threshold:-.021588210016489,right_val:.519738495349884,left_val:.103491298854351},{features:[[14,3,6,13,-1],[14,3,3,13,2]],threshold:-.1283462941646576,right_val:.4893102943897247,left_val:.8493865132331848},{features:[[0,7,10,4,-1],[0,7,5,2,2],[5,9,5,2,2]],threshold:-.0022927189711481333,right_val:.5471575260162354,left_val:.3130157887935638},{features:[[14,3,6,13,-1],[14,3,3,13,2]],threshold:.0799151062965393,right_val:.6073989272117615,left_val:.4856320917606354},{features:[[0,3,6,13,-1],[3,3,3,13,2]],threshold:-.0794410929083824,right_val:.462453305721283,left_val:.8394674062728882},{features:[[9,1,4,1,-1],[9,1,2,1,2]],threshold:-.00528000108897686,right_val:.5306698083877563,left_val:.1881695985794067},{features:[[8,0,2,1,-1],[9,0,1,1,2]],threshold:.0010463109938427806,right_val:.2583065927028656,left_val:.5271229147911072},{features:[[10,16,4,4,-1],[12,16,2,2,2],[10,18,2,2,2]],threshold:.00026317298761568964,right_val:.5735440850257874,left_val:.4235304892063141},{features:[[9,6,2,3,-1],[10,6,1,3,2]],threshold:-.0036173160187900066,right_val:.4495444893836975,left_val:.6934396028518677},{features:[[4,5,12,2,-1],[8,5,4,2,3]],threshold:.0114218797534704,right_val:.4138193130493164,left_val:.590092122554779},{features:[[8,7,3,5,-1],[9,7,1,5,3]],threshold:-.0019963278900831938,right_val:.4327239990234375,left_val:.6466382741928101}],threshold:24.52787971496582},{simpleClassifiers:[{features:[[6,4,8,6,-1],[6,6,8,2,3]],threshold:-.00996912457048893,right_val:.2482212036848068,left_val:.6142324209213257},{features:[[9,5,2,12,-1],[9,11,2,6,2]],threshold:.0007307305932044983,right_val:.2321965992450714,left_val:.5704951882362366},{features:[[4,6,6,8,-1],[4,10,6,4,2]],threshold:.0006404530140571296,right_val:.5814933180809021,left_val:.2112251967191696},{features:[[12,2,8,5,-1],[12,2,4,5,2]],threshold:.004542401991784573,right_val:.586631178855896,left_val:.2950482070446014},{features:[[0,8,18,3,-1],[0,9,18,1,3]],threshold:9247744310414419e-20,right_val:.5791326761245728,left_val:.2990990877151489},{features:[[8,12,4,8,-1],[8,16,4,4,2]],threshold:-.008660314604640007,right_val:.5635542273521423,left_val:.2813029885292053},{features:[[0,2,8,5,-1],[4,2,4,5,2]],threshold:.008051581680774689,right_val:.6054757237434387,left_val:.3535369038581848},{features:[[13,11,3,4,-1],[13,13,3,2,2]],threshold:.00043835240649059415,right_val:.2731510996818543,left_val:.5596532225608826},{features:[[5,11,6,1,-1],[7,11,2,1,3]],threshold:-981689736363478e-19,right_val:.3638561069965363,left_val:.5978031754493713},{features:[[11,3,3,1,-1],[12,3,1,1,3]],threshold:-.0011298790341243148,right_val:.5432729125022888,left_val:.2755252122879028},{features:[[7,13,5,3,-1],[7,14,5,1,3]],threshold:.006435615010559559,right_val:.7069833278656006,left_val:.4305641949176788},{features:[[11,11,7,6,-1],[11,14,7,3,2]],threshold:-.0568293295800686,right_val:.5294997096061707,left_val:.2495242953300476},{features:[[2,11,7,6,-1],[2,14,7,3,2]],threshold:.004066816996783018,right_val:.2497723996639252,left_val:.5478553175926208},{features:[[12,14,2,6,-1],[12,16,2,2,3]],threshold:481647984997835e-19,right_val:.5706356167793274,left_val:.3938601016998291},{features:[[8,14,3,3,-1],[8,15,3,1,3]],threshold:.00617950176820159,right_val:.7394766807556152,left_val:.440760612487793},{features:[[11,0,3,5,-1],[12,0,1,5,3]],threshold:.006498575210571289,right_val:.2479152977466583,left_val:.5445243120193481},{features:[[6,1,4,9,-1],[8,1,2,9,2]],threshold:-.0010211090557277203,right_val:.5338971018791199,left_val:.2544766962528229},{features:[[10,3,6,1,-1],[12,3,2,1,3]],threshold:-.005424752831459045,right_val:.5324069261550903,left_val:.2718858122825623},{features:[[8,8,3,4,-1],[8,10,3,2,2]],threshold:-.0010559899965301156,right_val:.553450882434845,left_val:.3178288042545319},{features:[[8,12,4,2,-1],[8,13,4,1,2]],threshold:.0006646580877713859,right_val:.6558194160461426,left_val:.4284219145774841},{features:[[5,18,4,2,-1],[5,19,4,1,2]],threshold:-.00027524109464138746,right_val:.3810262978076935,left_val:.5902860760688782},{features:[[2,1,18,6,-1],[2,3,18,2,3]],threshold:.004229320213198662,right_val:.5709385871887207,left_val:.381648987531662},{features:[[6,0,3,2,-1],[7,0,1,2,3]],threshold:-.0032868210691958666,right_val:.5259544253349304,left_val:.1747743934392929},{features:[[13,8,6,2,-1],[16,8,3,1,2],[13,9,3,1,2]],threshold:.0001561187964398414,right_val:.5725612044334412,left_val:.3601722121238709},{features:[[6,10,3,6,-1],[6,13,3,3,2]],threshold:-7362138148891972e-21,right_val:.3044497072696686,left_val:.540185809135437},{features:[[0,13,20,4,-1],[10,13,10,2,2],[0,15,10,2,2]],threshold:-.014767250046134,right_val:.5573434829711914,left_val:.3220770061016083},{features:[[7,7,6,5,-1],[9,7,2,5,3]],threshold:.0244895908981562,right_val:.6518812775611877,left_val:.4301528036594391},{features:[[11,0,2,2,-1],[11,1,2,1,2]],threshold:-.000376520911231637,right_val:.5598236918449402,left_val:.356458306312561},{features:[[1,8,6,2,-1],[1,8,3,1,2],[4,9,3,1,2]],threshold:736576885174145e-20,right_val:.556189775466919,left_val:.3490782976150513},{features:[[0,2,20,2,-1],[10,2,10,1,2],[0,3,10,1,2]],threshold:-.0150999398902059,right_val:.5335299968719482,left_val:.1776272058486939},{features:[[7,14,5,3,-1],[7,15,5,1,3]],threshold:-.0038316650316119194,right_val:.4221394062042236,left_val:.6149687767028809},{features:[[7,13,6,6,-1],[10,13,3,3,2],[7,16,3,3,2]],threshold:.0169254001230001,right_val:.2166585028171539,left_val:.5413014888763428},{features:[[9,12,2,3,-1],[9,13,2,1,3]],threshold:-.003047785023227334,right_val:.4354617893695831,left_val:.6449490785598755},{features:[[16,11,1,6,-1],[16,13,1,2,3]],threshold:.003214058931916952,right_val:.3523217141628265,left_val:.5400155186653137},{features:[[3,11,1,6,-1],[3,13,1,2,3]],threshold:-.004002320114523172,right_val:.5338417291641235,left_val:.2774524092674255},{features:[[4,4,14,12,-1],[11,4,7,6,2],[4,10,7,6,2]],threshold:.0074182129465043545,right_val:.3702817857265472,left_val:.567673921585083},{features:[[5,4,3,3,-1],[5,5,3,1,3]],threshold:-.008876458741724491,right_val:.4583688974380493,left_val:.7749221920967102},{features:[[12,3,3,3,-1],[13,3,1,3,3]],threshold:.002731173997744918,right_val:.3996661007404327,left_val:.5338721871376038},{features:[[6,6,8,3,-1],[6,7,8,1,3]],threshold:-.0025082379579544067,right_val:.377749890089035,left_val:.5611963272094727},{features:[[12,3,3,3,-1],[13,3,1,3,3]],threshold:-.008054107427597046,right_val:.5179182887077332,left_val:.291522890329361},{features:[[3,1,4,10,-1],[3,1,2,5,2],[5,6,2,5,2]],threshold:-.0009793881326913834,right_val:.3700192868709564,left_val:.5536432862281799},{features:[[5,7,10,2,-1],[5,7,5,2,2]],threshold:-.005874590948224068,right_val:.5679376125335693,left_val:.3754391074180603},{features:[[8,7,3,3,-1],[9,7,1,3,3]],threshold:-.00449367193505168,right_val:.4480949938297272,left_val:.7019699215888977},{features:[[15,12,2,3,-1],[15,13,2,1,3]],threshold:-.00543892290443182,right_val:.5313386917114258,left_val:.2310364991426468},{features:[[7,8,3,4,-1],[8,8,1,4,3]],threshold:-.0007509464048780501,right_val:.4129343032836914,left_val:.5864868760108948},{features:[[13,4,1,12,-1],[13,10,1,6,2]],threshold:14528800420521293e-21,right_val:.5619621276855469,left_val:.3732407093048096},{features:[[4,5,12,12,-1],[4,5,6,6,2],[10,11,6,6,2]],threshold:.0407580696046352,right_val:.2720521986484528,left_val:.5312091112136841},{features:[[7,14,7,3,-1],[7,15,7,1,3]],threshold:.006650593131780624,right_val:.6693493723869324,left_val:.4710015952587128},{features:[[3,12,2,3,-1],[3,13,2,1,3]],threshold:.0045759351924061775,right_val:.1637275964021683,left_val:.5167819261550903},{features:[[3,2,14,2,-1],[10,2,7,1,2],[3,3,7,1,2]],threshold:.0065269311890006065,right_val:.2938531935214996,left_val:.5397608876228333},{features:[[0,1,3,10,-1],[1,1,1,10,3]],threshold:-.0136603796854615,right_val:.453220009803772,left_val:.7086488008499146},{features:[[9,0,6,5,-1],[11,0,2,5,3]],threshold:.0273588690906763,right_val:.3589231967926025,left_val:.5206481218338013},{features:[[5,7,6,2,-1],[8,7,3,2,2]],threshold:.0006219755159690976,right_val:.5441123247146606,left_val:.3507075905799866},{features:[[7,1,6,10,-1],[7,6,6,5,2]],threshold:-.0033077080734074116,right_val:.402489185333252,left_val:.5859522819519043},{features:[[1,1,18,3,-1],[7,1,6,3,3]],threshold:-.0106311095878482,right_val:.4422602951526642,left_val:.6743267178535461},{features:[[16,3,3,6,-1],[16,5,3,2,3]],threshold:.0194416493177414,right_val:.1797904968261719,left_val:.5282716155052185}],threshold:27.153350830078125},{simpleClassifiers:[{features:[[6,3,7,6,-1],[6,6,7,3,2]],threshold:-.005505216773599386,right_val:.2626559138298035,left_val:.5914731025695801},{features:[[4,7,12,2,-1],[8,7,4,2,3]],threshold:.001956227933987975,right_val:.5741627216339111,left_val:.2312581986188889},{features:[[0,4,17,10,-1],[0,9,17,5,2]],threshold:-.008892478421330452,right_val:.5626654028892517,left_val:.1656530052423477},{features:[[3,4,15,16,-1],[3,12,15,8,2]],threshold:.0836383774876595,right_val:.1957294940948486,left_val:.5423449873924255},{features:[[7,15,6,4,-1],[7,17,6,2,2]],threshold:.0012282270472496748,right_val:.5992503762245178,left_val:.3417904078960419},{features:[[15,2,4,9,-1],[15,2,2,9,2]],threshold:.0057629169896245,right_val:.6079903841018677,left_val:.3719581961631775},{features:[[2,3,3,2,-1],[2,4,3,1,2]],threshold:-.0016417410224676132,right_val:.5576915740966797,left_val:.2577486038208008},{features:[[13,6,7,9,-1],[13,9,7,3,3]],threshold:.0034113149158656597,right_val:.5514171719551086,left_val:.2950749099254608},{features:[[8,11,4,3,-1],[8,12,4,1,3]],threshold:-.0110693201422691,right_val:.4477078914642334,left_val:.7569358944892883},{features:[[0,2,20,6,-1],[10,2,10,3,2],[0,5,10,3,2]],threshold:.0348659716546535,right_val:.2669621109962463,left_val:.5583708882331848},{features:[[3,2,6,10,-1],[3,2,3,5,2],[6,7,3,5,2]],threshold:.0006570109981112182,right_val:.2988890111446381,left_val:.5627313256263733},{features:[[13,10,3,4,-1],[13,12,3,2,2]],threshold:-.0243391301482916,right_val:.5108863115310669,left_val:.2771185040473938},{features:[[4,10,3,4,-1],[4,12,3,2,2]],threshold:.0005943520227447152,right_val:.3120341897010803,left_val:.5580651760101318},{features:[[7,5,6,3,-1],[9,5,2,3,3]],threshold:.0022971509024500847,right_val:.5679075717926025,left_val:.3330250084400177},{features:[[7,6,6,8,-1],[7,10,6,4,2]],threshold:-.0037801829166710377,right_val:.5344808101654053,left_val:.2990534901618958},{features:[[0,11,20,6,-1],[0,14,20,3,2]],threshold:-.13420669734478,right_val:.5392568111419678,left_val:.1463858932256699},{features:[[4,13,4,6,-1],[4,13,2,3,2],[6,16,2,3,2]],threshold:.0007522454834543169,right_val:.5692734718322754,left_val:.3746953904628754},{features:[[6,0,8,12,-1],[10,0,4,6,2],[6,6,4,6,2]],threshold:-.040545541793108,right_val:.5484297871589661,left_val:.2754747867584229},{features:[[2,0,15,2,-1],[2,1,15,1,2]],threshold:.0012572970008477569,right_val:.5756075978279114,left_val:.3744584023952484},{features:[[9,12,2,3,-1],[9,13,2,1,3]],threshold:-.007424994837492704,right_val:.4728231132030487,left_val:.7513859272003174},{features:[[3,12,1,2,-1],[3,13,1,1,2]],threshold:.0005090812919661403,right_val:.2932321131229401,left_val:.540489673614502},{features:[[9,11,2,3,-1],[9,12,2,1,3]],threshold:-.001280845026485622,right_val:.4273349046707153,left_val:.6169779896736145},{features:[[7,3,3,1,-1],[8,3,1,1,3]],threshold:-.0018348860321566463,right_val:.5206472277641296,left_val:.2048496007919312},{features:[[17,7,3,6,-1],[17,9,3,2,3]],threshold:.0274848695844412,right_val:.1675522029399872,left_val:.5252984762191772},{features:[[7,2,3,2,-1],[8,2,1,2,3]],threshold:.0022372419480234385,right_val:.2777658104896545,left_val:.5267782807350159},{features:[[11,4,5,3,-1],[11,5,5,1,3]],threshold:-.008863529190421104,right_val:.4812048971652985,left_val:.69545578956604},{features:[[4,4,5,3,-1],[4,5,5,1,3]],threshold:.004175397101789713,right_val:.6349195837974548,left_val:.4291887879371643},{features:[[19,3,1,2,-1],[19,4,1,1,2]],threshold:-.0017098189564421773,right_val:.5361248850822449,left_val:.2930536866188049},{features:[[5,5,4,3,-1],[5,6,4,1,3]],threshold:.006532854866236448,right_val:.7409694194793701,left_val:.4495325088500977},{features:[[17,7,3,6,-1],[17,9,3,2,3]],threshold:-.009537290781736374,right_val:.5416501760482788,left_val:.3149119913578033},{features:[[0,7,3,6,-1],[0,9,3,2,3]],threshold:.0253109894692898,right_val:.1311707943677902,left_val:.5121892094612122},{features:[[14,2,6,9,-1],[14,5,6,3,3]],threshold:.0364609695971012,right_val:.2591339945793152,left_val:.5175911784172058},{features:[[0,4,5,6,-1],[0,6,5,2,3]],threshold:.0208543296903372,right_val:.1582316011190414,left_val:.5137140154838562},{features:[[10,5,6,2,-1],[12,5,2,2,3]],threshold:-.0008720774785615504,right_val:.439897894859314,left_val:.5574309825897217},{features:[[4,5,6,2,-1],[6,5,2,2,3]],threshold:-15227000403683633e-21,right_val:.3708069920539856,left_val:.5548940896987915},{features:[[8,1,4,6,-1],[8,3,4,2,3]],threshold:-.0008431650931015611,right_val:.5554211139678955,left_val:.3387419879436493},{features:[[0,2,3,6,-1],[0,4,3,2,3]],threshold:.0036037859972566366,right_val:.3411171138286591,left_val:.5358061790466309},{features:[[6,6,8,3,-1],[6,7,8,1,3]],threshold:-.006805789191275835,right_val:.4345862865447998,left_val:.6125202775001526},{features:[[0,1,5,9,-1],[0,4,5,3,3]],threshold:-.0470216609537601,right_val:.519373893737793,left_val:.2358165979385376},{features:[[16,0,4,15,-1],[16,0,2,15,2]],threshold:-.0369541086256504,right_val:.4760943949222565,left_val:.7323111295700073},{features:[[1,10,3,2,-1],[1,11,3,1,2]],threshold:.0010439479956403375,right_val:.3411330878734589,left_val:.5419455170631409},{features:[[14,4,1,10,-1],[14,9,1,5,2]],threshold:-.00021050689974799752,right_val:.5554947257041931,left_val:.2821694016456604},{features:[[0,1,4,12,-1],[2,1,2,12,2]],threshold:-.0808315873146057,right_val:.4697434902191162,left_val:.9129930138587952},{features:[[11,11,4,2,-1],[11,11,2,2,2]],threshold:-.0003657905908767134,right_val:.3978292942047119,left_val:.6022670269012451},{features:[[5,11,4,2,-1],[7,11,2,2,2]],threshold:-.00012545920617412776,right_val:.384553998708725,left_val:.5613213181495667},{features:[[3,8,15,5,-1],[8,8,5,5,3]],threshold:-.0687864869832993,right_val:.5300496816635132,left_val:.2261611968278885},{features:[[0,0,6,10,-1],[3,0,3,10,2]],threshold:.0124157899990678,right_val:.5828812122344971,left_val:.4075691998004913},{features:[[11,4,3,2,-1],[12,4,1,2,3]],threshold:-.004717481788247824,right_val:.5267757773399353,left_val:.2827253937721252},{features:[[8,12,3,8,-1],[8,16,3,4,2]],threshold:.0381368584930897,right_val:.1023615971207619,left_val:.5074741244316101},{features:[[8,14,5,3,-1],[8,15,5,1,3]],threshold:-.0028168049175292253,right_val:.4359692931175232,left_val:.6169006824493408},{features:[[7,14,4,3,-1],[7,15,4,1,3]],threshold:.008130360394716263,right_val:.76060950756073,left_val:.4524433016777039},{features:[[11,4,3,2,-1],[12,4,1,2,3]],threshold:.006005601957440376,right_val:.185971200466156,left_val:.5240408778190613},{features:[[3,15,14,4,-1],[3,15,7,2,2],[10,17,7,2,2]],threshold:.0191393196582794,right_val:.2332071959972382,left_val:.5209379196166992},{features:[[2,2,16,4,-1],[10,2,8,2,2],[2,4,8,2,2]],threshold:.0164457596838474,right_val:.3264234960079193,left_val:.5450702905654907},{features:[[0,8,6,12,-1],[3,8,3,12,2]],threshold:-.0373568907380104,right_val:.4533241987228394,left_val:.6999046802520752},{features:[[5,7,10,2,-1],[5,7,5,2,2]],threshold:-.0197279006242752,right_val:.54128098487854,left_val:.2653664946556091},{features:[[9,7,2,5,-1],[10,7,1,5,2]],threshold:.0066972579807043076,right_val:.7138652205467224,left_val:.4480566084384918},{features:[[13,7,6,4,-1],[16,7,3,2,2],[13,9,3,2,2]],threshold:.0007445752853527665,right_val:.5471320152282715,left_val:.4231350123882294},{features:[[0,13,8,2,-1],[0,14,8,1,2]],threshold:.0011790640419349074,right_val:.3130455017089844,left_val:.5341702103614807},{features:[[13,7,6,4,-1],[16,7,3,2,2],[13,9,3,2,2]],threshold:.0349806100130081,right_val:.343053013086319,left_val:.5118659734725952},{features:[[1,7,6,4,-1],[1,7,3,2,2],[4,9,3,2,2]],threshold:.0005685979267582297,right_val:.5468639731407166,left_val:.3532187044620514},{features:[[12,6,1,12,-1],[12,12,1,6,2]],threshold:-.0113406497985125,right_val:.5348700881004333,left_val:.2842353880405426},{features:[[9,5,2,6,-1],[10,5,1,6,2]],threshold:-.00662281084805727,right_val:.4492664933204651,left_val:.6883640289306641},{features:[[14,12,2,3,-1],[14,13,2,1,3]],threshold:-.008016033098101616,right_val:.5224308967590332,left_val:.1709893941879273},{features:[[4,12,2,3,-1],[4,13,2,1,3]],threshold:.0014206819469109178,right_val:.299338310956955,left_val:.5290846228599548},{features:[[8,12,4,3,-1],[8,13,4,1,3]],threshold:-.002780171111226082,right_val:.4460499882698059,left_val:.6498854160308838},{features:[[5,2,2,4,-1],[5,2,1,2,2],[6,4,1,2,2]],threshold:-.0014747589593753219,right_val:.5388113260269165,left_val:.3260438144207001},{features:[[5,5,11,3,-1],[5,6,11,1,3]],threshold:-.0238303393125534,right_val:.4801219999790192,left_val:.7528941035270691},{features:[[7,6,4,12,-1],[7,12,4,6,2]],threshold:.00693697901442647,right_val:.3261427879333496,left_val:.5335165858268738},{features:[[12,13,8,5,-1],[12,13,4,5,2]],threshold:.008280625566840172,right_val:.5737829804420471,left_val:.458039402961731},{features:[[7,6,1,12,-1],[7,12,1,6,2]],threshold:-.0104395002126694,right_val:.5233827829360962,left_val:.2592320144176483}],threshold:34.55411148071289},{simpleClassifiers:[{features:[[1,2,6,3,-1],[4,2,3,3,2]],threshold:.0072006587870419025,right_val:.6849808096885681,left_val:.325888603925705},{features:[[9,5,6,10,-1],[12,5,3,5,2],[9,10,3,5,2]],threshold:-.002859358908608556,right_val:.2537829875946045,left_val:.5838881134986877},{features:[[5,5,8,12,-1],[5,5,4,6,2],[9,11,4,6,2]],threshold:.0006858052802272141,right_val:.2812424004077911,left_val:.5708081722259521},{features:[[0,7,20,6,-1],[0,9,20,2,3]],threshold:.007958019152283669,right_val:.5544260740280151,left_val:.2501051127910614},{features:[[4,2,2,2,-1],[4,3,2,1,2]],threshold:-.0012124150525778532,right_val:.5433350205421448,left_val:.2385368049144745},{features:[[4,18,12,2,-1],[8,18,4,2,3]],threshold:.00794261321425438,right_val:.6220757961273193,left_val:.3955070972442627},{features:[[7,4,4,16,-1],[7,12,4,8,2]],threshold:.0024630590341985226,right_val:.2992357909679413,left_val:.5639708042144775},{features:[[7,6,7,8,-1],[7,10,7,4,2]],threshold:-.006039659958332777,right_val:.541167676448822,left_val:.218651294708252},{features:[[6,3,3,1,-1],[7,3,1,1,3]],threshold:-.0012988339876756072,right_val:.5364584922790527,left_val:.23507060110569},{features:[[11,15,2,4,-1],[11,17,2,2,2]],threshold:.00022299369447864592,right_val:.572960615158081,left_val:.380411297082901},{features:[[3,5,4,8,-1],[3,9,4,4,2]],threshold:.0014654280385002494,right_val:.5258268713951111,left_val:.2510167956352234},{features:[[7,1,6,12,-1],[7,7,6,6,2]],threshold:-.0008121004211716354,right_val:.3851158916950226,left_val:.5992823839187622},{features:[[4,6,6,2,-1],[6,6,2,2,3]],threshold:-.0013836020370945334,right_val:.3636586964130402,left_val:.5681396126747131},{features:[[16,4,4,6,-1],[16,6,4,2,3]],threshold:-.0279364492744207,right_val:.5377560257911682,left_val:.1491317003965378},{features:[[3,3,5,2,-1],[3,4,5,1,2]],threshold:-.0004691955109592527,right_val:.5572484731674194,left_val:.3692429959774017},{features:[[9,11,2,3,-1],[9,12,2,1,3]],threshold:-.004982965998351574,right_val:.4532504081726074,left_val:.6758509278297424},{features:[[2,16,4,2,-1],[2,17,4,1,2]],threshold:.001881530974060297,right_val:.2932539880275726,left_val:.5368022918701172},{features:[[7,13,6,6,-1],[10,13,3,3,2],[7,16,3,3,2]],threshold:-.0190675500780344,right_val:.5330067276954651,left_val:.1649377048015595},{features:[[7,0,3,4,-1],[8,0,1,4,3]],threshold:-.0046906559728085995,right_val:.5119361877441406,left_val:.1963925957679749},{features:[[8,15,4,3,-1],[8,16,4,1,3]],threshold:.005977713968604803,right_val:.7008398175239563,left_val:.467117190361023},{features:[[0,4,4,6,-1],[0,6,4,2,3]],threshold:-.0333031304180622,right_val:.5104162096977234,left_val:.1155416965484619},{features:[[5,6,12,3,-1],[9,6,4,3,3]],threshold:.0907441079616547,right_val:.1306173056364059,left_val:.5149660110473633},{features:[[7,6,6,14,-1],[9,6,2,14,3]],threshold:.0009355589863844216,right_val:.543985903263092,left_val:.3605481088161469},{features:[[9,7,3,3,-1],[10,7,1,3,3]],threshold:.0149016501381993,right_val:.7687569856643677,left_val:.4886212050914764},{features:[[6,12,2,4,-1],[6,14,2,2,2]],threshold:.0006159411859698594,right_val:.3240939080715179,left_val:.5356813073158264},{features:[[10,12,7,6,-1],[10,14,7,2,3]],threshold:-.0506709888577461,right_val:.5230404138565063, diff --git a/js/jsfeat_detect.js b/js/jsfeat_detect.js index e42369cc..789b5559 100644 --- a/js/jsfeat_detect.js +++ b/js/jsfeat_detect.js @@ -43,6 +43,7 @@ var jsfeat_face = function(video, maxWorkSize, useWebWorkers) { worker.addEventListener('message', function (e) { this.faceDetected(e, callback); + worker.terminate(); }.bind(this), false); worker.postMessage({