[英]How to detect number of objects from image?
I have a windows forms application and i want to count number of objects from a medical images. 我有一个Windows窗体应用程序,我想从医学图像中计算对象的数量。 For instance
例如
I used an algorithm which can take the contours of every object from the image. 我使用了一种算法,可以从图像中提取每个对象的轮廓。
private void findContoursToolStripMenuItem_Click(object sender, EventArgs e)
{
Image<Gray, byte> imgOutput = imgInput.Convert<Gray, byte>().ThresholdBinary(new Gray(100), new Gray(255));
Emgu.CV.Util.VectorOfVectorOfPoint contours = new Emgu.CV.Util.VectorOfVectorOfPoint();
Mat hier = new Mat();
Image<Gray, byte> imgout = new Image<Gray, byte>(imgInput.Width, imgInput.Height, new Gray(100));
CvInvoke.FindContours(imgOutput, contours, hier, Emgu.CV.CvEnum.RetrType.External, Emgu.CV.CvEnum.ChainApproxMethod.ChainApproxSimple);
CvInvoke.DrawContours(imgout, contours, -1, new MCvScalar(123, 0, 0));
pictureBox2.Image = imgout.Bitmap;
}
But I can't find out the number of cells from the image. 但是我无法从图像中找出细胞的数量。 Any advice or algorithm I have to use ?
我必须使用任何建议或算法吗?
I search within EMGU
documentation but I don't find any function which does somethink like I want. 我在
EMGU
文档中进行搜索,但是找不到任何可以实现所需功能的函数。
Any advice or answer will be rewarded. 任何建议或答案将得到奖励。
If you consider that is too broad, I don't want the implemented algorithm. 如果您认为范围太广,我不希望实现算法。 I just need some ideas or a suggestion of algorithm i have to use.
我只需要一些想法或必须使用的算法建议即可。
这可能有点基础和蛮力,但是如何在图像上选择接近绿色的随机点,然后有效地搜索“匹配”颜色(对相同颜色具有容忍度。当您访问每个像素时,将其涂成黑色,这样您就无需再查看它并计算已着色的像素数。每次选择一个像素时,请确保它不是黑色的。一旦找不到更多的点,如果黑色的数量像素大于公差(因此您只能找到“大”多边形),然后将其计入像元数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.