How to find the model files for "facemark->load models" of OpenCV_Contrib?
bool myDetector(cv::InputArray image, cv::OutputArray faces, cv::CascadeClassifier *face_cascade){ cv::Mat gray;
if (image.channels() > 1) cvtColor(image, gray, CV_BGR2GRAY); else gray = image.getMat().clone();
equalizeHist(gray, gray);
std::vectorcv::Rect faces_; face_cascade->detectMultiScale(gray, faces_, 1.4, 2, cv::CASCADE_SCALE_IMAGE, cv::Size(30, 30)); cv::Mat(faces_).copyTo(faces); return true; }
(UIImage *) detectFacialLandmark:(UIImage *) image{ double CurrentTime = CACurrentMediaTime();
NSString *pathToFaceCascade = [[NSBundle mainBundle] pathForResource:@"lbpcascade_frontalface" ofType:@"xml"];
cv::Mat faceImage; UIImageToMat(image, faceImage);
cv::CascadeClassifier face_cascade; face_cascade.load([pathToFaceCascade UTF8String]); cv::face::FacemarkKazemi::Params params; cv::Ptrcv::face::FacemarkKazemi facemark = cv::face::FacemarkKazemi::create(params); facemark->setFaceDetector((cv::face::FN_FaceDetector)myDetector, &face_cascade); facemark->loadModel("load model"); std::vectorcv::Rect faces; resize(faceImage,faceImage,cv::Size(460,460), 0, 0, cv::INTER_LINEAR_EXACT); facemark->getFaces(faceImage,faces); std::vector< std::vectorcv::Point2f > shapes; if(facemark->fit(faceImage,faces,shapes)) { for( size_t i = 0; i < faces.size(); i++ ) { cv::rectangle(faceImage, faces[i], cvScalar(255, 0, 0)); } for(unsigned long i=0;i<faces.size();i++){ for(unsigned="" long="" k="0;k<shapes[i].size();k++)" cv::circle(faceimage,shapes[i][k],5,cv::scalar(0,0,255),cv::filled);="" }="" }<="" p="">
UIImage *returnImage = MatToUIImage(faceImage); NSLog(@"test processing time : %f", (CACurrentMediaTime() - CurrentTime));
return returnImage; }
I'm doing the project for the iOS application. For this project, I'm using OpenCV. Specifically, I added OpenCV_contrib modules to obtain the information of face landmarks.
During applied OpenCV_contrib, I have met one problem. facemark->loadModel("load model"); For detecting the facemark, I have to find the model files.
I wonder that how can I find the model files for "facemark->loadModel("load model"); "
it seems, they have not found a final place for this yet, but there should be one in
opencv/.cache/data
, and another copy inopencv/build/testdata/cv/face
can you please close your github issue ? you're not reporting a library bug, but that tracker is reserved for that.
also please close the pull request, which neither solves your problem or does anything useful otherwise.
and damn, close this other issue, too
opencv/.cache/data, and another copy in opencv/build/testdata/cv/face
It didn't work
facemark->loadModel("load model");
-- it needs the path to the model here.