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
dda3b534
Commit
dda3b534
authored
Nov 13, 2013
by
Adrien BAK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix indent
parent
1c025be0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
HoughCircle_Demo.cpp
samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp
+19
-19
No files found.
samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp
View file @
dda3b534
...
...
@@ -25,42 +25,42 @@ namespace
void
HoughDetection
(
const
Mat
&
src_gray
,
const
Mat
&
src_display
,
int
cannyThreshold
,
int
accumulatorThreshold
)
{
// will hold the results of the detection
std
::
vector
<
Vec3f
>
circles
;
// runs the actual detection
HoughCircles
(
src_gray
,
circles
,
HOUGH_GRADIENT
,
1
,
src_gray
.
rows
/
8
,
cannyThreshold
,
accumulatorThreshold
,
0
,
0
);
// clone the colour, input image for displaying purposes
Mat
display
=
src_display
.
clone
();
for
(
size_t
i
=
0
;
i
<
circles
.
size
();
i
++
)
{
// will hold the results of the detection
std
::
vector
<
Vec3f
>
circles
;
// runs the actual detection
HoughCircles
(
src_gray
,
circles
,
HOUGH_GRADIENT
,
1
,
src_gray
.
rows
/
8
,
cannyThreshold
,
accumulatorThreshold
,
0
,
0
);
// clone the colour, input image for displaying purposes
Mat
display
=
src_display
.
clone
();
for
(
size_t
i
=
0
;
i
<
circles
.
size
();
i
++
)
{
Point
center
(
cvRound
(
circles
[
i
][
0
]),
cvRound
(
circles
[
i
][
1
]));
int
radius
=
cvRound
(
circles
[
i
][
2
]);
// circle center
circle
(
display
,
center
,
3
,
Scalar
(
0
,
255
,
0
),
-
1
,
8
,
0
);
// circle outline
circle
(
display
,
center
,
radius
,
Scalar
(
0
,
0
,
255
),
3
,
8
,
0
);
}
}
// shows the results
imshow
(
windowName
,
display
);
// shows the results
imshow
(
windowName
,
display
);
}
}
int
main
(
int
,
char
**
argv
)
{
Mat
src
,
src_gray
;
Mat
src
,
src_gray
;
// Read the image
src
=
imread
(
argv
[
1
],
1
);
if
(
!
src
.
data
)
{
std
::
cerr
<<
"Invalid input image
\n
"
;
std
::
cout
<<
"Usage : tutorial_HoughCircle_Demo <path_to_input_image>
\n
"
;
return
-
1
;
}
if
(
!
src
.
data
)
{
std
::
cerr
<<
"Invalid input image
\n
"
;
std
::
cout
<<
"Usage : tutorial_HoughCircle_Demo <path_to_input_image>
\n
"
;
return
-
1
;
}
// Convert it to gray
cvtColor
(
src
,
src_gray
,
COLOR_BGR2GRAY
);
...
...
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