1 | initial version |
You can use butterwoth filter : Something like this works :
vector<double> b={0.29213704255461020,0.58427408510922041,0.29213704255461020};
vector<double> a={0,0.36952737735124142,-0.19581571265583309};
Mat frameUSB;
Mat frame;
v >> frameUSB;
frameUSB.convertTo(frame, CV_32F);
for (int i = 0; i <= 20; i++)
{
p.x.push_back(frame.clone());
p.y.push_back(frame.clone());
}
while (code != 27)
{
v >> frameUSB;
frameUSB.convertTo(frame, CV_32F);
p.x[0] = frame.clone();
Mat r;
r = b[0] * p.x[0];
for (int i = 1; i < b.size(); i++)
{
r += b[i] * p.x[i];
}
for (int i = 1; i < a.size(); i++)
{
r += a[i] * p.y[i];
}
for (int i = b.size() - 1; i > 0; i--)
{
p.x[i] = p.x[i - 1];
}
for (int i = a.size() - 1; i > 1; i--)
{
p.y[i] = p.y[i - 1];
}
p.y[1] = r;
imshow(p.nomfenetre, r/256);
code = waitKey(1);
}
Full code is here