使用emgu.cv分离分水岭后的图像

时间:2014-07-03 09:25:50

标签: c# image-processing emgucv watershed

我有一个血液图像,我在它上面应用分水岭..它的工作和确定细胞,但我不知道如何把每个细胞放在一个单独的图像..我正在使用emgu.cv我能得到一些帮助

这里我使用我的分水岭方法对图片进行分割,然后将标记放在原始图像上

Image<Gray, Int32> boundaryImage = watershedSegmenter.Process(image);
Image<Gray, Byte> test = watershedSegmenter.GetWatersheds(); Image<Bgr, byte>dest=new Image<Bgr, byte>(image.Width, image.Height);
dest = image.And(image, test);            
pictureBox1.Width = boundaryImage.ToBitmap().Width;
pictureBox1.Height = boundaryImage.ToBitmap().Height;
pictureBox1.BackgroundImage = boundaryImage.ToBitmap();

1 个答案:

答案 0 :(得分:0)

似乎EMGUcv cvWatershed()有一些尚未解决的错误。标记图像始终返回白色图像。你能分享你的第一阶段输出图像吗?  我无法使用此代码查看任何图片。

Image<Bgr, Byte> image = Img_Source_Bgr.Copy();
Image<Gray, Int32> marker = new Image<Gray, Int32>(image.Width, image.Height);
Rectangle rect = image.ROI;
marker.Draw(
new CircleF(
new PointF(rect.Left + rect.Width / 2.0f, rect.Top + rect.Height / 2.0f),
    /*(float)(Math.Min(image.Width, image.Height) / 20.0f)*/ 5.0f),
new Gray(255),
0);
Image<Bgr, Byte> result = image.ConcateHorizontal(marker.Convert<Bgr, byte>());
Image<Gray, Byte> mask = new Image<Gray, byte>(image.Size);
CvInvoke.cvWatershed(image, marker);
CvInvoke.cvCmpS(marker, 0.10, mask, CMP_TYPE.CV_CMP_GT);

imageBox1.Image = mask;