Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Could OpenCV return a matrix for a function?

Is a really simple question, but I need the answer.

Image this code

#include "opencv2/opencv.hpp"
#include <iostream>
#include <stdio.h>
#include <iomanip>  // for controlling float print precision
#include <sstream>  // string to number conversion

using namespace cv;
using namespace std;

int main()
{
//I load two diferents frames for a video
.....
Mat error ,m1,m2;
Mat m1 = frame1;
Mat m2 = frame2;
error = Mat matrix_error(m1,m2);
imshow("",error);
waitKey(0);
}

In functions.h

#ifndef FUNCTIONS_H_
#define FUNCTIONS_H_
#include "opencv2/opencv.hpp"
#include <iostream>
#include <stdio.h>
#include <iomanip>  // for controlling float print precision
#include <sstream>
using namespace cv;
using namespace std;
Mat matrix_error (const Mat& F1, const Mat& F2);
#endif /* FUNCTIONS_H_ */

functions.cpp

Mat matrix_error (const Mat& F1, const Mat& F2)
{
Mat s1;
absdiff(F1, F2, s1);
return s1;
}

The error ls Description "‘matrix_error’ was not declared in this scope". I know that im doing a really stupid mistake, but IDK where. If someone could help me I will appreciate.

Thanks.