Graduate

Update flask

......@@ -11,7 +11,9 @@
<script type='text/javascript' src="{{url_for('static', filename='js/utils.js')}}"></script>
<script type='text/javascript' src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type='text/javascript'>
let tempCanvas = document.createElement("canvas");
var tempImage = new Image();
var tempCanvas = document.createElement("canvas");
function load_cascade()
{
let faceCascadeFile = 'haarcascade_frontalface_default.xml'
......@@ -27,11 +29,11 @@ function activate()
fileloader.disabled = false;
}
function detect_face(img)
function detect_face()
{
let canvas = document.createElement('canvas');
let ctx = canvas.getContext('2d')
ctx.src = img;
ctx.drawImage(tempImage, 0, 0);
let src = cv.imread(canvas);
let dst = new cv.Mat(src.cols, src.rows, cv.CV_8UC4);
let gray = new cv.Mat();
......@@ -98,8 +100,8 @@ var loadFile = function(event) {
var reader = new FileReader();
reader.readAsDataURL(event.target.files[0]);
reader.onload = function() {
let img = reader.result;
detect_face(img);
tempImage.src = reader.result;
detect_face();
};
};
</script>
......