Graduate

Change register method

......@@ -39,9 +39,9 @@ function init()
load_cascade();
});
}).catch(function (err0r) {
console.log("Something went wrong!");
streaming = false;
});
console.log("Something went wrong!");
streaming = false;
});
}
}
......@@ -63,7 +63,6 @@ function main()
let canvasContext = canvasOutput.getContext('2d');
let src = new cv.Mat(video.height, video.width, cv.CV_8UC4);
let dst = new cv.Mat(video.height, video.width, cv.CV_8UC4);
// let gray = new cv.Mat();
let cap = new cv.VideoCapture(video);
let faces = new cv.RectVector();
let classifier = new cv.CascadeClassifier();
......@@ -105,7 +104,6 @@ function main()
// clean and stop.
src.delete();
dst.delete();
gray.delete();
faces.delete();
classifier.delete();
return;
......@@ -115,7 +113,6 @@ function main()
cap.read(src);
cv.flip(src, src, 1);
src.copyTo(dst);
// cv.cvtColor(dst, gray, cv.COLOR_RGBA2GRAY, 0);
// detect faces.
let msize = new cv.Size(video.width / 4, video.height / 4);
classifier.detectMultiScale(dst, faces, 1.1, 3, 0, msize);
......
......@@ -95,7 +95,6 @@ function main()
// clean and stop.
src.delete();
dst.delete();
gray.delete();
faces.delete();
classifier.delete();
return;
......@@ -105,7 +104,6 @@ function main()
cap.read(src);
cv.flip(src, src, 1);
src.copyTo(dst);
// cv.cvtColor(dst, gray, cv.COLOR_RGBA2GRAY, 0);
// detect faces.
let msize = new cv.Size(video.width / 4, video.height / 4);
classifier.detectMultiScale(dst, faces, 1.1, 3, 0, msize);
......@@ -125,6 +123,7 @@ function main()
// 1초동안 인식되면 사진 촬영 종료하고 등록 버튼 활성화
b64encoded = tempCanvas.toDataURL("image/jpeg", 1.0);
toggle_streaming();
change_notice("촬영 완료! 정보를 등록해주세요");
activate_sender();
}
}
......@@ -150,13 +149,23 @@ function toggle_streaming()
{
streamButton = document.getElementById("streamButton");
streaming = !streaming;
if (streaming)
if (streaming){
streamButton.value = "촬영중지";
else
change_notice("1초 후 얼굴을 촬영합니다");
}
else{
streamButton.value = "촬영시작";
change_notice("촬영이 중지되었습니다");
}
main();
}
function change_notice(text)
{
let notice = document.getElementById("notice");
notice.innerHTML = text;
}
function submit()
{
let student_id = document.getElementById('student_id').value;
......@@ -191,7 +200,7 @@ and is wrapped around the whole page content, except for the footer in this exam
</header>
<div class="w3-row", style='text-align:center'>
<h2><b>얼굴을 등록해주세요 (jpeg only)</b></h2>
<h2 id="notice"><b>1초 후 얼굴을 촬영합니다</b></h2>
<div id="container">
<video autoplay="true" id="videoInput" style="display: none; object-fit: cover;"></video>
<canvas id="canvasOutput"></canvas>
......