OpenCvSharp.OpenCvSharpException:“Mat data type is not compatible: CV_8UC1”

mat.GetArray(out int[] data);

Mat为 CV_8UC1,转成int[] 报错 :OpenCvSharp.OpenCvSharpException:“Mat data type is not compatible: CV_8UC1”。

因为mat的类型是CV_8UC1, 不能转成int,只能转成byte,如:

 mat.GetArray(out byte[] data);

你可能感兴趣的:(c#,opencv)