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
c11a7184
Commit
c11a7184
authored
Jul 30, 2011
by
Kirill Kornyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minarea.cpp sample reformatted
parent
c55a37ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
minarea.cpp
samples/cpp/minarea.cpp
+13
-10
No files found.
samples/cpp/minarea.cpp
View file @
c11a7184
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <iostream>
using
namespace
cv
;
using
namespace
cv
;
using
namespace
std
;
using
namespace
std
;
void
help
()
void
help
()
{
{
cout
<<
"This program demonstrates finding the minimum enclosing box or circle of a set
\n
"
cout
<<
"This program demonstrates finding the minimum enclosing box or circle of a set
\n
"
"of points using functions: minAreaRect() minEnclosingCircle().
\n
"
"of points using functions: minAreaRect() minEnclosingCircle().
\n
"
"Random points are generated and then enclosed.
\n
"
"Random points are generated and then enclosed.
\n
"
"Call:
\n
"
"Call:
\n
"
"./minarea
\n
"
"./minarea
\n
"
"Using OpenCV version %s
\n
"
<<
CV_VERSION
<<
"
\n
"
<<
endl
;
"Using OpenCV version %s
\n
"
<<
CV_VERSION
<<
"
\n
"
<<
endl
;
}
}
int
main
(
int
/*argc*/
,
char
**
/*argv*/
)
int
main
(
int
/*argc*/
,
char
**
/*argv*/
)
{
{
Mat
img
(
500
,
500
,
CV_8UC3
);
RNG
&
rng
=
theRNG
();
help
();
help
();
Mat
img
(
500
,
500
,
CV_8UC3
);
RNG
&
rng
=
theRNG
();
for
(;;)
for
(;;)
{
{
int
i
,
count
=
rng
.
uniform
(
1
,
101
);
int
i
,
count
=
rng
.
uniform
(
1
,
101
);
...
@@ -35,6 +37,7 @@ int main( int /*argc*/, char** /*argv*/ )
...
@@ -35,6 +37,7 @@ int main( int /*argc*/, char** /*argv*/ )
}
}
RotatedRect
box
=
minAreaRect
(
Mat
(
points
));
RotatedRect
box
=
minAreaRect
(
Mat
(
points
));
Point2f
center
,
vtx
[
4
];
Point2f
center
,
vtx
[
4
];
float
radius
=
0
;
float
radius
=
0
;
minEnclosingCircle
(
Mat
(
points
),
center
,
radius
);
minEnclosingCircle
(
Mat
(
points
),
center
,
radius
);
...
@@ -55,6 +58,6 @@ int main( int /*argc*/, char** /*argv*/ )
...
@@ -55,6 +58,6 @@ int main( int /*argc*/, char** /*argv*/ )
if
(
key
==
27
||
key
==
'q'
||
key
==
'Q'
)
// 'ESC'
if
(
key
==
27
||
key
==
'q'
||
key
==
'Q'
)
// 'ESC'
break
;
break
;
}
}
return
0
;
return
0
;
}
}
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