Graduate

Update flask

......@@ -11,6 +11,7 @@
<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");
function load_cascade()
{
let faceCascadeFile = 'haarcascade_frontalface_default.xml'
......@@ -26,11 +27,15 @@ function activate()
fileloader.disabled = false;
}
function detect_face()
function detect_face(img)
{
let classifier = new cv.CascadeClassifier();
classifier.load('haarcascade_frontalface_default.xml');
let src = cv.imread('imagefile');
let canvas = document.createElement('canvas');
let ctx = canvas.getContext("2d")
ctx.src = img;
let src = cv.imread(canvas);
let dst = new cv.Mat(video.height, video.width, cv.CV_8UC4);
let gray = new cv.Mat();
src.copyTo(dst);
......@@ -91,13 +96,10 @@ var loadFile = function(event) {
var reader = new FileReader();
reader.readAsDataURL(event.target.files[0]);
reader.onload = function() {
var output = document.getElementById('imagefile');
output.src = reader.result;
detect_face();
let img = reader.result;
detect_face(img);
};
};
let tempCanvas = document.createElement("canvas");
</script>
</head>
<body onload="cv['onRuntimeInitialized']=()=>{load_cascade();};" class="w3-light-grey">
......@@ -117,7 +119,6 @@ and is wrapped around the whole page content, except for the footer in this exam
이름: <input type="text" name="student_name"><br><br>
<input type="file" id="fileloader" name="file" onchange="loadFile(event)" autocomplete="off" accept="image/jpeg" required disabled>
<div>
<img id="imagefile">
<canvas id="preview"></canvas>
</div>
<input id="sender" type="button" onclick="submit" value="등록" disabled>
......