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
7a3b5b30
Commit
7a3b5b30
authored
Dec 13, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7790 from sovrasov:convexity_defects_enable_small_hulls
parents
fbf2383d
12383a12
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
convhull.cpp
modules/imgproc/src/convhull.cpp
+6
-1
No files found.
modules/imgproc/src/convhull.cpp
View file @
7a3b5b30
...
@@ -280,11 +280,16 @@ void convexityDefects( InputArray _points, InputArray _hull, OutputArray _defect
...
@@ -280,11 +280,16 @@ void convexityDefects( InputArray _points, InputArray _hull, OutputArray _defect
Mat
hull
=
_hull
.
getMat
();
Mat
hull
=
_hull
.
getMat
();
int
hpoints
=
hull
.
checkVector
(
1
,
CV_32S
);
int
hpoints
=
hull
.
checkVector
(
1
,
CV_32S
);
CV_Assert
(
hpoints
>
2
);
CV_Assert
(
hpoints
>
0
);
const
Point
*
ptr
=
points
.
ptr
<
Point
>
();
const
Point
*
ptr
=
points
.
ptr
<
Point
>
();
const
int
*
hptr
=
hull
.
ptr
<
int
>
();
const
int
*
hptr
=
hull
.
ptr
<
int
>
();
std
::
vector
<
Vec4i
>
defects
;
std
::
vector
<
Vec4i
>
defects
;
if
(
hpoints
<
3
)
//if hull consists of one or two points, contour is always convex
{
_defects
.
release
();
return
;
}
// 1. recognize co-orientation of the contour and its hull
// 1. recognize co-orientation of the contour and its hull
bool
rev_orientation
=
((
hptr
[
1
]
>
hptr
[
0
])
+
(
hptr
[
2
]
>
hptr
[
1
])
+
(
hptr
[
0
]
>
hptr
[
2
]))
!=
2
;
bool
rev_orientation
=
((
hptr
[
1
]
>
hptr
[
0
])
+
(
hptr
[
2
]
>
hptr
[
1
])
+
(
hptr
[
0
]
>
hptr
[
2
]))
!=
2
;
...
...
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