Kalman Tracking for Image Processing Applications Student: Julius Oyeleke Supervisor: Dr Martin Glavin Co-Supervisor: Dr Fearghal Morgan Objective of Project 1. To track a red ball over a frame of video 2. Image Thresholding 3. Find the centre point of the ball 4. The use of Kalman filtering to • • track the red ball in the image. predict the path of the ball in future as an aid of detection. 5. Display with Overlay OpenCV (computer vision library) is being used in this project Why OpenCV Real time computer vision. Provides powerful function to assist in object identification, motion tracking etc. Virtually assist in any image processing application. C-based program computer vision repository. Step1: Image Acquiring commission the OpenCV system to load frames of video into memory. IplImage* img = cvLoadImage( argv[1] ); //determines the file format to be loaded based on the file name cvNamedWindow(“C:/Users/julius/Desktop/FYP/redblue.bmp); // opens a window on the screen that can contain and display an image cvShowImage( “redblue.bmp”, img ); // show a named window that already exist Step1: Problem & Solution Problem: • Commissioning OpenCV to read images • Installation of OpenCV 2.0 Solution: • Uninstall OpenCV 2.0 • Install OpenCV 1.0 Step2: Image Thresholding convert the RGB frames to the HSV format. //Create gray image cvCvtColor(src,gray,CV_BGR2GRAY); RGB RGB HSV HSV RGB threshold the HSV to identify the region of interest. cvThreshold(gray,gray,150,255,CV_THRESH_BINARY); //Threshold to make the gray black RGB HSV Threshold RGB output to screen Step2: Problems & Solutions Problems: • Circle Detection with OpenCV 1.0 • OpenCV 1.0 takes hue value to be 0-255 Solutions: • Uninstall OpenCV 1.0 • Install OpenCV 2.0 • In OpenCV 2.0 hue value is 0-180 (works better for the red colour detection) • OpenCV 2.0 has a better algorithm for circle detection. C-make • C-make helped in compiling OpenCV from the source code • OpenCV 2.0 needs different files for different versions of studio. • One will need to complete visual studio 2008 for OpenCV 2.0 Example 1: Example2 Step3: Centre Point detection Finding the centre point of the red ball • Hough transform Step4: Implementation of the Kalman Filtering Kalman TrackingPredicting the path of the Red ball Centre point& predicted values Step4: Problems & Solutions Problems: • Kalman not tracking & predicting properly • OpenCV only has a 1-D example • Program Crashed at the line CvKalmanCorrect( Kalman, z_k ); // Correct Kalman filter state Solutions: • 2-D was needed for this project • I added "if (circles->total > 0) Step5: Display with Overlay Displaying with overlay Conclusions • Project was hampered by issues, most of which were overcome. • Ambitious goal of the project was fully fulfilled • Further work would lead to a complete solution