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
ecf4b639
Commit
ecf4b639
authored
Jun 14, 2018
by
Adam Rankin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding the ability to toggle autofocus on/off for DirectShow webcams
parent
06c18906
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
cap_dshow.cpp
modules/videoio/src/cap_dshow.cpp
+19
-0
No files found.
modules/videoio/src/cap_dshow.cpp
View file @
ecf4b639
...
...
@@ -3220,6 +3220,11 @@ double VideoCapture_DShow::getProperty(int propIdx) const
return
g_VI
.
getFourcc
(
m_index
);
case
CV_CAP_PROP_FPS
:
return
g_VI
.
getFPS
(
m_index
);
case
CV_CAP_PROP_AUTOFOCUS
:
// Flags indicate whether or not autofocus is enabled
if
(
g_VI
.
getVideoSettingCamera
(
m_index
,
CameraControl_Focus
,
min_value
,
max_value
,
stepping_delta
,
current_value
,
flags
,
defaultValue
))
return
(
double
)
flags
;
return
-
1
;
// video filter properties
case
CV_CAP_PROP_BRIGHTNESS
:
...
...
@@ -3284,6 +3289,7 @@ bool VideoCapture_DShow::setProperty(int propIdx, double propVal)
break
;
case
CV_CAP_PROP_FPS
:
{
int
fps
=
cvRound
(
propVal
);
if
(
fps
!=
g_VI
.
getFPS
(
m_index
))
{
...
...
@@ -3297,6 +3303,19 @@ bool VideoCapture_DShow::setProperty(int propIdx, double propVal)
return
g_VI
.
isDeviceSetup
(
m_index
);
}
case
CV_CAP_PROP_AUTOFOCUS
:
{
// Flags are required to toggle autofocus or not, but the setProperty interface does not support multiple parameters
bool
enabled
=
cvRound
(
propVal
)
==
1
;
long
minFocus
,
maxFocus
,
delta
,
currentFocus
,
flags
,
defaultValue
;
if
(
!
g_VI
.
getVideoSettingCamera
(
m_index
,
CameraControl_Focus
,
minFocus
,
maxFocus
,
delta
,
currentFocus
,
flags
,
defaultValue
))
{
return
false
;
}
return
g_VI
.
setVideoSettingCamera
(
m_index
,
CameraControl_Focus
,
currentFocus
,
enabled
?
CameraControl_Flags_Auto
|
CameraControl_Flags_Manual
:
CameraControl_Flags_Manual
,
enabled
?
true
:
false
);
}
}
if
(
handled
)
{
// a stream setting
...
...
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