Commit 613558fe authored by Davis King's avatar Davis King

Fixed some bugs in toMat() which prevented it from compiling sometimes.

parent 9a27c170
...@@ -21,14 +21,14 @@ namespace dlib ...@@ -21,14 +21,14 @@ namespace dlib
typedef typename image_type::type type; typedef typename image_type::type type;
if (pixel_traits<type>::num == 1) if (pixel_traits<type>::num == 1)
{ {
return cv::Mat(img.nr(), img.nc(), cv::DataType<type>::type, &img[0][0], img.width_step()); return cv::Mat(img.nr(), img.nc(), cv::DataType<type>::type, (void*)&img[0][0], img.width_step());
} }
else else
{ {
int depth = sizeof(typename pixel_traits<type>::basic_pixel_type)*8; int depth = sizeof(typename pixel_traits<type>::basic_pixel_type)*8;
int channels = pixel_traits<type>::num; int channels = pixel_traits<type>::num;
int type CV_MAKETYPE(depth, channels); int type = CV_MAKETYPE(depth, channels);
return cv::Mat(img.nr(), img.nc(), type, &img[0][0], img.width_step()); return cv::Mat(img.nr(), img.nc(), type, (void*)&img[0][0], img.width_step());
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment