Mat转matrix
cv::Mat frame = cv::imread("123.jpg");
matrix<dlib::rgb_pixel> img;
assign_image(img,cv_image<rgb_pixel>(frame));
dlib转mat
dlib::array2d<dlib::bgr_pixel> img_bgr;//使用dlib载入彩色的RGB图像
dlib::load_image(img_bgr, "test_image.jpg");
cv::Mat img = dlib::toMat(img_bgr);//这样图片不失真
cv::Mat img = dlib::toMat(img_gray);
Mat转dlib::cv_image
cv::Mat img = cv::imread("test_image.jpg")
dlib::cv_image<rgb_pixel> dlib_img(img);
rect转dlib的rect
dlib::rectangle dlibRect((long)opencvRect.tl().x, (long)opencvRect.tl().y, (long)opencvRect.br().x - 1, (long)opencvRect.br().y - 1);