This is the code. The output its not what I wanted:
int main(int argc,char ** argv)
{
VideoCapture cap(0);
if (!cap.isOpened()) {
cerr << "ERROR: Unable to open the camera" << endl;
return 0;
}
Mat frame1, frame2, frame3, frame4, frame5;
Mat x1, x2, x3, x4, x5;
cap >> frame1;
usleep(3333);
cap >> frame2;
usleep(3333);
cap >> frame3;
usleep(3333);
cap >> frame4;
usleep(3333);
cap >> frame5;
frame1.convertTo(x1, CV_32S);
frame2.convertTo(x2, CV_32S);
frame3.convertTo(x3, CV_32S);
frame4.convertTo(x4, CV_32S);
frame5.convertTo(x5, CV_32S);
Mat y;
y=0.33*x1 -0.67*x1+0.33*x2+ 0.14*x1-0.67*x2+0.33*x3 + 0.24*x1+0.14*x2-0.67*x3+0.33*x4 + 0.07*x1+0.24*x2+0.14*x3-0.67*x4+0.33*x5 -0.05*x1+0.07*x2+0.24*x3+0.14*x4-0.67*x5 - 0.05*x2+0.07*x3+0.24*x4+0.14*x5 -0.05*x3+0.07*x4+0.24*x5 - 0.05*x4+0.07*x5 - 0.05*x5;
Mat output;
y.convertTo(output, CV_8U);
vector<int> compression_params;
compression_params.push_back(IMWRITE_PNG_COMPRESSION);
compression_params.push_back(1); //este valor es la compresión cuanto más alto más comprimido
imwrite("outputFilter.png", output, compression_params);
imwrite("outputWitoutFilter.png", frame1, compression_params);
And this is the image with the filter
And this is the image without the filter
But as It cant get and proceed the frames in continuos way and there is more than 5 discrete value in the impulse response the filter doesnt work. I will have to use the more simple filter
x1- x2
what are you doing there, exactly ? do you try to filter a single image spatially, or is there an image sequence, and you try to filter over time ?
"convolution pixel by pixel" -- that's always a terrible idea. please show your code.
I need to filter the image over the time with a passband frecuency of 50Hz, to get the just the movement
High pass 50Hz = frame rate >150Hz?
@julian403 : https://en.wikipedia.org/wiki/Nyquist...
(doubtful, if you can get enough fps on your raspi for this)
I will share the code and the image output tomorrow. Due to the server doesnt allow me to answer (I have to wait to 2 days from the last post)