Hi, I try to load trained model "lbfmodel.yaml" by loadModel(). Сompilator gives read access error. "lbfmodel.yaml" located in project root folder
Here is a code:
include <windows.h>
include "opencv.hpp"
include "face/include/opencv2/face.hpp"
include "drawLandmarks.hpp"
include "facemark.hpp"
include "facemarkLBF.hpp"
include <kernelspecs.h>
using namespace cv; using namespace cv::face;
include <iostream>
using namespace std;
int main(int argc, char** argv) {
LoadLibrary("opencv_highgui400d.dll");
LoadLibrary("opencv_core400d.dll");
LoadLibrary("opencv_videoio400d.dll");
LoadLibrary("opencv_imgproc400d.dll");
LoadLibrary("opencv_objdetect400d.dll");
cv::CascadeClassifier faceDetector("haarcascade_frontalface_alt2.xml");
Ptr<Facemark> facemark = FacemarkLBF::create();
facemark->loadModel("lbfmodel.yaml");
VideoCapture cam(0);
Mat frame, gray;
while (cam.read(frame))
{
vector<Rect> faces;
cvtColor(frame, gray, COLOR_BGR2GRAY);
faceDetector.detectMultiScale(gray, faces);
vector< vector<Point2f> > landmarks;
bool success = facemark->fit(frame, faces, landmarks);
if (success)
{
for (int i = 0; i < landmarks.size(); i++)
{
drawLandmarks(frame, landmarks[i]);
}
}
imshow("Facial Landmark Detection", frame);
if (waitKey(1) == 27) break;
}
return 0;
}