#include #include#include#include
using namespacestd;using namespacecv;void find_centrepoint(Mat image, Point ¢repoint, RotatedRect &max_Rect)
{
Mat element= getStructuringElement(MORPH_ELLIPSE, Size(9, 9));
morphologyEx(image, image, MORPH_OPEN, element);
morphologyEx(image, image, MORPH_CLOSE, element);
Mat cannyImage;
Canny(image, cannyImage,125, 250, 3);
vector>contours;
vectorhierarchy;
findContours(cannyImage, contours, hierarchy, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE);//vector > contours_poly(contours.size());
vectorboundRect(contours.size());for (size_t i = 0; i < contours.size(); i++)
{//approxPolyDP(Mat(contours[i]), contours_poly[i], 3, true);
boundRect[i] =minAreaRect(Mat(contours[i]));
}
vectormax_contour;int area = 0;intidx;for (size_t i = 0; i < co