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
a1ee9d40
Commit
a1ee9d40
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: camshiftdemo, calibration_artificial
parent
cfb8c841
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
25 deletions
+29
-25
calibration_artificial.cpp
samples/cpp/calibration_artificial.cpp
+5
-5
camshiftdemo.cpp
samples/cpp/camshiftdemo.cpp
+24
-20
No files found.
samples/cpp/calibration_artificial.cpp
View file @
a1ee9d40
...
@@ -11,11 +11,11 @@ using namespace cv;
...
@@ -11,11 +11,11 @@ using namespace cv;
using
namespace
std
;
using
namespace
std
;
void
help
()
void
help
()
{
{
cout
<<
"
\n
This code generates an artificial camera and artificial chessboard images,
\n
"
printf
(
"
\n
This code generates an artificial camera and artificial chessboard images,
\n
"
<<
"and then calibrates. It is basically test code for calibration that shows
\n
"
"and then calibrates. It is basically test code for calibration that shows
\n
"
<<
"how to package calibration points and then calibrate the camera.
\n
"
"how to package calibration points and then calibrate the camera.
\n
"
<<
"Call
:
\n
"
"Usage
:
\n
"
<<
"./calibration_artificial
\n
"
<<
endl
;
"./calibration_artificial
\n\n
"
)
;
}
}
namespace
cv
namespace
cv
{
{
...
...
samples/cpp/camshiftdemo.cpp
View file @
a1ee9d40
#include "opencv2/core/core.hpp"
#include "opencv2/video/tracking.hpp"
#include "opencv2/video/tracking.hpp"
#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 <ctype.h>
#include <ctype.h>
using
namespace
cv
;
using
namespace
cv
;
...
@@ -10,19 +12,17 @@ using namespace std;
...
@@ -10,19 +12,17 @@ using namespace std;
void
help
()
void
help
()
{
{
cout
<<
"
\n
This is a demo that shows mean-shift based tracking
\n
"
printf
(
"
\n
This is a demo that shows mean-shift based tracking
\n
"
<<
"You select a color objects such as your face and it tracks it.
\n
"
"You select a color objects such as your face and it tracks it.
\n
"
<<
"This reads from video camera (0 by default, or the camera number the user enters
\n
"
"This reads from video camera (0 by default, or the camera number the user enters
\n
"
<<
"Call:
\n
"
"Usage:
\n
"
<<
"
\n
./camshiftdemo [camera number]"
"./camshiftdemo [--cameraIndex]=<camera number, zero as default>
\n
"
<<
"
\n
"
<<
endl
;
"
\n
Hot keys:
\n
"
"
\t
ESC - quit the program
\n
"
cout
<<
"
\n\n
Hot keys:
\n
"
"
\t
c - stop the tracking
\n
"
"
\t
ESC - quit the program
\n
"
"
\t
b - switch to/from backprojection view
\n
"
"
\t
c - stop the tracking
\n
"
"
\t
h - show/hide object histogram
\n
"
"
\t
b - switch to/from backprojection view
\n
"
"To initialize tracking, select the object with mouse
\n
"
);
"
\t
h - show/hide object histogram
\n
"
"To initialize tracking, select the object with mouse
\n
"
<<
endl
;
}
}
Mat
image
;
Mat
image
;
...
@@ -64,8 +64,13 @@ void onMouse( int event, int x, int y, int, void* )
...
@@ -64,8 +64,13 @@ void onMouse( int event, int x, int y, int, void* )
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
c
onst
c
har
**
argv
)
{
{
help
();
CommandLineParser
parser
(
argc
,
argv
);
unsigned
int
cameraInd
=
parser
.
get
<
unsigned
int
>
(
"cameraIndex"
,
0
);
VideoCapture
cap
;
VideoCapture
cap
;
Rect
trackWindow
;
Rect
trackWindow
;
RotatedRect
trackBox
;
RotatedRect
trackBox
;
...
@@ -73,10 +78,11 @@ int main( int argc, char** argv )
...
@@ -73,10 +78,11 @@ int main( int argc, 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
])))
// if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0])))
cap
.
open
(
argc
==
2
?
argv
[
1
][
0
]
-
'0'
:
0
);
// cap.open(argc == 2 ? argv[1][0] - '0' : 0);
else
if
(
argc
==
2
)
// else if( argc == 2 )
cap
.
open
(
argv
[
1
]);
// cap.open(argv[1]);
cap
.
open
(
cameraInd
);
if
(
!
cap
.
isOpened
()
)
if
(
!
cap
.
isOpened
()
)
{
{
...
@@ -85,8 +91,6 @@ int main( int argc, char** argv )
...
@@ -85,8 +91,6 @@ int main( int argc, char** argv )
return
0
;
return
0
;
}
}
help
();
namedWindow
(
"Histogram"
,
1
);
namedWindow
(
"Histogram"
,
1
);
namedWindow
(
"CamShift Demo"
,
1
);
namedWindow
(
"CamShift Demo"
,
1
);
setMouseCallback
(
"CamShift Demo"
,
onMouse
,
0
);
setMouseCallback
(
"CamShift Demo"
,
onMouse
,
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