var Width_used_for_displaying_canvas=function(){return function(){return 200}}(),Height_used_for_displaying_canvas=function(){return function(){return 200}}(),Photography_with_detected_features=function(a,b){chai.assert.isTrue(void 0!==a&&null!==a&&a instanceof Image&&a.complete,"Photography_with_detected_features._image");chai.assert.isTrue(void 0!==b&&null!==b,"Photography_with_detected_features._image_name");this._image=a;this._image_name=b;this._matrix_char8_C1=new jsfeat.matrix_t(this._image.width, this._image.height,jsfeat.U8C1_t);this.$_image_canvas=$("").attr({id:"image-canvas-"+this._image_name});this.$_image_canvas.get(0).width=this._image.width;this.$_image_canvas.get(0).height=this._image.height;this.$_image_canvas.get(0).getContext("2d").drawImage(this._image,0,0,this._image.width,this._image.height);this.$_image_canvas.css("width",Width_used_for_displaying_canvas()+"px");this.$_image_canvas.css("height",Width_used_for_displaying_canvas()+"px");this.$_image_canvas.get(0).getContext("2d").font= "italic 10px Arial";this.$_image_canvas.get(0).getContext("2d").strokeText("Original: "+this._image_name,10,10);$("body").prepend(this.$_image_canvas);this._image_data=this.$_image_canvas.get(0).getContext("2d").getImageData(0,0,this._image.width,this._image.height);this._image_data_buffer=new Uint32Array(this._image_data.data.buffer);this.$_grayscale_canvas=$("").attr({id:"grayscale-canvas-"+this._image_name});this.$_grayscale_canvas.get(0).width=this._image.width;this.$_grayscale_canvas.get(0).height= this._image.height;this._grayscale_image_data=this.$_grayscale_canvas.get(0).getContext("2d").getImageData(0,0,this._image.width,this._image.height);this._grayscale_image_data_buffer=new Uint32Array(this._grayscale_image_data.data.buffer);this.$_gaussian_blur_canvas=$("").attr({id:"gaussian_blur-canvas-"+this._image_name});this.$_gaussian_blur_canvas.get(0).width=this._image.width;this.$_gaussian_blur_canvas.get(0).height=this._image.height;this.$_gaussian_blur_canvas.get(0).getContext("2d").drawImage(this._image, 0,0,this._image.width,this._image.height);this._gaussian_blur_image_data=this.$_gaussian_blur_canvas.get(0).getContext("2d").getImageData(0,0,this._image.width,this._image.height);this._gaussian_blur_image_data_buffer=new Uint32Array(this._gaussian_blur_image_data.data.buffer);this.$_canny_canvas=$("").attr({id:"canny-canvas-"+this._image_name});this.$_canny_canvas.get(0).width=this._image.width;this.$_canny_canvas.get(0).height=this._image.height;this.$_canny_canvas.get(0).getContext("2d").drawImage(this._image, 0,0,this._image.width,this._image.height);this._canny_image_data=this.$_canny_canvas.get(0).getContext("2d").getImageData(0,0,this._image.width,this._image.height);this._canny_image_data_buffer=new Uint32Array(this._canny_image_data.data.buffer);this.$_sobel_canvas=$("").attr({id:"sobel-canvas-"+this._image_name});this.$_sobel_canvas.get(0).width=this._image.width;this.$_sobel_canvas.get(0).height=this._image.height;this.$_sobel_canvas.get(0).getContext("2d").drawImage(this._image,0,0,this._image.width, this._image.height);this._sobel_image_data=this.$_sobel_canvas.get(0).getContext("2d").getImageData(0,0,this._image.width,this._image.height);this._sobel_image_data_buffer=new Uint32Array(this._sobel_image_data.data.buffer);this._gaussian_blur();this._canny_processing();this._canny_postprocessing();this._sobel_processing();this._sobel_postprocessing();this._brightness_binary_face=null;this._brightness_binary_face_detecting(chroma("blue").hex());this._haar_feature=null;this._haar_feature_detecting(chroma("green").hex(), jsfeat.haar.frontalface,1);this._haar_feature_detecting(chroma("yellow").hex(),jsfeat.haar.mouth,1);this._haar_feature_detecting(chroma("magenta").hex(),jsfeat.haar.eye,2);this._tracking_face()}; Photography_with_detected_features.prototype._gaussian_blur=function(){for(var a=new jsfeat.matrix_t(this._image.width,this._image.height,jsfeat.U8C1_t),b=this._image.width*this._image.height;0<=--b;){var c=this._image_data_buffer[b];a.data[b]=c<<24|c<<16|c<<8|c}var d=new jsfeat.matrix_t(this._image.width,this._image.height,jsfeat.U8C1_t);jsfeat.imgproc.gaussian_blur(a,d,8,2);for(b=d.cols*d.rows;0<=--b;)c=d.data[b],this._gaussian_blur_image_data_buffer[b]=c<<24|c<<16|c<<8|c;this.$_gaussian_blur_canvas.get(0).getContext("2d").putImageData(this._gaussian_blur_image_data, 0,0);this.$_gaussian_blur_canvas.css("width",Width_used_for_displaying_canvas()+"px");this.$_gaussian_blur_canvas.css("height",Width_used_for_displaying_canvas()+"px");this.$_gaussian_blur_canvas.get(0).getContext("2d").font="italic 10px Arial";this.$_gaussian_blur_canvas.get(0).getContext("2d").strokeText("Gaussian blur: "+this._image_name,10,10);$("body").prepend(this.$_gaussian_blur_canvas)}; Photography_with_detected_features.prototype._canny_processing=function(){chai.assert.isNotNull(this._canny_image_data,"Photography_with_detected_features._canny_image_data");chai.assert.isNotNull(this._canny_image_data_buffer,"Photography_with_detected_features._canny_image_data_buffer");jsfeat.imgproc.grayscale(this._canny_image_data.data,this._image.width,this._image.height,this._matrix_char8_C1);jsfeat.imgproc.gaussian_blur(this._matrix_char8_C1,this._matrix_char8_C1,8,0);jsfeat.imgproc.canny(this._matrix_char8_C1, this._matrix_char8_C1,40,40);for(var a=this._matrix_char8_C1.cols*this._matrix_char8_C1.rows;0<=--a;){var b=this._matrix_char8_C1.data[a];this._canny_image_data_buffer[a]=-16777216|b<<16|b<<8|b}}; Photography_with_detected_features.prototype._canny_postprocessing=function(){chai.assert.isNotNull(this._canny_image_data,"Photography_with_detected_features._canny_image_data");chai.assert.isNotNull(this._canny_image_data_buffer,"Photography_with_detected_features._canny_image_data_buffer");for(var a=0;a>>24,c=(this._canny_image_data_buffer[a]&16711680)>>16,d=(this._canny_image_data_buffer[a]&65280)>>8,e=this._canny_image_data_buffer[a]& 255;255===e&&255===d&&255===c?(c=d=0,b=-16777216):b=0;this._canny_image_data_buffer[a]=b|c<<16|d<<8|e}this.$_canny_canvas.get(0).getContext("2d").putImageData(this._canny_image_data,0,0);this.$_canny_canvas.css("width",Width_used_for_displaying_canvas()+"px");this.$_canny_canvas.css("height",Height_used_for_displaying_canvas()+"px");this.$_canny_canvas.get(0).getContext("2d").font="italic 10px Arial";this.$_canny_canvas.get(0).getContext("2d").strokeText("Canny: "+this._image_name,10,10);$("body").prepend(this.$_canny_canvas)}; Photography_with_detected_features.prototype._sobel_processing=function(){chai.assert.isNotNull(this._sobel_image_data,"Photography_with_detected_features._sobel_image_data");chai.assert.isNotNull(this._sobel_image_data_buffer,"Photography_with_detected_features._sobel_image_data_buffer");var a=new jsfeat.matrix_t(this._image.width,this._image.height,jsfeat.S32C2_t);jsfeat.imgproc.grayscale(this._sobel_image_data.data,this._image.width,this._image.height,this._matrix_char8_C1,jsfeat.COLOR_RGBA2GRAY); jsfeat.imgproc.sobel_derivatives(this._matrix_char8_C1,a);for(var b=this._sobel_image_data_buffer.length,c=0,d=0,e=0;0<=--b;)d=Math.abs(a.data[b<<1]>>2)&255,e=Math.abs(a.data[(b<<1)+1]>>2)&255,c=d+e>>1&255,this._sobel_image_data_buffer[b]=c<<24|d<<16|0|e}; Photography_with_detected_features.prototype._sobel_postprocessing=function(){chai.assert.isNotNull(this._sobel_image_data,"Photography_with_detected_features._sobel_image_data");chai.assert.isNotNull(this._sobel_image_data_buffer,"Photography_with_detected_features._sobel_image_data_buffer");chai.assert.isNotNull(this._image_data,"Photography_with_detected_features._image_data");chai.assert.isNotNull(this._image_data_buffer,"Photography_with_detected_features._image_data_buffer");for(var a=0;a>>24,c=(this._sobel_image_data_buffer[a]&16711680)>>16,d=(this._sobel_image_data_buffer[a]&65280)>>8,e=this._sobel_image_data_buffer[a]&255;10").attr({id:"bbf-canvas-"+this._image_name});b.get(0).width=this._image.width;b.get(0).height=this._image.height;b.get(0).getContext("2d").drawImage(this._image,0,0,this._image.width,this._image.height);jsfeat.imgproc.grayscale(b.get(0).getContext("2d").getImageData(0,0,this._image.width,this._image.height).data,this._image.width,this._image.height,this._matrix_char8_C1);b=jsfeat.bbf.build_pyramid(this._matrix_char8_C1, 48,48,5);jsfeat.bbf.prepare_cascade(jsfeat.bbf.face_cascade);this._brightness_binary_face=jsfeat.bbf.detect(b,jsfeat.bbf.face_cascade);this._brightness_binary_face=jsfeat.bbf.group_rectangles(this._brightness_binary_face,1);0").attr({id:"frontalface-canvas-"+this._image_name});d.get(0).width=this._image.width;d.get(0).height=this._image.height;d.get(0).getContext("2d").drawImage(this._image,0,0,this._image.width,this._image.height);var e=new jsfeat.matrix_t(this._image.width,this._image.height,jsfeat.U8_t|jsfeat.C1_t),f=new Int32Array((this._image.width+1)*(this._image.height+1)),g=new Int32Array((this._image.width+1)* (this._image.height+1)),h=new Int32Array((this._image.width+1)*(this._image.height+1)),k=new Int32Array((this._image.width+1)*(this._image.height+1));jsfeat.imgproc.grayscale(d.get(0).getContext("2d").getImageData(0,0,this._image.width,this._image.height).data,this._image.width,this._image.height,this._matrix_char8_C1);jsfeat.imgproc.equalize_histogram(this._matrix_char8_C1,this._matrix_char8_C1);jsfeat.imgproc.compute_integral_image(this._matrix_char8_C1,f,g,b.tilted?h:null);jsfeat.imgproc.canny(this._matrix_char8_C1, e,10,50);jsfeat.imgproc.compute_integral_image(e,k,null,null);jsfeat.haar.edges_density=.13;this._haar_feature=jsfeat.haar.detect_multi_scale(f,g,h,k,this._matrix_char8_C1.cols,this._matrix_char8_C1.rows,b,1.15,1);this._haar_feature=jsfeat.haar.group_rectangles(this._haar_feature,1);1