Commit 76ab1f19 authored by Thiago Santini's avatar Thiago Santini

Adds small debugging helper, fixes default backlight compensation values

parent 78555de5
...@@ -51,7 +51,7 @@ UVCCameraSession::UVCCameraSession(QObject *parent) ...@@ -51,7 +51,7 @@ UVCCameraSession::UVCCameraSession(QObject *parent)
tmp.saturation = 0.46875; tmp.saturation = 0.46875;
tmp.white_balance = 0.486486; tmp.white_balance = 0.486486;
tmp.sharpness = 0.333333; tmp.sharpness = 0.333333;
tmp.backlight_compensation = 0.5; tmp.backlight_compensation = 1.0;
tmp.gamma = 0.0654206; tmp.gamma = 0.0654206;
tmp.gain = 0; tmp.gain = 0;
tmp.exposure_abs = 0.0312062; tmp.exposure_abs = 0.0312062;
...@@ -72,7 +72,7 @@ UVCCameraSession::UVCCameraSession(QObject *parent) ...@@ -72,7 +72,7 @@ UVCCameraSession::UVCCameraSession(QObject *parent)
tmp.saturation = 0; tmp.saturation = 0;
tmp.white_balance = 0.486486; tmp.white_balance = 0.486486;
tmp.sharpness = 0.166667; tmp.sharpness = 0.166667;
tmp.backlight_compensation = 40.3333; tmp.backlight_compensation = 1.0;
tmp.gamma = 0.5; tmp.gamma = 0.5;
tmp.gain = 0; tmp.gain = 0;
tmp.exposure_abs = 1; tmp.exposure_abs = 1;
...@@ -652,16 +652,16 @@ void UVCCameraSession::setDefaultParameters() ...@@ -652,16 +652,16 @@ void UVCCameraSession::setDefaultParameters()
settings.setValue("hue_auto", par.hue_auto); settings.setValue("hue_auto", par.hue_auto);
// and set them to the device // and set them to the device
uvc_set(devh, uvc_set_brightness, par.brightness, uvc_get_brightness); uvc_set(devh, uvc_set_brightness, par.brightness, uvc_get_brightness, "brightness");
uvc_set(devh, uvc_set_contrast, par.contrast, uvc_get_contrast); uvc_set(devh, uvc_set_contrast, par.contrast, uvc_get_contrast, "contrast");
uvc_set(devh, uvc_set_saturation, par.saturation, uvc_get_saturation); uvc_set(devh, uvc_set_saturation, par.saturation, uvc_get_saturation, "saturation");
uvc_set(devh, uvc_set_white_balance_temperature, par.white_balance, uvc_get_white_balance_temperature); uvc_set(devh, uvc_set_white_balance_temperature, par.white_balance, uvc_get_white_balance_temperature, "white_balance_temperature");
uvc_set(devh, uvc_set_sharpness, par.sharpness, uvc_get_sharpness); uvc_set(devh, uvc_set_sharpness, par.sharpness, uvc_get_sharpness, "sharpness");
uvc_set(devh, uvc_set_backlight_compensation, par.backlight_compensation, uvc_get_backlight_compensation); uvc_set(devh, uvc_set_backlight_compensation, par.backlight_compensation, uvc_get_backlight_compensation, "backlight_compensation");
uvc_set(devh, uvc_set_gamma, par.gamma, uvc_get_gamma); uvc_set(devh, uvc_set_gamma, par.gamma, uvc_get_gamma, "gamma");
uvc_set(devh, uvc_set_gain, par.gain, uvc_get_gain); uvc_set(devh, uvc_set_gain, par.gain, uvc_get_gain, "gain");
uvc_set(devh, uvc_set_exposure_abs, par.exposure_abs, uvc_get_exposure_abs); uvc_set(devh, uvc_set_exposure_abs, par.exposure_abs, uvc_get_exposure_abs, "exposure_abs");
uvc_set(devh, uvc_set_hue, par.hue, uvc_get_hue); uvc_set(devh, uvc_set_hue, par.hue, uvc_get_hue, "hue");
uvc_set_mode(devh, uvc_set_ae_mode, par.ae_mode); uvc_set_mode(devh, uvc_set_ae_mode, par.ae_mode);
uvc_set_mode(devh, uvc_set_ae_priority, par.ae_priority); uvc_set_mode(devh, uvc_set_ae_priority, par.ae_priority);
uvc_set_mode(devh, uvc_set_contrast_auto, par.contrast_auto); uvc_set_mode(devh, uvc_set_contrast_auto, par.contrast_auto);
......
...@@ -118,13 +118,15 @@ public: ...@@ -118,13 +118,15 @@ public:
void uvc_set( uvc_device_handle_t *devh, void uvc_set( uvc_device_handle_t *devh,
uvc_error_t (*set)( uvc_device_handle_t *, T), uvc_error_t (*set)( uvc_device_handle_t *, T),
QVariant val, QVariant val,
uvc_error_t (*get)( uvc_device_handle_t *, T *, enum uvc_req_code) uvc_error_t (*get)( uvc_device_handle_t *, T *, enum uvc_req_code),
const QString msg = ""
) { ) {
T mn, mx; T mn, mx;
get(devh, &mn, UVC_GET_MIN); get(devh, &mn, UVC_GET_MIN);
get(devh, &mx, UVC_GET_MAX); get(devh, &mx, UVC_GET_MAX);
double value = val.toDouble(); double value = val.toDouble();
value = value * (mx - mn ) + mn; value = value * (mx - mn ) + mn;
//qDebug() << msg << mn << value << mx;
set(devh, static_cast<T>(value)); set(devh, static_cast<T>(value));
} }
template<typename T> template<typename T>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment