首先生成颜色查找表数组 colormap 数组类型是byte 大小256*3
Mat lut = new Mat( 1,256*3, 0, 3);
lut.SetTo(colormap);
byte[] Imagebigbyte = new byte[ImageWidth*DataNum_row];
Array.Copy(buffer,0,Imagebigbyte,0, ImageWidth*DataNum_row);
//buffer里面保存的时图像的像素值
Mat img = new Mat(ImageWidth, DataNum_row, 0, 1);
Mat Imagebig = new Mat(ImageWidth, DataNum_row * 3 , 0, 3);
Marshal.Copy(Imagebigbyte, 0, img.DataPointer, img.Height * img.Width);
CvInvoke.LUT(Imagebig, lut, Imagebig);
pictureBox2.Image = Imagebig.Bitmap;
在CvInvoke.LUT(Imagebig, lut, Imagebig)报错:
- $exception {"OpenCV: (lutcn == cn || lutcn == 1) && _lut.total() == 256 && _lut.isContinuous() && (depth == CV_8U || depth == CV_8S)"} Emgu.CV.Util.CvException
求大神指教