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
90cce3a2
Commit
90cce3a2
authored
Dec 03, 2010
by
Gary Bradski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed minor bug, doc'd
parent
6eb0fc6e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
distrans.cpp
samples/cpp/distrans.cpp
+21
-13
No files found.
samples/cpp/distrans.cpp
View file @
90cce3a2
...
...
@@ -5,6 +5,24 @@
using
namespace
cv
;
void
help
()
{
printf
(
"
\n
Demonstrate the use of the distance transform function between edge images.
\n
"
"Usage:
\n
"
"./distrans [image_name -- default image is stuff.jpg]
\n
"
);
printf
(
"
\n
Hot keys:
\n
"
"
\t
ESC - quit the program
\n
"
"
\t
C - use C/Inf metric
\n
"
"
\t
L1 - use L1 metric
\n
"
"
\t
L2 - use L2 metric
\n
"
"
\t
3 - use 3x3 mask
\n
"
"
\t
5 - use 5x5 mask
\n
"
"
\t
0 - use precise distance transform
\n
"
"
\t
v - switch Voronoi diagram mode on/off
\n
"
"
\t
SPACE - loop through all the modes
\n
"
);
}
int
maskSize0
=
CV_DIST_MASK_5
;
bool
buildVoronoi
=
false
;
int
edgeThresh
=
100
;
...
...
@@ -89,21 +107,11 @@ int main( int argc, char** argv )
gray
=
imread
(
filename
,
0
);
if
(
gray
.
empty
())
{
printf
(
"Usage: distrans <image_name>
\n
"
);
return
0
;
help
(
);
return
-
1
;
}
printf
(
"Hot keys:
\n
"
"
\t
ESC - quit the program
\n
"
"
\t
C - use C/Inf metric
\n
"
"
\t
L1 - use L1 metric
\n
"
"
\t
L2 - use L2 metric
\n
"
"
\t
3 - use 3x3 mask
\n
"
"
\t
5 - use 5x5 mask
\n
"
"
\t
0 - use precise distance transform
\n
"
"
\t
v - switch Voronoi diagram mode on/off
\n
"
"
\t
SPACE - loop through all the modes
\n
"
);
help
();
namedWindow
(
"Distance Map"
,
1
);
createTrackbar
(
"Brightness Threshold"
,
"Distance Map"
,
&
edgeThresh
,
255
,
onTrackbar
,
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