Added backlight_compensation, white_balance and gain

This commit is contained in:
Devaev Maxim
2019-03-05 10:47:43 +03:00
parent af2dd0d9a3
commit 9a38078c72
3 changed files with 35 additions and 14 deletions

View File

@@ -383,12 +383,15 @@ static void _device_open_set_image_settings(struct device_t *dev) {
} \
}
SET_CID_AUTO (V4L2_CID_AUTOBRIGHTNESS, V4L2_CID_BRIGHTNESS, brightness);
SET_CID_MANUAL ( V4L2_CID_CONTRAST, contrast);
SET_CID_MANUAL ( V4L2_CID_SATURATION, saturation);
SET_CID_AUTO (V4L2_CID_HUE_AUTO, V4L2_CID_HUE, hue);
SET_CID_MANUAL ( V4L2_CID_GAMMA, gamma);
SET_CID_MANUAL ( V4L2_CID_SHARPNESS, sharpness);
SET_CID_AUTO (V4L2_CID_AUTOBRIGHTNESS, V4L2_CID_BRIGHTNESS, brightness);
SET_CID_MANUAL ( V4L2_CID_CONTRAST, contrast);
SET_CID_MANUAL ( V4L2_CID_SATURATION, saturation);
SET_CID_AUTO (V4L2_CID_HUE_AUTO, V4L2_CID_HUE, hue);
SET_CID_MANUAL ( V4L2_CID_GAMMA, gamma);
SET_CID_MANUAL ( V4L2_CID_SHARPNESS, sharpness);
SET_CID_MANUAL ( V4L2_CID_BACKLIGHT_COMPENSATION, backlight_compensation);
SET_CID_AUTO (V4L2_CID_AUTO_WHITE_BALANCE, V4L2_CID_WHITE_BALANCE_TEMPERATURE, white_balance);
SET_CID_AUTO (V4L2_CID_AUTOGAIN, V4L2_CID_GAIN, gain);
# undef SET_CID_AUTO
# undef SET_CID_MANUAL

View File

@@ -79,6 +79,9 @@ struct image_settings_t {
S_AUTO (hue);
S_MANUAL (gamma);
S_MANUAL (sharpness);
S_MANUAL (backlight_compensation);
S_AUTO (white_balance);
S_AUTO (gain);
};
#undef S_AUTO

View File

@@ -68,6 +68,11 @@ static const struct option _long_opts[] = {
{"image-hue-auto", no_argument, NULL, 2005},
{"image-gamma", required_argument, NULL, 2006},
{"image-sharpness", required_argument, NULL, 2007},
{"image-backlight-compensation", required_argument, NULL, 2008},
{"image-white-balance", required_argument, NULL, 2009},
{"image-white-balance-auto", no_argument, NULL, 2010},
{"image-gain", required_argument, NULL, 2011},
{"image-gain-auto", no_argument, NULL, 2012},
{"host", required_argument, NULL, 's'},
{"port", required_argument, NULL, 'p'},
@@ -133,14 +138,19 @@ static void _help(struct device_t *dev, struct encoder_t *encoder, struct http_s
printf(" after a timeout. Default: %u\n\n", dev->error_delay);
printf("Image options:\n");
printf("---------------\n");
printf(" --image-brightness <N> -- Set brightness. Default: no change.\n\n");
printf(" --image-brightness-auto -- Enable automatic brightness control. Default: no change.\n\n");
printf(" --image-contrast <N> -- Set contrast. Default: no change.\n\n");
printf(" --image-saturation <N> -- Set saturation. Default: no change.\n\n");
printf(" --image-hue <N> -- Set hue. Default: no change.\n\n");
printf(" --image-hue-auto -- Enable automatic hue control. Default: no change.\n\n");
printf(" --image-gamma <N> -- Set gamma. Default: no change.\n\n");
printf(" --image-sharpness <N> -- Set sharpness. Default: no change.\n\n");
printf(" --image-brightness <N> -- Set brightness. Default: no change.\n\n");
printf(" --image-brightness-auto -- Enable automatic brightness control. Default: no change.\n\n");
printf(" --image-contrast <N> -- Set contrast. Default: no change.\n\n");
printf(" --image-saturation <N> -- Set saturation. Default: no change.\n\n");
printf(" --image-hue <N> -- Set hue. Default: no change.\n\n");
printf(" --image-hue-auto -- Enable automatic hue control. Default: no change.\n\n");
printf(" --image-gamma <N> -- Set gamma. Default: no change.\n\n");
printf(" --image-sharpness <N> -- Set sharpness. Default: no change.\n\n");
printf(" --image-backlight-compensation <N> -- Set backlight compensation. Default: no change.\n\n");
printf(" --image-white-combalance <N> -- Set white balance. Default: no change.\n\n");
printf(" --image-white-combalance-auto -- Enable automatic white balance control. Default: no change.\n\n");
printf(" --image-gain <N> -- Set gain. Default: no change.\n\n");
printf(" --image-gain-auto -- Enable automatic gain control. Default: no change.\n\n");
printf("HTTP server options:\n");
printf("--------------------\n");
printf(" -s|--host <address> -- Listen on Hostname or IP. Default: %s\n\n", server->host);
@@ -241,6 +251,11 @@ static int _parse_options(int argc, char *argv[], struct device_t *dev, struct e
case 2005: OPT_IMG_AUTO(hue);
case 2006: OPT_IMG(gamma);
case 2007: OPT_IMG(sharpness);
case 2008: OPT_IMG(backlight_compensation);
case 2009: OPT_IMG(white_balance);
case 2010: OPT_IMG_AUTO(white_balance);
case 2011: OPT_IMG(gain);
case 2012: OPT_IMG_AUTO(gain);
case 's': OPT_SET(server->host, optarg);
case 'p': OPT_UNSIGNED(server->port, "--port", 1, 65535);