I am trying to integrate dlib with the zed 3D camera in their webcam_face_pose_ex by retrieving the input through the Zed camera rather than the normal webcam.
The problem occurs when trying to match the captured image matrices to be used by the dlib. In dlib I have to convert the cv::Mat of the image that I retrieved from the Zed camera to be in dlib's special format that is used within the example as in below:
cv::Mat temp = sl::zed::slMat2cvMat(left); // converts the zed Mat to openCV mat
cv_image<bgr_pixel> cimg(temp); // converts the opencv matrix to dlib matrix`
I receive the following error when doing the second step is as follows:
Error detected at line 36.
Error detected in file /home/yomna/Resources/apps/dlib/dlib-master/dlib/../dlib/opencv/cv_image.h.
Error detected in function dlib::cv_image<pixel_type>::cv_image(cv::Mat) [with pixel_type = dlib::bgr_pixel].
Failing expression was img.depth() == cv::DataType<typename pixel_traits<pixel_type>::basic_pixel_type>::depth && img.channels() == pixel_traits<pixel_type>::num.
The pixel type you gave doesn't match pixel used by the open cv Mat object.
img.depth(): 0
img.cv::DataType<typename pixel_traits<pixel_type>::basic_pixel_type>::depth: 0
img.channels(): 1
img.pixel_traits<pixel_type>::num: 3
Do you know what's wrong with the conversion between the openCV image matrix to the dlib format that might cause this?
The error you pasted says
It also tells you your image is single channel. So it's not a BGR image. It looks like 8bit grayscale, so you need to use something like unsigned char as the pixel since that's the type of image you have.