How do I smooth feature trajectories of lkdemo
I've to smooth feature trajectories of Lucas Kanade and for that purpose, its possible to apply low pass filter to x and y coordinates of the tracked feature points in lkdemo. I got thee understanding of applying low pass filter to image in opencv but I can't get it in lkdemo. What I've tried is completely wrong in my opinion. Please guide me so that I can solve m issue. My trial is given as:
void conv2(vector<vector<Point2f>> src, int kernel_size)
{
vector<vector<Point2f>> dst;
Mat kernel;
kernel = Mat::ones(kernel_size, kernel_size, CV_32F) / (float)(kernel_size*kernel_size);
/// Apply filter
filter2D(src, dst, -1, kernel, Point(-1, -1), 0, BORDER_DEFAULT);
//namedWindow("filter2D Demo", CV_WINDOW_AUTOSIZE); imshow("filter2D Demo", dst);
}
and then at the end of main function of lkdemo,
conv2(pointsFrame, 3);
waitKey(0);
return 0;
}
Do you want to filter off line or on line? off line you can use convolution an on line you can use IIR. It's not 2D signal but 1D signal with complex number
Sorry! that is feature locations...I want to smooth the feature locations so that I can compare (later) the content' position like where it is supposed to be (smooth locations) and where it is (lkdemo output)...
Feature location mean P(x,y) (?). In that case you can use convolution but you can use kalman filter like in this post. It will depend on your application...
@LBerger can you please help me here link text