Graduate

Dectect optimization

...@@ -100,6 +100,7 @@ function main() ...@@ -100,6 +100,7 @@ function main()
100 let canvasContext = canvasOutput.getContext('2d'); 100 let canvasContext = canvasOutput.getContext('2d');
101 let src = new cv.Mat(video.height, video.width, cv.CV_8UC4); 101 let src = new cv.Mat(video.height, video.width, cv.CV_8UC4);
102 let dst = new cv.Mat(video.height, video.width, cv.CV_8UC4); 102 let dst = new cv.Mat(video.height, video.width, cv.CV_8UC4);
103 + let msize = new cv.Size(video.width / 4, video.height / 4);
103 let dsize = new cv.Size(canvasOutput.width, canvasOutput.height); 104 let dsize = new cv.Size(canvasOutput.width, canvasOutput.height);
104 let cap = new cv.VideoCapture(video); 105 let cap = new cv.VideoCapture(video);
105 let faces = new cv.RectVector(); 106 let faces = new cv.RectVector();
...@@ -152,7 +153,6 @@ function main() ...@@ -152,7 +153,6 @@ function main()
152 cv.flip(src, src, 1); 153 cv.flip(src, src, 1);
153 src.copyTo(dst); 154 src.copyTo(dst);
154 // detect faces. 155 // detect faces.
155 - let msize = new cv.Size(video.width / 4, video.height / 4);
156 classifier.detectMultiScale(dst, faces, 1.1, 5, 0, msize); 156 classifier.detectMultiScale(dst, faces, 1.1, 5, 0, msize);
157 // draw faces. 157 // draw faces.
158 for (let i = 0; i < faces.size(); ++i) { 158 for (let i = 0; i < faces.size(); ++i) {
......
...@@ -81,6 +81,7 @@ function main() ...@@ -81,6 +81,7 @@ function main()
81 let canvasContext = canvasOutput.getContext('2d'); 81 let canvasContext = canvasOutput.getContext('2d');
82 let src = new cv.Mat(video.height, video.width, cv.CV_8UC4); 82 let src = new cv.Mat(video.height, video.width, cv.CV_8UC4);
83 let dst = new cv.Mat(video.height, video.width, cv.CV_8UC4); 83 let dst = new cv.Mat(video.height, video.width, cv.CV_8UC4);
84 + let msize = new cv.Size(video.width / 4, video.height / 4);
84 let dsize = new cv.Size(canvasOutput.width, canvasOutput.height); 85 let dsize = new cv.Size(canvasOutput.width, canvasOutput.height);
85 let cap = new cv.VideoCapture(video); 86 let cap = new cv.VideoCapture(video);
86 let faces = new cv.RectVector(); 87 let faces = new cv.RectVector();
...@@ -132,7 +133,6 @@ function main() ...@@ -132,7 +133,6 @@ function main()
132 cv.flip(src, src, 1); 133 cv.flip(src, src, 1);
133 src.copyTo(dst); 134 src.copyTo(dst);
134 // detect faces. 135 // detect faces.
135 - let msize = new cv.Size(video.width / 4, video.height / 4);
136 classifier.detectMultiScale(dst, faces, 1.1, 5, 0, msize); 136 classifier.detectMultiScale(dst, faces, 1.1, 5, 0, msize);
137 // draw faces. 137 // draw faces.
138 for (let i = 0; i < faces.size(); ++i) { 138 for (let i = 0; i < faces.size(); ++i) {
......