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
cb16f733
Commit
cb16f733
authored
Jul 28, 2013
by
Nghia Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added C interface
parent
a40f217a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
imgproc_c.h
modules/imgproc/include/opencv2/imgproc/imgproc_c.h
+4
-0
intersection.cpp
modules/imgproc/src/intersection.cpp
+20
-1
No files found.
modules/imgproc/include/opencv2/imgproc/imgproc_c.h
View file @
cb16f733
...
...
@@ -615,6 +615,10 @@ CVAPI(CvSeq*) cvHoughCircles( CvArr* image, void* circle_storage,
CVAPI
(
void
)
cvFitLine
(
const
CvArr
*
points
,
int
dist_type
,
double
param
,
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
}
#endif
...
...
modules/imgproc/src/intersection.cpp
View file @
cb16f733
...
...
@@ -49,7 +49,7 @@ namespace cv
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
pts1
[
4
],
pts2
[
4
];
...
...
@@ -213,9 +213,28 @@ int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& r
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
);
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
;
}
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