EmguCV Mat转Image 并获取像素值
作者:互联网
EmguCV Mat 转 Image:
Image<Gray, Byte> img = grayImg.ToImage<Gray, Byte>(); //灰度图
Image<Bgr, Byte> img = grayImg.ToImage<Bgr, Byte>(); //彩色图
获取灰度图像像素值:
Image<Gray, Byte> img = grayImg.ToImage<Gray, Byte>();
double meanValue = 0, sum = 0;
for (int i = 0; i < img.Rows; i++)
{
for (int j = 0; j < img.Cols; j++)
{
sum += img[i, j].Intensity;
}
}
meanValue = sum / (img.Rows * img.Cols);
标签:Mat,img,sum,ToImage,grayImg,EmguCV,灰度,Image 来源: https://blog.51cto.com/u_14009161/2896608