SmartSpectra C++ SDK
Measure human vitals from video with SmartSpectra C++ SDK.
Loading...
Searching...
No Matches
camera.hpp
1//
2// Created by greg on 1/16/24.
3// Copyright (c) 2024 Presage Technologies
4//
5
6#pragma once
7// === standard library includes (if any) ===
8// === third-party includes (if any) ===
9#include <absl/flags/flag.h>
10// === local includes (if any) ===
11
12//TODO: rethink namespace here, for presage::camera::camera_cv, and for presage::camera::camera_v4l2
13namespace presage::camera {
14
15// region ======================================== RESOLUTION ==========================================================
16
17struct Resolution {
18 int width;
19 int height;
20};
21
22// For now, when updating this, be sure to update kCommonCameraResolutionRanges as well (and kCommonCameraResolutions, if need be).
23enum CameraResolutionRange {
24 Low,
25 Mid,
26 High,
27 Ultra,
28 FourK,
29 Giant,
30 Complete,
31 Unspecified_EnumEnd // has to be kept last in enum
32};
33
34//@formatter:off
35bool AbslParseFlag(absl::string_view text, CameraResolutionRange* range, std::string* error);
36std::string AbslUnparseFlag(CameraResolutionRange range);
37extern const std::vector<std::string> kCommonCameraResolutionRangeNames;
38extern const std::string kCommonCameraResolutionRangeNameList;
39//@formatter:on
40
41// endregion ===========================================================================================================
42
43// region ========================================= CODECS =============================================================
44//TODO: all enum-based collections should be using reflective enums.
45// One candidate: https://github.com/BlackMATov/enum.hpp
46// Another: https://github.com/aantron/better-enums
47
48//TODO: move all functions using ABSL (and constants using thsoe functions for initialization) to a separate library,
49// with the same namespace. We need to maintain loose coupling, i.e. in case we want to use the presage::camera library
50// where Abseil is not available.
51enum class UncertainBool : int {
52 True = 1,
53 False = 0,
54 Unknown = -1
55};
56
57// note: needs to be updated only together with kCaptureCodecValues until we use reflective enums
58enum CaptureCodec {
59 MJPG,
60 UYVY
61};
62
63
64//@formatter:off
65std::string AbslUnparseFlag(CaptureCodec codec);
66bool AbslParseFlag(absl::string_view text, CaptureCodec* codec, std::string* error);
67extern const std::vector<CaptureCodec> kCaptureCodecValues;
68extern const std::vector<std::string> kCaptureCodecNames;
69extern const std::string kCaptureCodecNameList;
70//@formatter:on
71// endregion ===========================================================================================================
72
73// region ========================================= EXPOSURE ===========================================================
74
76 int auto_exposure_on_value;
77 int auto_exposure_off_value;
78};
79
80constexpr int C920E_AUTO_EXPOSURE_ON_SETTING = 3;
81constexpr int C920E_AUTO_EXPOSURE_OFF_SETTING = 1;
82constexpr int CU30_AUTO_EXPOSURE_ON_SETTING = 0;
83constexpr int CU30_AUTO_EXPOSURE_OFF_SETTING = 1;
84constexpr int CU27_AUTO_EXPOSURE_ON_SETTING = 0;
85constexpr int CU27_AUTO_EXPOSURE_OFF_SETTING = 2;
86
87// endregion ===========================================================================================================
88
89} // namespace presage::camera
Definition camera.hpp:17