Graduate

Update face detection module

......@@ -22,9 +22,18 @@
background-color: #666;
}
</style>
<script type='text/javascript' src="{{url_for('static', filename='js/opencv.js')}}"></script>
<script type='text/javascript' src="{{url_for('static', filename='js/utils.js')}}"></script>
<script type='text/javascript'>
let utils = new Utils('errorMessage');
utils.loadOpenCv(() => {
let faceCascadeFile = '/static/js/haarcascade_frontalface_default.xml';
utils.createFileFromUrl(faceCascadeFile, faceCascadeFile, () => {
alert(faceCascadeFile);
});
});
function main()
{
let video = document.getElementById("videoInput");
......@@ -47,12 +56,8 @@ let faces = new cv.RectVector();
let classifier = new cv.CascadeClassifier();
var streaming = true;
let utils = new Utils('errorMessage'); //use utils class
let faceCascadeFile = "/static/js/haarcascade_frontalface_default.xml"
utils.createFileFromUrl(faceCascadeFile, faceCascadeFile, () => {
alert(faceCascadeFile);
classifier.load(faceCascadeFile);
});
classifier.load('static/js/haarcascade_frontalface_default.xml');
const FPS = 30;
function processVideo() {
try {
......