I want to creat a C++ class which is incorporated only with static functions that I can use no matter what. I have create a .h
file with the declarations and a .cpp
file with the definitions. However, when I am using it inside my code I am receiving some weird error messages which I do not know how to solve.
Here is the content of my Utils.h
file:
#include <iostream>
#include <fstream>
#include <sstream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
#include <vector>
#include <opencv/cv.h>
#include <opencv/cxcore.h>
class Utils
{
public:
static void drawPoint(Mat &img, int R, int G, int B, int x, int y);
};
Here is the content of my Utils.cpp
file:
#include "Utils.h"
void Utils::drawPoint(Mat &img, int R, int G, int B, int x, int y)
{
img.at<Vec3b>(x, y)[0] = R;
img.at<Vec3b>(x, y)[1] = G;
img.at<Vec3b>(x, y)[2] = B;
}
And this is how I want to use it in my main
function :
#include <iostream>
#include <fstream>
#include <sstream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
#include <vector>
#include <opencv/cv.h>
#include <opencv/cxcore.h>
#include "CThinPlateSpline.h"
#include "Utils.h"
int main()
{
Mat img = imread("D:\\image.png");
if (img.empty())
{
cout << "Cannot load image!" << endl;
system("PAUSE");
return -1;
}
Utils.drawPoint(img, 0, 255, 0, 20, 20);
imshow("Original Image", img);
waitKey(0);
return 0;
}
And here are the errors that I am receiving.
Can someone point me out what I am doing wrong? What am I missing?