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
b33853c5
Commit
b33853c5
authored
Aug 25, 2015
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4199 from AVshokurov:master
parents
587b0cc7
4691d98e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
cap_libv4l.cpp
modules/videoio/src/cap_libv4l.cpp
+45
-0
No files found.
modules/videoio/src/cap_libv4l.cpp
View file @
b33853c5
...
@@ -1433,6 +1433,30 @@ static double icvGetPropertyCAM_V4L (CvCaptureCAM_V4L* capture,
...
@@ -1433,6 +1433,30 @@ static double icvGetPropertyCAM_V4L (CvCaptureCAM_V4L* capture,
sprintf
(
name
,
"Exposure"
);
sprintf
(
name
,
"Exposure"
);
capture
->
control
.
id
=
V4L2_CID_EXPOSURE
;
capture
->
control
.
id
=
V4L2_CID_EXPOSURE
;
break
;
break
;
case
CV_CAP_PROP_FOCUS
:
{
struct
v4l2_control
c
;
int
v4l2_min
;
int
v4l2_max
;
//we need to make sure that the autofocus is switch off, if available.
capture
->
control
.
id
=
V4L2_CID_FOCUS_AUTO
;
v4l2_min
=
v4l2_get_ctrl_min
(
capture
,
capture
->
control
.
id
);
v4l2_max
=
v4l2_get_ctrl_max
(
capture
,
capture
->
control
.
id
);
if
(
!
((
v4l2_min
==
-
1
)
&&
(
v4l2_max
==
-
1
))
)
{
//autofocus capability is supported, switch it off.
c
.
id
=
capture
->
control
.
id
;
c
.
value
=
0
;
//off
if
(
v4l2_ioctl
(
capture
->
deviceHandle
,
VIDIOC_S_CTRL
,
&
c
)
!=
0
){
if
(
errno
!=
ERANGE
)
{
fprintf
(
stderr
,
"VIDEOIO ERROR: V4L2: Failed to set control
\"
%d
\"
(FOCUS_AUTO): %s (value %d)
\n
"
,
c
.
id
,
strerror
(
errno
),
c
.
value
);
return
-
1
;
}
}
}
//lack of support should not be considerred an error.
sprintf
(
name
,
"Focus"
);
capture
->
control
.
id
=
V4L2_CID_FOCUS_ABSOLUTE
;
break
;
}
default:
default:
sprintf
(
name
,
"<unknown property string>"
);
sprintf
(
name
,
"<unknown property string>"
);
capture
->
control
.
id
=
property_id
;
capture
->
control
.
id
=
property_id
;
...
@@ -1650,6 +1674,27 @@ static int icvSetControl (CvCaptureCAM_V4L* capture, int property_id, double val
...
@@ -1650,6 +1674,27 @@ static int icvSetControl (CvCaptureCAM_V4L* capture, int property_id, double val
sprintf
(
name
,
"Exposure"
);
sprintf
(
name
,
"Exposure"
);
capture
->
control
.
id
=
V4L2_CID_EXPOSURE
;
capture
->
control
.
id
=
V4L2_CID_EXPOSURE
;
break
;
break
;
case
CV_CAP_PROP_FOCUS
:
//we need to make sure that the autofocus is switch off, if available.
capture
->
control
.
id
=
V4L2_CID_FOCUS_AUTO
;
v4l2_min
=
v4l2_get_ctrl_min
(
capture
,
capture
->
control
.
id
);
v4l2_max
=
v4l2_get_ctrl_max
(
capture
,
capture
->
control
.
id
);
if
(
!
((
v4l2_min
==
-
1
)
&&
(
v4l2_max
==
-
1
))
)
{
//autofocus capability is supported, switch it off.
c
.
id
=
capture
->
control
.
id
;
c
.
value
=
0
;
//off
if
(
v4l2_ioctl
(
capture
->
deviceHandle
,
VIDIOC_S_CTRL
,
&
c
)
!=
0
){
if
(
errno
!=
ERANGE
)
{
fprintf
(
stderr
,
"VIDEOIO ERROR: V4L2: Failed to set control
\"
%d
\"
(FOCUS_AUTO): %s (value %d)
\n
"
,
c
.
id
,
strerror
(
errno
),
c
.
value
);
return
-
1
;
}
}
}
//lack of support should not be considerred an error.
//now set the manual focus
sprintf
(
name
,
"Focus"
);
capture
->
control
.
id
=
V4L2_CID_FOCUS_ABSOLUTE
;
break
;
default:
default:
sprintf
(
name
,
"<unknown property string>"
);
sprintf
(
name
,
"<unknown property string>"
);
capture
->
control
.
id
=
property_id
;
capture
->
control
.
id
=
property_id
;
...
...
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