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
457fa521
Commit
457fa521
authored
Jan 18, 2013
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convex hull converted to C++; other 2 functions in convhull.cpp are yet to be finished.
parent
e3941d09
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
71 deletions
+0
-71
contours.cpp
modules/imgproc/src/contours.cpp
+0
-71
convhull.cpp
modules/imgproc/src/convhull.cpp
+0
-0
No files found.
modules/imgproc/src/contours.cpp
View file @
457fa521
...
...
@@ -1813,77 +1813,6 @@ double cv::matchShapes( InputArray _contour1,
}
void
cv
::
convexHull
(
InputArray
_points
,
OutputArray
_hull
,
bool
clockwise
,
bool
returnPoints
)
{
Mat
points
=
_points
.
getMat
();
int
nelems
=
points
.
checkVector
(
2
),
depth
=
points
.
depth
();
CV_Assert
(
nelems
>=
0
&&
(
depth
==
CV_32F
||
depth
==
CV_32S
));
if
(
nelems
==
0
)
{
_hull
.
release
();
return
;
}
returnPoints
=
!
_hull
.
fixedType
()
?
returnPoints
:
_hull
.
type
()
!=
CV_32S
;
Mat
hull
(
nelems
,
1
,
returnPoints
?
CV_MAKETYPE
(
depth
,
2
)
:
CV_32S
);
CvMat
_cpoints
=
points
,
_chull
=
hull
;
cvConvexHull2
(
&
_cpoints
,
&
_chull
,
clockwise
?
CV_CLOCKWISE
:
CV_COUNTER_CLOCKWISE
,
returnPoints
);
_hull
.
create
(
_chull
.
rows
,
1
,
hull
.
type
(),
-
1
,
true
);
Mat
dhull
=
_hull
.
getMat
(),
shull
(
dhull
.
size
(),
dhull
.
type
(),
hull
.
data
);
shull
.
copyTo
(
dhull
);
}
void
cv
::
convexityDefects
(
InputArray
_points
,
InputArray
_hull
,
OutputArray
_defects
)
{
Mat
points
=
_points
.
getMat
();
int
ptnum
=
points
.
checkVector
(
2
,
CV_32S
);
CV_Assert
(
ptnum
>
3
);
Mat
hull
=
_hull
.
getMat
();
CV_Assert
(
hull
.
checkVector
(
1
,
CV_32S
)
>
2
);
Ptr
<
CvMemStorage
>
storage
=
cvCreateMemStorage
();
CvMat
c_points
=
points
,
c_hull
=
hull
;
CvSeq
*
seq
=
cvConvexityDefects
(
&
c_points
,
&
c_hull
,
storage
);
int
i
,
n
=
seq
->
total
;
if
(
n
==
0
)
{
_defects
.
release
();
return
;
}
_defects
.
create
(
n
,
1
,
CV_32SC4
);
Mat
defects
=
_defects
.
getMat
();
SeqIterator
<
CvConvexityDefect
>
it
=
Seq
<
CvConvexityDefect
>
(
seq
).
begin
();
CvPoint
*
ptorg
=
(
CvPoint
*
)
points
.
data
;
for
(
i
=
0
;
i
<
n
;
i
++
,
++
it
)
{
CvConvexityDefect
&
d
=
*
it
;
int
idx0
=
(
int
)(
d
.
start
-
ptorg
);
int
idx1
=
(
int
)(
d
.
end
-
ptorg
);
int
idx2
=
(
int
)(
d
.
depth_point
-
ptorg
);
CV_Assert
(
0
<=
idx0
&&
idx0
<
ptnum
);
CV_Assert
(
0
<=
idx1
&&
idx1
<
ptnum
);
CV_Assert
(
0
<=
idx2
&&
idx2
<
ptnum
);
CV_Assert
(
d
.
depth
>=
0
);
int
idepth
=
cvRound
(
d
.
depth
*
256
);
defects
.
at
<
Vec4i
>
(
i
)
=
Vec4i
(
idx0
,
idx1
,
idx2
,
idepth
);
}
}
bool
cv
::
isContourConvex
(
InputArray
_contour
)
{
Mat
contour
=
_contour
.
getMat
();
CV_Assert
(
contour
.
checkVector
(
2
)
>=
0
&&
(
contour
.
depth
()
==
CV_32F
||
contour
.
depth
()
==
CV_32S
));
CvMat
c
=
Mat
(
contour
);
return
cvCheckContourConvexity
(
&
c
)
>
0
;
}
cv
::
RotatedRect
cv
::
fitEllipse
(
InputArray
_points
)
{
...
...
modules/imgproc/src/convhull.cpp
View file @
457fa521
This diff is collapsed.
Click to expand it.
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