I created dll for the dlib face landmark code there used array2d to get the image, but i like to read an image using Mat and to convert to array2d because dlib supports only array2d. Can any one say how to convert mat to array2d ??
Convert a cv::Mat image to dlib::array2d:
In case of a BGR image, you can follow this:
dlib::array2d<dlib::bgr_pixel> dlibImage;
dlib::assign_image(dlibImage, dlib::cv_image<dlib::bgr_pixel>(cvMatImage));
And, if you have a grayscale image, simply use <unsigned char>
instead of <bgr_pixel>
:
dlib::array2d<unsigned char> dlibImageGray;
dlib::assign_image(dlibImageGray, dlib::cv_image<unsigned char>(cvMatImageGray));