From 130b4d8e26f5a8a189c4782110e6cb172479ebb4 Mon Sep 17 00:00:00 2001 From: Ovidiu Parvu Date: Sun, 15 Sep 2013 23:25:36 +0100 Subject: [PATCH] Changed the return type of cvMinEnclosingTriangle to CVAPI(void). Added the implementation of the function to the min_enclosing_triangle.cpp source file. --- .../include/opencv2/imgproc/imgproc_c.h | 2 +- .../imgproc/src/min_enclosing_triangle.cpp | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/modules/imgproc/include/opencv2/imgproc/imgproc_c.h b/modules/imgproc/include/opencv2/imgproc/imgproc_c.h index f691e3eeb9..40e8b4e447 100644 --- a/modules/imgproc/include/opencv2/imgproc/imgproc_c.h +++ b/modules/imgproc/include/opencv2/imgproc/imgproc_c.h @@ -378,7 +378,7 @@ CVAPI(CvBox2D) cvMinAreaRect2( const CvArr* points, CvMemStorage* storage CV_DEFAULT(NULL)); /* Finds minimum enclosing triangle for a set of points */ -CVAPI(int) cvMinEnclosingTriangle( const CvArr* points, +CVAPI(void) cvMinEnclosingTriangle( const CvArr* points, CvArr* triangle, double* area ); /* Finds minimum enclosing circle for a set of points */ diff --git a/modules/imgproc/src/min_enclosing_triangle.cpp b/modules/imgproc/src/min_enclosing_triangle.cpp index ddf175c428..3bddf5772a 100644 --- a/modules/imgproc/src/min_enclosing_triangle.cpp +++ b/modules/imgproc/src/min_enclosing_triangle.cpp @@ -1297,4 +1297,25 @@ static bool lessOrEqual(double number1, double number2) { } +////////////////////////////////////////////// C API /////////////////////////////////////////// + + +//! Find the minimum enclosing triangle and its area for the given set of points +/*! +* @param points Set of points +* @param triangle Minimum area triangle enclosing the given set of points +* @param area Area of the minimum area enclosing triangle +*/ +CV_IMPL void +cvMinEnclosingTriangle( const CvArr* _points, CvArr* _triangle, double* _area ) { + cv::Mat points = cv::cvarrToMat(_points); + cv::Mat triangle = cv::cvarrToMat(_triangle); + double area = 0; + + cv::minEnclosingTriangle(points, triangle, area); + + if (_area) + *_area = area; +} + /* End of file. */