Showing
1 changed file
with
5 additions
and
3 deletions
... | @@ -30,7 +30,7 @@ | ... | @@ -30,7 +30,7 @@ |
30 | </div> | 30 | </div> |
31 | <script type='text/javascript' src={{url_for('static', filename='js/opencv.js')}}> | 31 | <script type='text/javascript' src={{url_for('static', filename='js/opencv.js')}}> |
32 | <script type='text/javascript'> | 32 | <script type='text/javascript'> |
33 | -let video = document.getElementById('videoElement'); | 33 | +var video = document.querySelector("#videoElement"); |
34 | if (navigator.mediaDevices.getUserMedia){ | 34 | if (navigator.mediaDevices.getUserMedia){ |
35 | navigator.mediaDevices.getUserMedia({ video: true }) | 35 | navigator.mediaDevices.getUserMedia({ video: true }) |
36 | .then(function (stream) { | 36 | .then(function (stream) { |
... | @@ -41,6 +41,7 @@ if (navigator.mediaDevices.getUserMedia){ | ... | @@ -41,6 +41,7 @@ if (navigator.mediaDevices.getUserMedia){ |
41 | } | 41 | } |
42 | </script> | 42 | </script> |
43 | <script> | 43 | <script> |
44 | + let video = document.getElementById('videoElement'); | ||
44 | let src = new cv.Mat(video.height, video.width, cv.CV_8UC4); | 45 | let src = new cv.Mat(video.height, video.width, cv.CV_8UC4); |
45 | let dst = new cv.Mat(video.height, video.width, cv.CV_8UC4); | 46 | let dst = new cv.Mat(video.height, video.width, cv.CV_8UC4); |
46 | let gray = new cv.Mat(); | 47 | let gray = new cv.Mat(); |
... | @@ -81,8 +82,9 @@ if (navigator.mediaDevices.getUserMedia){ | ... | @@ -81,8 +82,9 @@ if (navigator.mediaDevices.getUserMedia){ |
81 | utils.printError(err); | 82 | utils.printError(err); |
82 | } | 83 | } |
83 | }; | 84 | }; |
84 | - // schedule the first one. | 85 | + |
85 | - setTimeout(processVideo, 0); | 86 | +// schedule the first one. |
87 | +setTimeout(processVideo, 0); | ||
86 | </script> | 88 | </script> |
87 | </body> | 89 | </body> |
88 | </html> | 90 | </html> | ... | ... |
-
Please register or login to post a comment