المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Get object count



C# Programming
06-06-2010, 09:14 AM
This is what I have done to identify the vehicles from a given picture using Emgu CV (StructuringElementEx). Now I want to get the count of these identified vehicles.
If anyone know how to do that, it is a great help to me.
Thank You.

http://i48.tinypic.com/2r2vza1.jpg

namespace ImagePrjct
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
imageBox2.Image = new Image(@"C:\Users\Rukshan\Desktop\FYP_Update 2.1\New_Traffic_Pics\E4.jpg");
}

private void button1_Click(object sender, EventArgs e)
{
Image ori = new Image ( imageBox2.Image.Bitmap);
Image grayscale = ori.Convert();
imageBox1.Image = grayscale;
}

private void button2_Click(object sender, EventArgs e)
{
Image ori = new Image ( imageBox2.Image.Bitmap);
Image grayscale = ori.Convert();
//blk._Dilate(3);
//blk._Erode(3);
Image thresh = grayscale.ThresholdToZero(new Gray(210));// (new Gray(50), new Gray(255));
//using (Image plateCanny = thresh.Canny(new Gray(100), new Gray(50)))
StructuringElementEx ex = new StructuringElementEx(8, 8, 1, 1, CV_ELEMENT_SHAPE.CV_SHAPE_RECT);

thresh._MorphologyEx(ex, CV_MORPH_OP.CV_MOP_OPEN, 1);

imageBox3.Image = thresh;
}