Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uvcengine
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Thiago Santini
uvcengine
Commits
21ff0b70
Commit
21ff0b70
authored
Mar 27, 2017
by
Thiago Santini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mimics most of Pupil Labs settings
parent
d4a17470
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
20 deletions
+48
-20
uvcengine/uvccamerasession.cpp
uvcengine/uvccamerasession.cpp
+36
-14
uvcengine/uvccamerasession.h
uvcengine/uvccamerasession.h
+4
-0
uvcengine/uvcvideodevicecontrol.cpp
uvcengine/uvcvideodevicecontrol.cpp
+8
-6
No files found.
uvcengine/uvccamerasession.cpp
View file @
21ff0b70
...
...
@@ -6,6 +6,7 @@ UVCCameraSession::UVCCameraSession(QObject *parent)
:
QObject
(
parent
),
m_surface
(
Q_NULLPTR
),
streaming
(
false
),
bandwidthFactor
(
1.3
f
),
dev
(
NULL
),
devh
(
NULL
)
{
...
...
@@ -81,12 +82,17 @@ bool UVCCameraSession::load()
// TODO: parametrize this
uvc_set_focus_auto
(
devh
,
0
);
uvc_set_ae_priority
(
devh
,
0
);
uvc_set_ae_mode
(
devh
,
1
);
uvc_set_saturation
(
devh
,
63
);
uvc_set_exposure_abs
(
devh
,
63
);
uvc_set_backlight_compensation
(
devh
,
2
);
uvc_set_gamma
(
devh
,
100
);
if
(
isPupilFieldCamera
())
{
bandwidthFactor
=
2.0
f
;
uvc_set_ae_priority
(
devh
,
1
);
}
else
if
(
isPupilEyeCamera
())
{
uvc_set_ae_priority
(
devh
,
0
);
uvc_set_ae_mode
(
devh
,
1
);
uvc_set_saturation
(
devh
,
127
);
// do not set saturation to zero as to not lose color information
uvc_set_exposure_abs
(
devh
,
63
);
uvc_set_backlight_compensation
(
devh
,
2
);
uvc_set_gamma
(
devh
,
100
);
}
updateSourceCapabilities
();
...
...
@@ -136,14 +142,6 @@ bool UVCCameraSession::startPreview()
return
false
;
}
float
bandwidthFactor
=
1.3
f
;
uvc_device_descriptor
*
desc
;
uvc_get_device_descriptor
(
dev
,
&
desc
);
QString
name
(
desc
->
product
);
if
(
name
.
contains
(
"ID2"
))
bandwidthFactor
=
2.0
f
;
uvc_free_device_descriptor
(
desc
);
res
=
uvc_stream_start
(
strmh
,
cb
,
(
void
*
)
this
,
bandwidthFactor
,
0
);
if
(
res
!=
UVC_SUCCESS
)
{
qWarning
()
<<
"uvc_stream_start"
<<
uvc_strerror
(
res
);
...
...
@@ -245,3 +243,27 @@ void UVCCameraSession::setViewfinderSettings(const QCameraViewfinderSettings &se
{
this
->
settings
=
settings
;
}
bool
UVCCameraSession
::
isPupilFieldCamera
()
{
bool
ret
=
false
;
uvc_device_descriptor
*
desc
;
uvc_get_device_descriptor
(
dev
,
&
desc
);
QString
name
(
desc
->
product
);
if
(
name
.
contains
(
"Pupil Cam1 ID2"
)
)
ret
=
true
;
uvc_free_device_descriptor
(
desc
);
return
ret
;
}
bool
UVCCameraSession
::
isPupilEyeCamera
()
{
bool
ret
=
false
;
uvc_device_descriptor
*
desc
;
uvc_get_device_descriptor
(
dev
,
&
desc
);
QString
name
(
desc
->
product
);
if
(
name
.
contains
(
"Pupil Cam1 ID0"
)
||
name
.
contains
(
"Pupil Cam1 ID1"
)
)
ret
=
true
;
uvc_free_device_descriptor
(
desc
);
return
ret
;
}
uvcengine/uvccamerasession.h
View file @
21ff0b70
...
...
@@ -52,6 +52,7 @@ private Q_SLOTS:
private:
bool
streaming
;
float
bandwidthFactor
;
QCamera
::
Status
m_status
;
QAbstractVideoSurface
*
m_surface
;
...
...
@@ -75,6 +76,9 @@ private:
bool
qPixelFormat2UVCFrameFormat
(
const
QVideoFrame
::
PixelFormat
&
qFormat
,
uvc_frame_format
&
uvcFormat
);
static
QMutex
sessionMutex
;
bool
isPupilFieldCamera
();
bool
isPupilEyeCamera
();
};
QT_END_NAMESPACE
...
...
uvcengine/uvcvideodevicecontrol.cpp
View file @
21ff0b70
...
...
@@ -71,7 +71,7 @@ void UVCVideoDeviceControl::setSelectedDevice(int index)
uvc_error_t
res
;
res
=
uvc_get_device_list
(
ctx
,
&
devList
);
if
(
res
<
0
)
{
q
Debu
g
()
<<
"uvc_get_device_list"
<<
uvc_strerror
(
res
);
q
Warnin
g
()
<<
"uvc_get_device_list"
<<
uvc_strerror
(
res
);
return
;
}
...
...
@@ -84,7 +84,7 @@ void UVCVideoDeviceControl::setSelectedDevice(int index)
uvc_device_descriptor_t
*
desc
;
res
=
uvc_get_device_descriptor
(
dev
,
&
desc
);
if
(
res
<
0
)
{
q
Debu
g
()
<<
"uvc_get_device_descriptor"
<<
uvc_strerror
(
res
);
q
Warnin
g
()
<<
"uvc_get_device_descriptor"
<<
uvc_strerror
(
res
);
return
;
}
bool
selectedDevice
=
QString
::
number
(
desc
->
idProduct
).
compare
(
device
)
==
0
;
...
...
@@ -95,6 +95,8 @@ void UVCVideoDeviceControl::setSelectedDevice(int index)
busyDevices
[
device
]
=
true
;
currentDevice
=
device
;
m_session
->
setDevice
(
dev
);
}
else
{
qWarning
()
<<
"Device is busy."
;
}
break
;
}
...
...
@@ -123,10 +125,10 @@ void UVCVideoDeviceControl::updateDevices()
if
(
!
ctx
)
{
// Init libuvc
q
Debug
()
<<
"Initializing libuvc context..."
;
q
Info
()
<<
"Initializing libuvc context..."
;
res
=
uvc_init
(
&
ctx
,
NULL
);
if
(
res
<
0
)
{
q
Debu
g
()
<<
"uvc_init"
<<
uvc_strerror
(
res
);
q
Warnin
g
()
<<
"uvc_init"
<<
uvc_strerror
(
res
);
return
;
}
}
...
...
@@ -134,7 +136,7 @@ void UVCVideoDeviceControl::updateDevices()
uvc_device_t
**
devList
;
res
=
uvc_get_device_list
(
ctx
,
&
devList
);
if
(
res
<
0
)
{
q
Debu
g
()
<<
"uvc_get_device_list"
<<
uvc_strerror
(
res
);
q
Warnin
g
()
<<
"uvc_get_device_list"
<<
uvc_strerror
(
res
);
return
;
}
...
...
@@ -147,7 +149,7 @@ void UVCVideoDeviceControl::updateDevices()
uvc_device_descriptor_t
*
desc
;
res
=
uvc_get_device_descriptor
(
dev
,
&
desc
);
if
(
res
<
0
)
{
q
Debu
g
()
<<
"uvc_get_device_descriptor"
<<
uvc_strerror
(
res
);
q
Warnin
g
()
<<
"uvc_get_device_descriptor"
<<
uvc_strerror
(
res
);
break
;
}
...
...
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