How to find the model files for "facemark->load models" of OpenCV_Contrib?

asked 2018-01-02 07:08:58 -0600

hsmlee gravatar image

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&lt;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"); "

edit retag flag offensive close merge delete

Comments

it seems, they have not found a final place for this yet, but there should be one in opencv/.cache/data, and another copy in opencv/build/testdata/cv/face

berak gravatar imageberak ( 2018-01-02 07:26:25 -0600 )edit

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

berak gravatar imageberak ( 2018-01-02 07:30:04 -0600 )edit

opencv/.cache/data, and another copy in opencv/build/testdata/cv/face

It didn't work

hsmlee gravatar imagehsmlee ( 2018-01-03 10:41:51 -0600 )edit

facemark->loadModel("load model"); -- it needs the path to the model here.

berak gravatar imageberak ( 2018-01-03 10:45:03 -0600 )edit