Lab3BlobComputationandTracking
Introduction to Blob Computation and Tracking
Up to now we have already compute a color region of interest. We are ready to start using a sequence of images with the main objective of tracking some moving object. At each frame we have to determine where the object is moving or -in the case of a mounted camera - which is the motion we have done.
Mission
In this Lab we like you to write an efficient program to track a region in a sequence of images. Make use of the a convex hull to define the region envelope and by means of conecting lines create an envelope of such a region. Your algorithm needs to deal with some deformations of such an initial Blob.
- What happens if such a blob becomes partially occluded ?
Starter Code
The Convex Hull
convex_hull (int *rows, int *columns, int n)
{
int i,j,k;
double angle_2pt(), prev, best, x;
k = 0;
for (i=1; i<n; i++)
if (rows[i] > rows[k]) k = i;
else if ((rows[i] == rows[k]) && (columns[i]<columns[k]))
k = i; /* Same row, choose leftmost */
hswap (rows, columns, k, 0);
rows[n] = rows[0]; columns[n] = columns[0];
prev = -1.0; j = 0;
do {
best = 360.0; k = -1;
for (i=j+1; i<=n; i++) {
x = angle_2pt (rows[j],columns[j], rows[i],columns[i]);
if ( (x>prev) && (x<best) ) {
k = i; best = x;
}
else if ( (x>prev) && (x == best) ) {
if ( (abs(rows[i]-rows[j])+abs(columns[i]-columns[j])) >
(abs(rows[k]-rows[j])+abs(columns[k]-columns[j]))) {
k = i; best = x;
}
}
}
if (k > 0) {
prev = best;
j = j + 1;
hswap (rows, columns, k, j);
}
}
while (k>0 && (j<n)); rows[j+1] = rows[0]; columns[j+1] =columns[0]; return j+1;
}
hswap (int *rows, int *columns,int i,int j) {
int t; t = rows[i]; rows[i] = rows[j]; rows[j] = t; t = columns[i]; columns[i] = columns[j]; columns[j] = t;
}
Draw a Line
The Kalman Filter
Here you will find some codes for the implementation of the Kalman Filter
Speed Estimation from Single Loop Data