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
4d417ccf
Commit
4d417ccf
authored
Jun 09, 2011
by
itsyplen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Help and parsing command line were updated in next samples: chamfer
parent
a1ee9d40
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
23 deletions
+31
-23
camshiftdemo.cpp
samples/cpp/camshiftdemo.cpp
+2
-6
chamfer.cpp
samples/cpp/chamfer.cpp
+29
-17
No files found.
samples/cpp/camshiftdemo.cpp
View file @
4d417ccf
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
//
#include <iostream>
#include <stdio.h>
#include <stdio.h>
#include <ctype.h>
#include <ctype.h>
...
@@ -78,16 +78,12 @@ int main( int argc, const char** argv )
...
@@ -78,16 +78,12 @@ int main( int argc, const char** argv )
float
hranges
[]
=
{
0
,
180
};
float
hranges
[]
=
{
0
,
180
};
const
float
*
phranges
=
hranges
;
const
float
*
phranges
=
hranges
;
// if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0])))
// cap.open(argc == 2 ? argv[1][0] - '0' : 0);
// else if( argc == 2 )
// cap.open(argv[1]);
cap
.
open
(
cameraInd
);
cap
.
open
(
cameraInd
);
if
(
!
cap
.
isOpened
()
)
if
(
!
cap
.
isOpened
()
)
{
{
help
();
help
();
cout
<<
"***Could not initialize capturing...***
\n
"
;
printf
(
"***Could not initialize capturing...***
\n
"
)
;
return
0
;
return
0
;
}
}
...
...
samples/cpp/chamfer.cpp
View file @
4d417ccf
...
@@ -2,33 +2,45 @@
...
@@ -2,33 +2,45 @@
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/contrib/contrib.hpp"
#include "opencv2/contrib/contrib.hpp"
#include <
iostream
>
#include <
stdio.h
>
using
namespace
cv
;
using
namespace
cv
;
using
namespace
std
;
using
namespace
std
;
void
help
()
void
help
()
{
{
cout
<<
printf
(
"
\n
This program demonstrates Chamfer matching -- computing a distance between an
\n
"
"
\n
This program demonstrates Chamfer matching -- computing a distance between an
\n
"
"edge template and a query edge image.
\n
"
"edge template and a query edge image.
\n
"
"Usage:
\n
"
"Call:
\n
"
"./chamfer [<image edge map, logo_in_clutter.png as default>
\n
"
"./chamfer [<image edge map> <template edge map
>]
\n
"
"<template edge map, logo.png as default
>]
\n
"
"By default
\n
"
"Example:
\n
"
"the inputs are ./chamfer logo_in_clutter.png logo.png
\n
"
<<
endl
;
" ./chamfer logo_in_clutter.png logo.png
\n
"
)
;
}
}
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
c
onst
c
har
**
argv
)
{
{
if
(
argc
!=
1
&&
argc
!=
3
)
help
();
{
help
();
CommandLineParser
parser
(
argc
,
argv
);
return
0
;
}
string
image
=
parser
.
get
<
string
>
(
"0"
,
"logo_in_clutter.png"
);
Mat
img
=
imread
(
argc
==
3
?
argv
[
1
]
:
"logo_in_clutter.png"
,
0
);
string
tempLate
=
parser
.
get
<
string
>
(
"1"
,
"logo.png"
);
Mat
img
=
imread
(
image
,
0
);
Mat
cimg
;
Mat
cimg
;
cvtColor
(
img
,
cimg
,
CV_GRAY2BGR
);
cvtColor
(
img
,
cimg
,
CV_GRAY2BGR
);
Mat
tpl
=
imread
(
argc
==
3
?
argv
[
2
]
:
"logo.png"
,
0
);
Mat
tpl
=
imread
(
tempLate
,
0
);
// Mat img = imread(argc == 3 ? argv[1] : "logo_in_clutter.png", 0);
// Mat cimg;
// cvtColor(img, cimg, CV_GRAY2BGR);
// Mat tpl = imread(argc == 3 ? argv[2] : "logo.png", 0);
// if( argc != 1 && argc != 3 )
// {
// help();
// return 0;
// }
// if the image and the template are not edge maps but normal grayscale images,
// if the image and the template are not edge maps but normal grayscale images,
// you might want to uncomment the lines below to produce the maps. You can also
// you might want to uncomment the lines below to produce the maps. You can also
// run Sobel instead of Canny.
// run Sobel instead of Canny.
...
@@ -41,7 +53,7 @@ int main( int argc, char** argv )
...
@@ -41,7 +53,7 @@ int main( int argc, char** argv )
int
best
=
chamerMatching
(
img
,
tpl
,
results
,
costs
);
int
best
=
chamerMatching
(
img
,
tpl
,
results
,
costs
);
if
(
best
<
0
)
if
(
best
<
0
)
{
{
cout
<<
"not found;
\n
"
;
printf
(
"not found;
\n
"
)
;
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