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
d3eed2cf
Commit
d3eed2cf
authored
Sep 18, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
videoio: CAP_PROP_BACKEND property interface
parent
51f7eb3a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
videoio.hpp
modules/videoio/include/opencv2/videoio.hpp
+1
-0
cap.cpp
modules/videoio/src/cap.cpp
+26
-0
No files found.
modules/videoio/include/opencv2/videoio.hpp
View file @
d3eed2cf
...
...
@@ -169,6 +169,7 @@ enum VideoCaptureProperties {
CAP_PROP_AUTOFOCUS
=
39
,
CAP_PROP_SAR_NUM
=
40
,
//!< Sample aspect ratio: num/den (num)
CAP_PROP_SAR_DEN
=
41
,
//!< Sample aspect ratio: num/den (den)
CAP_PROP_BACKEND
=
42
,
//!< current backend (enum VideoCaptureAPIs). Read-only property
#ifndef CV_DOXYGEN
CV__CAP_PROP_LATEST
#endif
...
...
modules/videoio/src/cap.cpp
View file @
d3eed2cf
...
...
@@ -272,6 +272,8 @@ VideoCapture& VideoCapture::operator >> (UMat& image)
bool
VideoCapture
::
set
(
int
propId
,
double
value
)
{
CV_CheckNE
(
propId
,
(
int
)
CAP_PROP_BACKEND
,
"Can set read-only property"
);
if
(
!
icap
.
empty
())
return
icap
->
setProperty
(
propId
,
value
);
return
cvSetCaptureProperty
(
cap
,
propId
,
value
)
!=
0
;
...
...
@@ -279,6 +281,17 @@ bool VideoCapture::set(int propId, double value)
double
VideoCapture
::
get
(
int
propId
)
const
{
if
(
propId
==
CAP_PROP_BACKEND
)
{
int
api
=
0
;
if
(
icap
)
api
=
icap
->
isOpened
()
?
icap
->
getCaptureDomain
()
:
0
;
else
if
(
cap
)
api
=
cap
->
getCaptureDomain
();
if
(
api
<=
0
)
return
-
1.0
;
return
(
double
)
api
;
}
if
(
!
icap
.
empty
())
return
icap
->
getProperty
(
propId
);
return
cap
?
cap
->
getProperty
(
propId
)
:
0
;
...
...
@@ -358,6 +371,8 @@ bool VideoWriter::isOpened() const
bool
VideoWriter
::
set
(
int
propId
,
double
value
)
{
CV_CheckNE
(
propId
,
(
int
)
CAP_PROP_BACKEND
,
"Can set read-only property"
);
if
(
!
iwriter
.
empty
())
return
iwriter
->
setProperty
(
propId
,
value
);
return
false
;
...
...
@@ -365,6 +380,17 @@ bool VideoWriter::set(int propId, double value)
double
VideoWriter
::
get
(
int
propId
)
const
{
if
(
propId
==
CAP_PROP_BACKEND
)
{
int
api
=
0
;
if
(
iwriter
)
api
=
iwriter
->
getCaptureDomain
();
else
if
(
writer
)
api
=
writer
->
getCaptureDomain
();
if
(
api
<=
0
)
return
-
1.0
;
return
(
double
)
api
;
}
if
(
!
iwriter
.
empty
())
return
iwriter
->
getProperty
(
propId
);
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