Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
li_camera
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
humanoides
li_camera
Commits
230f9132
Commit
230f9132
authored
6 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Added functions to get and set the gain and exposure parameters.
parent
16f723c8
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/li_camera.h
+4
-0
4 additions, 0 deletions
include/li_camera.h
src/examples/li_camera_test.cpp
+4
-0
4 additions, 0 deletions
src/examples/li_camera_test.cpp
src/li_camera.cpp
+58
-0
58 additions, 0 deletions
src/li_camera.cpp
with
66 additions
and
0 deletions
include/li_camera.h
+
4
−
0
View file @
230f9132
...
...
@@ -31,6 +31,10 @@ class CLICamera
#ifdef HAVE_OPENCV_H
bool
get_image
(
cv
::
Mat
&
image
);
#endif
void
set_gain
(
unsigned
short
int
gain
);
unsigned
short
int
get_gain
(
void
);
void
set_exposure
(
unsigned
int
exposure
);
unsigned
int
get_exposure
(
void
);
void
close
(
void
);
~
CLICamera
();
};
...
...
This diff is collapsed.
Click to expand it.
src/examples/li_camera_test.cpp
+
4
−
0
View file @
230f9132
...
...
@@ -15,6 +15,10 @@ int main(int argc, char *argv[])
cv
::
namedWindow
(
"GlobalShutter"
,
1
);
camera
.
open
(
0x2a0b
,
0x00f8
);
std
::
cout
<<
"current gain: "
<<
camera
.
get_gain
()
<<
std
::
endl
;
camera
.
set_gain
(
32
);
std
::
cout
<<
"current exposure: "
<<
camera
.
get_exposure
()
<<
std
::
endl
;
camera
.
set_exposure
(
32
);
for
(
i
=
0
;
i
<
100
;
i
++
)
{
if
(
camera
.
get_image
(
image
))
...
...
This diff is collapsed.
Click to expand it.
src/li_camera.cpp
+
58
−
0
View file @
230f9132
...
...
@@ -178,6 +178,64 @@ bool CLICamera::get_image(cv::Mat &image)
}
#endif
void
CLICamera
::
set_gain
(
unsigned
short
int
gain
)
{
this
->
uvc_access
.
enter
();
if
(
uvc_set_gain
(
this
->
device_handle
,
gain
))
{
this
->
uvc_access
.
exit
();
throw
CLICameraException
(
_HERE_
,
"Impossible to set gain"
);
}
this
->
uvc_access
.
exit
();
}
unsigned
short
int
CLICamera
::
get_gain
(
void
)
{
unsigned
short
int
gain
;
this
->
uvc_access
.
enter
();
if
(
uvc_get_gain
(
this
->
device_handle
,
&
gain
,
UVC_GET_CUR
))
{
this
->
uvc_access
.
exit
();
throw
CLICameraException
(
_HERE_
,
"Impossible to get gain"
);
}
this
->
uvc_access
.
exit
();
return
gain
;
}
void
CLICamera
::
set_exposure
(
unsigned
int
exposure
)
{
this
->
uvc_access
.
enter
();
if
(
uvc_set_exposure_abs
(
this
->
device_handle
,
exposure
))
{
this
->
uvc_access
.
exit
();
throw
CLICameraException
(
_HERE_
,
"Impossible to set gain"
);
}
this
->
uvc_access
.
exit
();
}
unsigned
int
CLICamera
::
get_exposure
(
void
)
{
unsigned
int
exposure
;
this
->
uvc_access
.
enter
();
if
(
uvc_get_exposure_abs
(
this
->
device_handle
,
&
exposure
,
UVC_GET_CUR
))
{
this
->
uvc_access
.
exit
();
throw
CLICameraException
(
_HERE_
,
"Impossible to get gain"
);
}
this
->
uvc_access
.
exit
();
return
exposure
;
}
void
CLICamera
::
close
(
void
)
{
this
->
uvc_access
.
enter
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment