tzutalin / dlib-android

:dragon: Port dlib to Android
MIT License
867 stars 268 forks source link

I found the class FaceDet default use dlib::frontal_face_detector . can I change other detector? #33

Open zhanghz opened 7 years ago

zhanghz commented 7 years ago

// 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(); }

tzutalin commented 7 years ago

Currently, we use dlib::frontal_face_detector, is there other face detector?

hector7 commented 7 years ago

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