Graduate

Update flask

[verification_server]
model=models/20200816-080621
threshold=0.8
threshold=0.75
image_size=160
......
......@@ -31,8 +31,9 @@ function activate()
function detect_face()
{
alert(tempImage)
let canvas = document.createElement('canvas');
canvas.width = tempImage.width;
canvas.height = tempImage.height;
let ctx = canvas.getContext('2d')
ctx.drawImage(tempImage, 0, 0);
let src = cv.imread(canvas);
......@@ -41,7 +42,6 @@ function detect_face()
let faces = new cv.RectVector();
let classifier = new cv.CascadeClassifier();
classifier.load('haarcascade_frontalface_default.xml');
src.copyTo(dst);
cv.cvtColor(dst, gray, cv.COLOR_RGBA2GRAY, 0);
let msize = new cv.Size(120, 120);
......@@ -55,8 +55,8 @@ function detect_face()
cv.rectangle(dst, point1, point2, [255, 0, 0, 255]);
// margin 44
let rect = new cv.Rect(Math.max(face.x - 22, 0), Math.max(face.y - 22, 0), face.width + 22, face.height + 22);
let cropped = src.roi(rect);
cv.imshow(tempCanvas,cropped);
let cropped = src.roi(rect);
cv.imshow(tempCanvas,cropped);
}
let preview = document.getElementById('preview');
cv.imshow(preview, dst);
......@@ -102,7 +102,10 @@ var loadFile = function(event) {
reader.readAsDataURL(event.target.files[0]);
reader.onload = function() {
tempImage.src = reader.result;
detect_face();
tempImage.onload = function()
{
detect_face();
}
};
};
</script>
......@@ -120,13 +123,13 @@ and is wrapped around the whole page content, except for the footer in this exam
<div class="w3-row", style='text-align:center'>
<h2><b>얼굴 파일을 등록해주세요 (jpeg only)</b></h2>
<div>
학번: <input type="text" name="student_id"><br>
이름: <input type="text" name="student_name"><br><br>
학번: <input type="text" id="student_id"><br>
이름: <input type="text" id="student_name"><br><br>
<input type="file" id="fileloader" name="file" onchange="loadFile(event)" autocomplete="off" accept="image/jpeg" required disabled>
<div>
<canvas id="preview"></canvas>
</div>
<input id="sender" type="button" onclick="submit" value="등록" disabled>
<input id="sender" type="button" onclick="submit()" value="등록" disabled>
</div>
</div>
</div>
......