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;
}