Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
502970b3
Commit
502970b3
authored
Sep 30, 2018
by
berak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cvv: fix small memleak in demo
parent
ff59193d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
25 deletions
+12
-25
cvv_demo.cpp
modules/cvv/samples/cvv_demo.cpp
+12
-25
No files found.
modules/cvv/samples/cvv_demo.cpp
View file @
502970b3
...
...
@@ -28,13 +28,6 @@ template<class T> std::string toString(const T& p_arg)
}
void
usage
()
{
printf
(
"usage: cvv_demo [-r WxH]
\n
"
);
printf
(
"-h print this help
\n
"
);
printf
(
"-r WxH change resolution to width W and height H
\n
"
);
}
int
...
...
@@ -44,35 +37,29 @@ main(int argc, char** argv)
// parser keys
const
char
*
keys
=
"{ help h usage ? | | show this message }"
"{ resolution r |0x0| resolution to width and height in the format WxH }"
;
"{ help h usage ? | | show this message }"
"{ width W | 0| camera resolution width. leave at 0 to use defaults }"
"{ height H | 0| camera resolution height. leave at 0 to use defaults }"
;
CommandLineParser
parser
(
argc
,
argv
,
keys
);
string
res
(
parser
.
get
<
string
>
(
"resolution"
));
if
(
parser
.
has
(
"help"
))
{
u
sage
();
parser
.
printMes
sage
();
return
0
;
}
if
(
res
!=
"0x0"
)
{
char
dummych
;
resolution
=
new
cv
::
Size
();
if
(
sscanf
(
res
.
c_str
(),
"%d%c%d"
,
&
resolution
->
width
,
&
dummych
,
&
resolution
->
height
)
!=
3
)
{
cout
<<
res
<<
" not a valid resolution"
<<
endl
;
return
1
;
}
}
int
res_w
=
parser
.
get
<
int
>
(
"width"
);
int
res_h
=
parser
.
get
<
int
>
(
"height"
);
// setup video capture
cv
::
VideoCapture
capture
(
0
);
if
(
!
capture
.
isOpened
())
{
std
::
cout
<<
"Could not open VideoCapture"
<<
std
::
endl
;
return
3
;
return
1
;
}
if
(
resolution
)
{
printf
(
"Setting resolution to %dx%d
\n
"
,
resolution
->
width
,
resolution
->
height
);
capture
.
set
(
CV_CAP_PROP_FRAME_WIDTH
,
resolution
->
width
);
capture
.
set
(
CV_CAP_PROP_FRAME_HEIGHT
,
resolution
->
height
);
delete
resolution
;
if
(
res_w
>
0
&&
res_h
>
0
)
{
printf
(
"Setting resolution to %dx%d
\n
"
,
res_w
,
res_h
);
capture
.
set
(
CV_CAP_PROP_FRAME_WIDTH
,
res_w
);
capture
.
set
(
CV_CAP_PROP_FRAME_HEIGHT
,
res_h
);
}
...
...
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