Added C interface
This commit is contained in:
parent
a40f217a38
commit
cb16f733b9
@ -615,6 +615,10 @@ CVAPI(CvSeq*) cvHoughCircles( CvArr* image, void* circle_storage,
|
|||||||
CVAPI(void) cvFitLine( const CvArr* points, int dist_type, double param,
|
CVAPI(void) cvFitLine( const CvArr* points, int dist_type, double param,
|
||||||
double reps, double aeps, float* line );
|
double reps, double aeps, float* line );
|
||||||
|
|
||||||
|
/* Finds the intersecting region made by two rotated rectangles.
|
||||||
|
If there is an intersection the vertices of the region are returned. */
|
||||||
|
CVAPI(int) cvRotatedRectangleIntersection( const CvBox2D* rect1, const CvBox2D* rect2, CvPoint2D32f intersectingRegion[8], int* pointCount );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -49,7 +49,7 @@ namespace cv
|
|||||||
|
|
||||||
int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& rect2, OutputArray intersectingRegion )
|
int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& rect2, OutputArray intersectingRegion )
|
||||||
{
|
{
|
||||||
const float samePointEps = 0.00001; // used to test if two points are the same, due to numerical error
|
const float samePointEps = 0.00001; // used to test if two points are the same
|
||||||
|
|
||||||
Point2f vec1[4], vec2[4];
|
Point2f vec1[4], vec2[4];
|
||||||
Point2f pts1[4], pts2[4];
|
Point2f pts1[4], pts2[4];
|
||||||
@ -213,9 +213,28 @@ int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& r
|
|||||||
return INTERSECT_NONE ;
|
return INTERSECT_NONE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If this check fails then it means we're getting dupes, increase samePointEps
|
||||||
|
CV_Assert( intersection.size() <= 8 );
|
||||||
|
|
||||||
Mat(intersection).copyTo(intersectingRegion);
|
Mat(intersection).copyTo(intersectingRegion);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // end namespace
|
||||||
|
|
||||||
|
int cvRotatedRectangleIntersection( const CvBox2D* rect1, const CvBox2D* rect2, CvPoint2D32f intersectingRegion[8], int* pointCount )
|
||||||
|
{
|
||||||
|
std::vector <cv::Point2f> pts;
|
||||||
|
|
||||||
|
int ret = cv::rotatedRectangleIntersection( *rect1, *rect2, pts );
|
||||||
|
|
||||||
|
for( size_t i=0; i < pts.size(); i++ )
|
||||||
|
{
|
||||||
|
intersectingRegion[i] = pts[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
*pointCount = (int)pts.size();
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user