Objective
The recent use of the Dlib library will also use the OPENCV, especially because the Dlib library's drawing function is not familiar with, want to convert to OpenCV to show. This article describes the conversion between the rectangle types in the two open source libraries.
Type description
The rectangle functions in Cv::rect and OpenCV in OpenCV:
voidconst Scalar &int1int linetype = int0)
Or
void cv::rectangle (Mat &const Scalar &1 int Linetype =int0)
Type of rectangle in Dlib:
Long Long Long bottom_);
Or
Const vector<t,2>&const vector<t,2>& p2);
How to convert
Static cv::rect Dlibrectangletoopencv (Dlib::rectangle r) { return11));}
Or
Static dlib::rectangle Opencvrecttodlib (Cv::rect r) { return dlib::rectangle (long ) r.tl (). x, (long) r.tl (). Y, (long1, (long1);}
Or
DETS.L = detect_rect.x;dets. T = detect_rect.y;dets. R = detect_rect.x + detect_rect.width;dets . B = Detect_rect.y + detect_rect.height;
Where Detect_rect is the OpenCV type, dets is the dlib type;
Reference
The type of rect in 1.OPENCV;
The type of rectangle in 2.dlib;
3.stackoverflow-convert-opencvs-rect-to-dlibs-rectangle;
Conversion of the type format between 4.dlib and OpenCV;
Finish
Conversion between rectangle types in the "OpenCV base" OpenCV and Dlib libraries