#include "Stdafx.h"
#include "FeatureDetection.h"

namespace Domination {
	namespace Unmanaged {
		namespace OpenCV 
		{
			void FeatureDetection::HoughCircles(Mat^ image, [Out] cli::array<float, 2>^ %circles, double dp, double minDist)
			{
				HoughCircles(image, circles, dp, minDist, 100, 100, 0, 0);
			}
			void FeatureDetection::HoughCircles(Mat^ image, [Out] cli::array<float, 2>^ %circles, double dp, double minDist, double param1, double param2, int minRadius, int maxRadius)
			{
				cv::Mat limage = *image->ref;
				cv::vector<cv::Vec3f> lcircles;
				cv::HoughCircles(limage, lcircles, CV_HOUGH_GRADIENT, dp, minDist, param1, param2, minRadius, maxRadius);
				int size = (int)lcircles.size();
				circles = gcnew cli::array<float, 2>(size, 3);
				for(int i = 0; i < size; i++)
				{
					circles[i, 0] = lcircles[i][0];
					circles[i, 1] = lcircles[i][1];
					circles[i, 2] = lcircles[i][2];
				}
			}
		}
	}
}