Emgu实现图像分割
C#通过Emgu这个图像处理库,可以很方便的将一幅单通道图像分割为R、G、B三个单通道图像。
Image<Bgr, Byte> ImageBGR = null; Image<Bgr, Byte> ImageSrc = null; Image<Bgr, Byte> ImageB = null; Image<Bgr, Byte> ImageG = null; Image<Bgr, Byte> ImageR = null; Mat one_channelB; Mat one_channelG; Mat one_channelR; private void Form1_Load(object sender, EventArgs e) { ImageSrc = new Image<Bgr, Byte>(path); ImageBGR = ImageSrc.Clone(); CvInvoke.Split(ImageBGR, vm); var vms = vm.GetOutputArray(); one_channelB = vms.GetMat(0); one_channelG = vms.GetMat(1); one_channelR = vms.GetMat(2); pb_imageRgb.Image = ImageBGR.Bitmap; pb_imageR.Image = ImageR.Bitmap; pb_imageG.Image = one_channelG.Bitmap; pb_imageR.Image = one_channelR.Bitmap; }
4556