Graduate

Update cropping logic

......@@ -127,7 +127,7 @@ function processVideo() {
let point2 = new cv.Point(face.x + face.width, face.y + face.height);
cv.rectangle(dst, point1, point2, [255, 0, 0, 255], 8);
let cropped = new cv.Mat();
let rect = new cv.Rect(face.x, face.y, face.width, face.height);
let rect = new cv.Rect(Math.max(face.x-face.width/4, 0), Math.max(face.y-face.height/2, 0), Math.min(face.width+face.width/2, src.cols), Math.min(face.height*2, src.rows));
cropped = src.roi(rect);
let tempCanvas = document.createElement("canvas");
cv.imshow(tempCanvas,cropped);
......
......@@ -61,9 +61,9 @@ function detect_face()
let point1 = new cv.Point(face.x, face.y);
let point2 = new cv.Point(face.x + face.width, face.y + face.height);
cv.rectangle(dst, point1, point2, [255, 0, 0, 255], 8);
let rect = new cv.Rect(Math.max(face.x-face.width/4, 0), Math.max(face.y-face.height/2, 0), Math.min(face.width+face.width/2, src.cols), Math.min(face.height+face.height/2, src.rows));
let cropped = src.roi(rect);
cv.imshow(tempCanvas,cropped);
let rect = new cv.Rect(Math.max(face.x-face.width/4, 0), Math.max(face.y-face.height/2, 0), Math.min(face.width+face.width/2, src.cols), Math.min(face.height*2, src.rows));
let cropped = src.roi(rect);
cv.imshow(tempCanvas,cropped);
}
if (faces.size() == 1)
{
......