#include <iostream>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main() {
Mat frame = imread("../assets/water_coins.jpg", IMREAD_COLOR);
imshow("frame", frame);
Mat grayImg;
cvtColor(frame, grayImg, COLOR_BGR2GRAY);
imshow("grayimg", grayImg);
vector<Vec3f> circles;
// HoughCircles(grayImg,circles,HOUGH_GRADIENT,1,150,100,30,50,90);
HoughCircles(grayImg, circles, HOUGH_GRADIENT, 1, 10, 100, 30, 5, 30);
for (int i = 0; i < circles.size(); ++i) {
Vec3f c = circles.at(i);
Point center(c[0], c[1]);
float radius = c[2];
cout << radius << endl;
circle(frame, center, radius, Scalar(0, 255, 0), 2, LINE_AA);
}
imshow("rest", frame);
waitKey(0);
destroyAllWindows();
return 0;
}