EmguCV-图像通道分离与合并

Mat img3 = CvInvoke.Imread(@"C:\Users\Administrator\Desktop\22.jpg", LoadImageType.Color);
  Mat[] channelsArray = img3.Split();
   CvInvoke.Imshow("B", channelsArray[0]);
   CvInvoke.Imshow("G", channelsArray[1]);
   CvInvoke.Imshow("R", channelsArray[2]);

   //通道合并
   Mat dst = new Mat();
   VectorOfMat vectorOfMat =  new VectorOfMat();
   for (int i = 0; i < 3; i++)
   {
       CvInvoke.Threshold(channelsArray[i], channelsArray[i], 100, 255, ThresholdType.Binary);

       vectorOfMat.Push(channelsArray[i]);
   }
   CvInvoke.Merge(vectorOfMat, dst);
   CvInvoke.Imshow("img vectorOfMat", dst);
   CvInvoke.Imshow("img show", img3);
   CvInvoke.WaitKey(0);

 

留下评论

您的邮箱地址不会被公开。 必填项已用 * 标注