Graduate

Update flask

...@@ -112,7 +112,7 @@ function processVideo() { ...@@ -112,7 +112,7 @@ function processVideo() {
112 let point2 = new cv.Point(face.x + face.width, face.y + face.height); 112 let point2 = new cv.Point(face.x + face.width, face.y + face.height);
113 cv.rectangle(dst, point1, point2, [255, 0, 0, 255]); 113 cv.rectangle(dst, point1, point2, [255, 0, 0, 255]);
114 let cropped = new cv.Mat(); 114 let cropped = new cv.Mat();
115 - let rect = new cv.Rect(face.x - 22, face.y - 22, face.width + 22, face.height + 22); 115 + let rect = new cv.Rect(Math.max(face.x - 22, 0), Math.max(face.y - 22, 0), face.width + 22, face.height + 22);
116 cropped = src.roi(rect); 116 cropped = src.roi(rect);
117 let tempCanvas = document.createElement("canvas"); 117 let tempCanvas = document.createElement("canvas");
118 cv.imshow(tempCanvas,cropped); 118 cv.imshow(tempCanvas,cropped);
......
...@@ -54,7 +54,7 @@ function detect_face() ...@@ -54,7 +54,7 @@ function detect_face()
54 let point2 = new cv.Point(face.x + face.width, face.y + face.height); 54 let point2 = new cv.Point(face.x + face.width, face.y + face.height);
55 cv.rectangle(dst, point1, point2, [255, 0, 0, 255]); 55 cv.rectangle(dst, point1, point2, [255, 0, 0, 255]);
56 // margin 44 56 // margin 44
57 - let rect = new cv.Rect(face.x - 22, face.y - 22, face.width + 22, face.height + 22); 57 + let rect = new cv.Rect(Math.max(face.x - 22, 0), Math.max(face.y - 22, 0), face.width + 22, face.height + 22);
58 let cropped = src.roi(rect); 58 let cropped = src.roi(rect);
59 cv.imshow(tempCanvas,cropped); 59 cv.imshow(tempCanvas,cropped);
60 } 60 }
......