Graduate

Update face detection module

...@@ -22,9 +22,18 @@ ...@@ -22,9 +22,18 @@
22 background-color: #666; 22 background-color: #666;
23 } 23 }
24 </style> 24 </style>
25 -<script type='text/javascript' src="{{url_for('static', filename='js/opencv.js')}}"></script>
26 <script type='text/javascript' src="{{url_for('static', filename='js/utils.js')}}"></script> 25 <script type='text/javascript' src="{{url_for('static', filename='js/utils.js')}}"></script>
27 <script type='text/javascript'> 26 <script type='text/javascript'>
27 +
28 +let utils = new Utils('errorMessage');
29 +
30 +utils.loadOpenCv(() => {
31 + let faceCascadeFile = '/static/js/haarcascade_frontalface_default.xml';
32 + utils.createFileFromUrl(faceCascadeFile, faceCascadeFile, () => {
33 + alert(faceCascadeFile);
34 + });
35 +});
36 +
28 function main() 37 function main()
29 { 38 {
30 let video = document.getElementById("videoInput"); 39 let video = document.getElementById("videoInput");
...@@ -47,12 +56,8 @@ let faces = new cv.RectVector(); ...@@ -47,12 +56,8 @@ let faces = new cv.RectVector();
47 let classifier = new cv.CascadeClassifier(); 56 let classifier = new cv.CascadeClassifier();
48 var streaming = true; 57 var streaming = true;
49 58
50 -let utils = new Utils('errorMessage'); //use utils class 59 +classifier.load('static/js/haarcascade_frontalface_default.xml');
51 -let faceCascadeFile = "/static/js/haarcascade_frontalface_default.xml" 60 +
52 -utils.createFileFromUrl(faceCascadeFile, faceCascadeFile, () => {
53 - alert(faceCascadeFile);
54 - classifier.load(faceCascadeFile);
55 -});
56 const FPS = 30; 61 const FPS = 30;
57 function processVideo() { 62 function processVideo() {
58 try { 63 try {
......