Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
a40f217a
Commit
a40f217a
authored
Jul 27, 2013
by
Nghia Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed from isnormal to isfinite, the prev ignored zero
parent
a0576d7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+6
-2
intersection.cpp
modules/imgproc/src/intersection.cpp
+11
-15
No files found.
modules/imgproc/include/opencv2/imgproc.hpp
View file @
a40f217a
...
...
@@ -462,7 +462,11 @@ enum { COLOR_BGR2BGRA = 0,
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
...
...
@@ -1415,7 +1419,7 @@ CV_EXPORTS_W void fitLine( InputArray points, OutputArray line, int distType,
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
));
...
...
modules/imgproc/src/intersection.cpp
View file @
a40f217a
...
...
@@ -47,7 +47,7 @@
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
...
...
@@ -59,6 +59,8 @@ bool rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect&
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
++
)
...
...
@@ -91,7 +93,7 @@ bool rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect&
float
t2
=
(
vx1
*
y21
-
vy1
*
x21
)
/
det
;
// This takes care of parallel lines
if
(
!
std
::
is
normal
(
t1
)
||
!
std
::
isnormal
(
t2
)
)
if
(
!
std
::
is
finite
(
t1
)
||
!
std
::
isfinite
(
t2
)
)
{
continue
;
}
...
...
@@ -106,6 +108,11 @@ bool rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect&
}
}
if
(
!
intersection
.
empty
()
)
{
ret
=
INTERSECT_PARTIAL
;
}
// Check for vertices from rect1 inside recct2
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
...
...
@@ -203,23 +210,12 @@ bool rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect&
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
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment