mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -503,7 +503,7 @@ namespace cv{
|
||||
// +-+-+-+
|
||||
// |p|q|r|
|
||||
// +-+-+-+
|
||||
// |x|
|
||||
// |x|
|
||||
// +-+
|
||||
const int w = imgLabels.cols, h = imgLabels.rows;
|
||||
|
||||
@@ -548,7 +548,7 @@ namespace cv{
|
||||
// +-+-+-+
|
||||
// |-|q|-|
|
||||
// +-+-+-+
|
||||
// |x|
|
||||
// |x|
|
||||
// +-+
|
||||
const int w = imgLabels.cols, h = imgLabels.rows;
|
||||
|
||||
@@ -2473,9 +2473,9 @@ namespace cv{
|
||||
// |P -|Q -|R -|
|
||||
// |- -|- -|- -|
|
||||
// +---+---+---+
|
||||
// |X -|
|
||||
// |- -|
|
||||
// +---+
|
||||
// |X -|
|
||||
// |- -|
|
||||
// +---+
|
||||
const int w = imgLabels.cols, h = imgLabels.rows;
|
||||
|
||||
for (int r = chunksSizeAndLabels[0]; r < h; r = chunksSizeAndLabels[r]){
|
||||
|
||||
@@ -219,13 +219,15 @@ int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& r
|
||||
}
|
||||
}
|
||||
|
||||
// Get rid of dupes
|
||||
// Get rid of dupes and order points.
|
||||
for( int i = 0; i < (int)intersection.size()-1; i++ )
|
||||
{
|
||||
float dx1 = intersection[i + 1].x - intersection[i].x;
|
||||
float dy1 = intersection[i + 1].y - intersection[i].y;
|
||||
for( size_t j = i+1; j < intersection.size(); j++ )
|
||||
{
|
||||
float dx = intersection[i].x - intersection[j].x;
|
||||
float dy = intersection[i].y - intersection[j].y;
|
||||
float dx = intersection[j].x - intersection[i].x;
|
||||
float dy = intersection[j].y - intersection[i].y;
|
||||
double d2 = dx*dx + dy*dy; // can be a really small number, need double here
|
||||
|
||||
if( d2 < samePointEps*samePointEps )
|
||||
@@ -235,6 +237,12 @@ int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& r
|
||||
intersection.pop_back();
|
||||
j--; // restart check
|
||||
}
|
||||
else if (dx1 * dy - dy1 * dx < 0)
|
||||
{
|
||||
std::swap(intersection[i + 1], intersection[j]);
|
||||
dx1 = dx;
|
||||
dy1 = dy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user