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

This commit is contained in:
Davis King 2012-04-23 21:38:32 -04:00
parent 9a27c170cf
commit 613558feb1
1 changed files with 3 additions and 3 deletions

View File

@ -21,14 +21,14 @@ namespace dlib
typedef typename image_type::type type;
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
{
int depth = sizeof(typename pixel_traits<type>::basic_pixel_type)*8;
int channels = pixel_traits<type>::num;
int type CV_MAKETYPE(depth, channels);
return cv::Mat(img.nr(), img.nc(), type, &img[0][0], img.width_step());
int type = CV_MAKETYPE(depth, channels);
return cv::Mat(img.nr(), img.nc(), type, (void*)&img[0][0], img.width_step());
}
}
}