3#include "cpp-tools/src/resources.h"
36 if (config.count(
"pixel format") != 0) {
38 std::string str = config.at(
"pixel format").get<std::string>();
39 if (wpi::equals_lower(str,
"mjpeg")) {
40 mode.pixelFormat = cs::VideoMode::kMJPEG;
41 }
else if (wpi::equals_lower(str,
"yuyv")) {
42 mode.pixelFormat = cs::VideoMode::kYUYV;
43 }
else if (wpi::equals_lower(str,
"rgb565")) {
44 mode.pixelFormat = cs::VideoMode::kRGB565;
45 }
else if (wpi::equals_lower(str,
"bgr")) {
46 mode.pixelFormat = cs::VideoMode::kBGR;
47 }
else if (wpi::equals_lower(str,
"gray")) {
48 mode.pixelFormat = cs::VideoMode::kGray;
50 mode.pixelFormat = cs::VideoMode::kUnknown;
52 }
catch (
const wpi::json::exception& e) {
53 mode.pixelFormat = cs::VideoMode::kUnknown;
56 if (config.count(
"width") != 0) {
58 mode.width = config.at(
"width").get<
unsigned int>();
59 }
catch (
const wpi::json::exception& e) {
63 if (config.count(
"height") != 0) {
65 mode.height = config.at(
"height").get<
unsigned int>();
66 }
catch (
const wpi::json::exception& e) {}
68 if (config.count(
"fps") != 0) {
70 mode.fps = config.at(
"fps").get<
unsigned int>();
71 }
catch (
const wpi::json::exception& e) {}
cs::VideoMode getJsonVideoMode(const wpi::json &config)