COLOR_COLORCVT_MAX = 139
};
-
+//! types of intersection between rectangles
+enum { INTERSECT_NONE = 0,
+ INTERSECT_PARTIAL = 1,
+ INTERSECT_FULL = 2
+ };
/*!
The Base Class for 1D or Row-wise Filters
CV_EXPORTS_W double pointPolygonTest( InputArray contour, Point2f pt, bool measureDist );
//! computes whether two rotated rectangles intersect and returns the vertices of the intersecting region
-CV_EXPORTS_W bool rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& rect2, OutputArray intersectingRegion );
+CV_EXPORTS_W int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& rect2, OutputArray intersectingRegion );
CV_EXPORTS Ptr<CLAHE> createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8));
namespace cv
{
-bool 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
rect1.points(pts1);
rect2.points(pts2);
+ int ret = INTERSECT_FULL;
+
// Line vector
// A line from p1 to p2 is: p1 + (p2-p1)*t, t=[0,1]
for( int i = 0; i < 4; i++ )
float t2 = (vx1*y21 - vy1*x21) / det;
// This takes care of parallel lines
- if( !std::isnormal(t1) || !std::isnormal(t2) )
+ if( !std::isfinite(t1) || !std::isfinite(t2) )
{
continue;
}
}
}
+ if( !intersection.empty() )
+ {
+ ret = INTERSECT_PARTIAL;
+ }
+
// Check for vertices from rect1 inside recct2
for( int i = 0; i < 4; i++ )
{
if( intersection.empty() )
{
- return false;
+ return INTERSECT_NONE ;
}
- //intersectingRegion.create(intersection.size(), 2, CV_32F);
-
- // Mat ret = intersectingRegion.getMat();
-
Mat(intersection).copyTo(intersectingRegion);
-// size_t step = !m.isContinuous() ? m.step[0] : sizeof(Point2f);
-
-// for( size_t i = 0; i < intersection.size(); i++ )
-// {
-// *(Point2f*)(m.data + i*step) = intersection[i];
-// }
-
- return true;
+ return ret;
}
}