Open zhanghz opened 7 years ago
Currently, we use dlib::frontal_face_detector, is there other face detector?
Yes, with opencv cascadeclassifier. I have developed this, with mk (with CMakeLists.txt i've a lot of errors) and linked the build with gradle.
When i finish the test I will do the push request
// The format of mat should be BGR or Gray // If converting 4 channels to 3 channls because the format could be BGRA or // ARGB virtual inline int det(const cv::Mat& image) { if (image.empty()) return 0; LOG(INFO) << "com_tzutalin_dlib_PeopleDet go to det(mat)"; if (image.channels() == 1) { cv::cvtColor(image, image, CV_GRAY2BGR); } CHECK(image.channels() == 3); // TODO : Convert to gray image to speed up detection // It's unnecessary to use color image for face/landmark detection dlib::cv_image img(image);
mRets = mFaceDetector(img);
LOG(INFO) << "Dlib HOG face det size : " << mRets.size();
mFaceShapeMap.clear();
// Process shape
if (mRets.size() != 0 && mLandMarkModel.empty() == false) {
for (unsigned long j = 0; j < mRets.size(); ++j) {
dlib::full_object_detection shape = msp(img, mRets[j]);
LOG(INFO) << "face index:" << j
<< "number of parts: " << shape.num_parts();
mFaceShapeMap[j] = shape;
}
}
return mRets.size();
}