You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: face_recogition/preprocessFace.cpp
+118
Original file line number
Diff line number
Diff line change
@@ -344,3 +344,121 @@ Mat getPreprocessedFace(Mat &srcImg, int desiredFaceWidth, CascadeClassifier &fa
344
344
}
345
345
returnMat();
346
346
}
347
+
348
+
Mat getPreprocessedFaceFromClient(Mat &srcImg, int desiredFaceWidth, CascadeClassifier &faceCascade, CascadeClassifier &eyeCascade1, CascadeClassifier &eyeCascade2, bool doLeftAndRightSeparately, Rect *storeFaceRect, Point *storeLeftEye, Point *storeRightEye, Rect *searchedLeftEye, Rect *searchedRightEye)
349
+
{
350
+
// Use square faces.
351
+
int desiredFaceHeight = desiredFaceWidth;
352
+
353
+
Mat faceImg = srcImg; // Get the detected face image.
354
+
355
+
// If the input image is not grayscale, then convert the BGR or BGRA color image to grayscale.
356
+
Mat gray;
357
+
if (faceImg.channels() == 3) {
358
+
cvtColor(faceImg, gray, CV_BGR2GRAY);
359
+
}
360
+
elseif (faceImg.channels() == 4) {
361
+
cvtColor(faceImg, gray, CV_BGRA2GRAY);
362
+
}
363
+
else {
364
+
// Access the input image directly, since it is already grayscale.
365
+
gray = faceImg;
366
+
}
367
+
368
+
// Search for the 2 eyes at the full resolution, since eye detection needs max resolution possible!
// If a face is found, it can store the rect coordinates into 'storeFaceRect' and 'storeLeftEye' & 'storeRightEye' if given,
60
60
// and eye search regions into 'searchedLeftEye' & 'searchedRightEye' if given.
61
61
Mat getPreprocessedFace(Mat &srcImg, int desiredFaceWidth, CascadeClassifier &faceCascade, CascadeClassifier &eyeCascade1, CascadeClassifier &eyeCascade2, bool doLeftAndRightSeparately, Rect *storeFaceRect = NULL, Point *storeLeftEye = NULL, Point *storeRightEye = NULL, Rect *searchedLeftEye = NULL, Rect *searchedRightEye = NULL);
62
-
62
+
Mat getPreprocessedFaceFromClient(Mat &srcImg, int desiredFaceWidth, CascadeClassifier &faceCascade, CascadeClassifier &eyeCascade1, CascadeClassifier &eyeCascade2, bool doLeftAndRightSeparately, Rect *storeFaceRect = NULL, Point *storeLeftEye = NULL, Point *storeRightEye = NULL, Rect *searchedLeftEye = NULL, Rect *searchedRightEye = NULL);
0 commit comments