Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CvInvoke.cvContourArea in c#, Emgu

Hi, I am using C# to find the area within a contour and need help translating c/c++ code as found in the following example: Unfortunately, C#, Emgu does not support vectors.

vector<point> contour; contour.push_back(Point2f(0, 0)); contour.push_back(Point2f(10, 0)); contour.push_back(Point2f(10, 10)); contour.push_back(Point2f(5, 4));

double area0 = contourArea(contour); vector<point> approx; approxPolyDP(contour, approx, 5, true); double area1 = contourArea(approx);

cout << "area0 =" << area0 << endl << "area1 =" << area1 << endl << "approx poly vertices" << approx.size() << endl;

Thx, Fred.

CvInvoke.cvContourArea in c#, Emgu

Hi, I am using C# to find the area within a contour and need help translating c/c++ code as found in the following example: Unfortunately, C#, Emgu does not support vectors.

vector<point>

vector<Point> contour;
contour.push_back(Point2f(0, 0));
contour.push_back(Point2f(10, 0));
contour.push_back(Point2f(10, 10));
contour.push_back(Point2f(5, 4));

4));

double area0 = contourArea(contour); vector<point> vector<Point> approx; approxPolyDP(contour, approx, 5, true); double area1 = contourArea(approx);

contourArea(approx);

cout << "area0 =" << area0 << endl << "area1 =" << area1 << endl << "approx poly vertices" << approx.size() << endl;

endl;

Thx, Fred.