Showing
1 changed file
with
6 additions
and
6 deletions
... | @@ -66,8 +66,8 @@ function init() | ... | @@ -66,8 +66,8 @@ function init() |
66 | var ratio = 1.0; | 66 | var ratio = 1.0; |
67 | video.width = video.videoWidth; | 67 | video.width = video.videoWidth; |
68 | video.height = video.videoHeight; | 68 | video.height = video.videoHeight; |
69 | - if (video.width > screenWidth || video.height + headerHeight + messageboxHeight / 2 > screenHeight){ | 69 | + if (video.width > screenWidth || video.height + headerHeight + messageboxHeight > screenHeight){ |
70 | - ratio = Math.min(screenWidth / video.width * 1.0, screenHeight / ((video.height + headerHeight + messageboxHeight / 2) * 1.0)); | 70 | + ratio = Math.min(screenWidth / video.width * 1.0, screenHeight / ((video.height + headerHeight + messageboxHeight) * 1.0)); |
71 | } | 71 | } |
72 | container.style.width = Math.round(video.width * ratio) + 'px'; | 72 | container.style.width = Math.round(video.width * ratio) + 'px'; |
73 | container.style.height = Math.round(video.height * ratio) + 'px'; | 73 | container.style.height = Math.round(video.height * ratio) + 'px'; |
... | @@ -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 | + var dsize = new cv.Size(canvasOutput.width, canvasOutput.height); | ||
103 | let cap = new cv.VideoCapture(video); | 104 | let cap = new cv.VideoCapture(video); |
104 | let faces = new cv.RectVector(); | 105 | let faces = new cv.RectVector(); |
105 | let classifier = new cv.CascadeClassifier(); | 106 | let classifier = new cv.CascadeClassifier(); |
... | @@ -189,26 +190,25 @@ function main() | ... | @@ -189,26 +190,25 @@ function main() |
189 | var newHead = "<div class='message attend'>"; | 190 | var newHead = "<div class='message attend'>"; |
190 | var newTail = "</div>"; | 191 | var newTail = "</div>"; |
191 | var newContent = '[' + data.student_id + '/' + data.student_name + ']' + "출석되었습니다."; | 192 | var newContent = '[' + data.student_id + '/' + data.student_name + ']' + "출석되었습니다."; |
192 | - $('#messagebox').prepend(newHead + newContent + newTail).stop().animate({ scrollTop: $('#messages')[0].scrollHeight }, 300); | 193 | + $('#messagebox').prepend(newHead + newContent + newTail).stop().animate({ scrollTop: $('#messages')[0].scrollHeight }, 1000); |
193 | } | 194 | } |
194 | else if (data.status == "already"){ | 195 | else if (data.status == "already"){ |
195 | var newHead = "<div class='message already'>"; | 196 | var newHead = "<div class='message already'>"; |
196 | var newTail = "</div>"; | 197 | var newTail = "</div>"; |
197 | var newContent = '[' + data.student_id + '/' + data.student_name + ']' + "이미 출석되었습니다."; | 198 | var newContent = '[' + data.student_id + '/' + data.student_name + ']' + "이미 출석되었습니다."; |
198 | - $('#messagebox').prepend(newHead + newContent + newTail).stop().animate({ scrollTop: $('#messages')[0].scrollHeight }, 300); | 199 | + $('#messagebox').prepend(newHead + newContent + newTail).stop().animate({ scrollTop: $('#messages')[0].scrollHeight }, 1000); |
199 | } | 200 | } |
200 | else if (data.status == "fail"){ | 201 | else if (data.status == "fail"){ |
201 | var newHead = "<div class='message fail'>"; | 202 | var newHead = "<div class='message fail'>"; |
202 | var newTail = "</div>"; | 203 | var newTail = "</div>"; |
203 | var newContent = "인식 실패"; | 204 | var newContent = "인식 실패"; |
204 | - $('#messagebox').prepend(newHead + newContent + newTail).stop().animate({ scrollTop: $('#messages')[0].scrollHeight }, 300); | 205 | + $('#messagebox').prepend(newHead + newContent + newTail).stop().animate({ scrollTop: $('#messages')[0].scrollHeight }, 1000); |
205 | } | 206 | } |
206 | } | 207 | } |
207 | }); | 208 | }); |
208 | } | 209 | } |
209 | } | 210 | } |
210 | // to do resize preview | 211 | // to do resize preview |
211 | - var dsize = new cv.Size(canvasOutput.width, canvasOutput.height); | ||
212 | cv.resize(dst, dst, dsize, 0, 0, cv.INTER_AREA); | 212 | cv.resize(dst, dst, dsize, 0, 0, cv.INTER_AREA); |
213 | cv.imshow('canvasOutput', dst); | 213 | cv.imshow('canvasOutput', dst); |
214 | // schedule the next one. | 214 | // schedule the next one. | ... | ... |
-
Please register or login to post a comment