I have a function like so:
#include <stdio.h>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <opencv/cxcore.h>
#include <math.h>
#define PI 3.14159265
#define GRADIENT_THRESHOLD 200.0
#define ANGLE_RANGE 20
using namespace cv;
using namespace std;
class Circle {
public:
int x;
int y;
int r;
Circle(int x, int y, int r) {
this->x = x;
this->y = y;
this->r = r;
}
double area() {
return PI * pow(r, 2);
}
};
Vector <Circle> collect_circles_from_houghSpace(Mat &houghSpaceCircle, double voting_threshold) {
int height = houghSpaceCircle.size[0];
int width = houghSpaceCircle.size[1];
int radius = houghSpaceCircle.size[2];
std::vector <Circle> circles;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
for (int r = 0; r < radius; r++) {
if (houghSpaceCircle.at<cv::Vec3i>(y, x)[r] > voting_threshold) {
circles.push_back(Circle(x, y, r));
}
}
}
}
return circles;
}
When I compile it, I get an error saying: In file included from sobel.cpp:2:
In file included from /usr/local/Cellar/opencv@2/2.4.13.7_5/include/opencv/cv.h:64:
In file included from /usr/local/Cellar/opencv@2/2.4.13.7_5/include/opencv2/core/core.hpp:4932:
/usr/local/Cellar/opencv@2/2.4.13.7_5/include/opencv2/core/operations.hpp:2415:23: error: no matching constructor for initialization of 'Circle []'
newData = new _Tp[newCapacity];
^
/usr/local/Cellar/opencv@2/2.4.13.7_5/include/opencv2/core/operations.hpp:2400:13: note: in instantiation of member function 'cv::Vector<Circle>::reserve' requested here
reserve(_size);
^
/usr/local/Cellar/opencv@2/2.4.13.7_5/include/opencv2/core/operations.hpp:2305:7: note: in instantiation of member function 'cv::Vector<Circle>::set' requested here
{ set(!vec.empty() ? (_Tp*)&vec[0] : 0, vec.size(), _copyData); }
^
sobel.cpp:166:12: note: in instantiation of member function 'cv::Vector<Circle>::Vector' requested here
return circles;
^
sobel.cpp:15:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided
class Circle {
^
sobel.cpp:21:5: note: candidate constructor not viable: requires 3 arguments, but 0 were provided
Circle(int x, int y, int r) {
^
1 error generated.
Could someone explain the error to me and how to fix it? As I see it, I have created a constructor that takes in 3 arguments. I'm not sure I understand why the error is saying I have provided 0 args.