Introduction to Object Tracking
Object Tracking technology has long been considered as a challenging area in Artificial Intelligence. Extracting intelligence form videos , and predicting the outcome requires expertise not only form computer science and artificial intelligence but also requires expertise in physics, mathematics and other related areas. In this article we will give you an introduction to object tracking with a basic case study cricket ball tracking form a Video stream. This project was done as part of an academic project by one of the students in our organization.

Basically what it does is the following.

1. Capture the frame from each video
2. Process the frame so as to extract the Object information
3.  Track the object (in this case cricket ball ) by drawing the co-ordinates in the frame.

Basically the Project contains two solutions in Visual Studio.
1. One Frame Tracking component developed in VC++
2. Object Tracking application developed in C#.NET which drives the Object Tracking component developed in VC++.

The software developed makes heavy uses of OpenCV and EmuCV Open source libraries. So in order to compile the source code , you need to install OpenCV and EmuCV and configure for Visual Studio.

Here are some of he code snippets from the application..

 public Form1_ObjectTracking()
        {

            try
            {
                InitializeComponent();



                m_objImageIdentification = new ImageIdentification();

            }

            catch(Exception ex)
            {

                MessageBox.Show(ex.Message);

            }
        }
               
        private void btn_Existing_Click(object sender, EventArgs e)
        {

            try
            {

                DialogResult objDialogResult = openFileDialog1.ShowDialog();

                if (objDialogResult == DialogResult.OK)
                {

                    m_strFilePath = openFileDialog1.FileName;

                }

                iCount = 0;

                capture = new Capture(m_strFilePath);

                Image<Bgr, Byte> img1 = capture.QueryFrame();

                img_Video.Image = img1;

             
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
           

        }

        private void My_Timer_Tick(object sender, EventArgs e)
        {

            Image<Bgr, Byte> img = capture.QueryFrame(); 

            Bitmap bmp = img.ToBitmap();
           

            //p = m_objImageIdentification.FrameTrack(bmp);

           // double[,] x = new double[3,3];

           
            float[] center = new float[4];
            center=m_objImageIdentification.FrameTrack(bmp);


            Int32  x = Convert.ToInt32(center[0]);
            Int32 y = Convert.ToInt32(center[1]);

            if (x > 10)
            {

                m_iPoints[iCount,0] = x;

                m_iPoints[iCount, 1] = y;

                if (iCount > 1)
                {

                    for (int i = 1; i <= iCount; i++)
                    {

                        Point first = new Point(m_iPoints[i-1, 0], m_iPoints[i-1, 1]);

                        Point second = new Point(m_iPoints[i, 0], m_iPoints[i, 1]);

                        LineSegment2D line = new LineSegment2D(first, second);

                        img.Draw(line, new Bgr(Color.Red), 2);


                    }

                }


               Point pcenter = new Point(x, y);

            //    Point psecond=new Point(x+5,y+5);;

                CircleF circle = new CircleF(pcenter, 5);

               img.Draw(circle, new Bgr(Color.Red), 2);

            //    LineSegment2D line = new LineSegment2D(pcenter, psecond);

               iCount = iCount + 1;
              
               
            }
            img_Video.Image = img;

           

        }

              private void btn_Play_Click(object sender, EventArgs e)
        {



            time.Interval = 2500 / ifps;



            time.Tick += new EventHandler(My_Timer_Tick);

            time.Start();

        }

        private void btn_Track_Click(object sender, EventArgs e)
        {

            time.Interval = 2500 / ifps;



            time.Tick += new EventHandler(My_Timer_Tick1);

            time.Start();

        }

        private void My_Timer_Tick1(object sender, EventArgs e)
        {

            Image<Bgr, Byte> img = capture.QueryFrame();

            img_Video.Image = img;


        }
    }  

See All Responses Below...
Author
Message Rating
Posted on:
Please Login to Post Your Comments
Name (Max. 100 characters)
Please post your comments here
Select Language
Comments
Attach File(Max. Size: 2 MB)
A few simple rules when posting your Comments,
  1. Please post only answers relevant to the topic of discussion.
  2. Please dont misuse this site or do not be abusive, offensive, inappropriate,harass anyone on the boards or post ads or spam. Doing so will delete your inappropriate messages and will block or delete your account on this site. 

 
Related Threads

TekTipsDownload
GateExam
Academic Projects
TekTipsExperts
Android