Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uvcengine
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Thiago Santini
uvcengine
Commits
5e6d0a7c
Commit
5e6d0a7c
authored
Mar 15, 2018
by
Thiago Santini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds parametetrization and default values
parent
96f94e6b
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
210 additions
and
128 deletions
+210
-128
uvccamerasession.cpp
uvcengine/uvccamerasession.cpp
+167
-125
uvccamerasession.h
uvcengine/uvccamerasession.h
+43
-3
No files found.
uvcengine/uvccamerasession.cpp
View file @
5e6d0a7c
This diff is collapsed.
Click to expand it.
uvcengine/uvccamerasession.h
View file @
5e6d0a7c
...
...
@@ -19,6 +19,7 @@
#include <vector>
#include <atomic>
#include <map>
#include "libuvc/libuvc.h"
...
...
@@ -27,6 +28,27 @@ QT_BEGIN_NAMESPACE
// Maximum acceptable latency for calling the surface present method
#define MAX_LATENCY_MS 1.0e3/25
struct
DefaultParameters
{
double
bandwidthFactor
;
double
brightness
;
double
contrast
;
double
saturation
;
double
white_balance
;
double
sharpness
;
double
backlight_compensation
;
double
gamma
;
double
gain
;
double
exposure_abs
;
double
hue
;
int
ae_mode
;
int
ae_priority
;
int
contrast_auto
;
int
focus_auto
;
int
white_balance_component_auto
;
int
white_balance_temperature_auto
;
int
hue_auto
;
};
class
UVCCameraSession
:
public
QObject
{
Q_OBJECT
...
...
@@ -56,6 +78,8 @@ public:
double
interval
;
// Image Processing
// TODO: we don't check if the camera supports the parameters since some
// cameras underreport their capabilities; is this safe?
template
<
typename
T
>
QVariant
uvc_get
(
uvc_device_handle_t
*
devh
,
uvc_error_t
(
*
get
)(
uvc_device_handle_t
*
,
T
*
,
enum
uvc_req_code
)
...
...
@@ -64,10 +88,17 @@ public:
get
(
devh
,
&
mn
,
UVC_GET_MIN
);
get
(
devh
,
&
val
,
UVC_GET_CUR
);
get
(
devh
,
&
mx
,
UVC_GET_MAX
);
//qDebug() << mn << val << mx;
return
(
val
-
mn
)
/
(
double
)
(
mx
-
mn
)
;
}
template
<
typename
T
>
QVariant
uvc_get_mode
(
uvc_device_handle_t
*
devh
,
uvc_error_t
(
*
get
)(
uvc_device_handle_t
*
,
T
*
,
enum
uvc_req_code
)
)
const
{
T
val
;
get
(
devh
,
&
val
,
UVC_GET_CUR
);
return
val
;
}
template
<
typename
T
>
void
uvc_set
(
uvc_device_handle_t
*
devh
,
uvc_error_t
(
*
set
)(
uvc_device_handle_t
*
,
T
),
QVariant
val
,
...
...
@@ -78,9 +109,15 @@ public:
get
(
devh
,
&
mx
,
UVC_GET_MAX
);
double
value
=
val
.
toDouble
();
value
=
value
*
(
mx
-
mn
)
+
mn
;
//qDebug() << val;
set
(
devh
,
static_cast
<
T
>
(
value
));
}
template
<
typename
T
>
void
uvc_set_mode
(
uvc_device_handle_t
*
devh
,
uvc_error_t
(
*
set
)(
uvc_device_handle_t
*
,
T
),
QVariant
val
)
{
set
(
devh
,
static_cast
<
T
>
(
val
.
toInt
()));
}
// Image Processing
bool
isImageProcessingParameterSupported
(
QCameraImageProcessingControl
::
ProcessingParameter
parameter
)
const
;
...
...
@@ -101,7 +138,7 @@ private Q_SLOTS:
void
presentFrame
(
QVideoFrame
frame
,
const
qreal
t
);
private:
float
bandwidthFactor
;
double
bandwidthFactor
;
QCamera
::
Status
m_status
;
QAbstractVideoSurface
*
m_surface
;
QMutex
surfaceMutex
;
...
...
@@ -132,6 +169,9 @@ private:
static
QMutex
UVCCameraSession
::
devicesMutex
;
bool
acquire
(
const
QString
&
device
);
void
release
(
const
QString
&
device
);
std
::
map
<
QString
,
DefaultParameters
>
defaults
;
void
setDefaultParameters
();
};
QT_END_NAMESPACE
...
...
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