14#include <absl/status/status.h>
15#include <absl/status/statusor.h>
16#include <physiology/modules/messages/status.h>
17#include <mediapipe/framework/port/opencv_core_inc.h>
20#include "video_source.hpp"
21#include "camera_tuner_settings.hpp"
38namespace presage::smartspectra::video_source {
43enum class TuningStage {
135 absl::Status
ProcessFrame(presage::physiology::StatusCode status_code,
136 int64_t frame_timestamp);
173 std::shared_ptr<VideoSource> video_source_;
180 bool supports_white_balance_;
182 int wb_frame_counter_;
184 double locked_white_balance_;
188 double current_exposure_;
190 int exposure_iteration_count_;
192 int64_t last_frame_timestamp_;
194 double current_framerate_;
196 int exposure_settle_frame_count_;
200 double current_gain_;
202 int gain_iteration_count_;
204 int gain_settle_frame_count_;
210 absl::Status ProcessAutoWhiteBalanceStage();
218 absl::Status ProcessExposureSearchStage(presage::physiology::StatusCode status_code,
219 int64_t frame_timestamp);
226 absl::Status ProcessGainSearchStage(presage::physiology::StatusCode status_code);
232 absl::Status ValidateVideoSourceControls();
absl::StatusOr< double > GetTunedGain() const
Get the tuned gain value.
Definition camera_tuner.cpp:111
absl::Status ProcessFrame(presage::physiology::StatusCode status_code, int64_t frame_timestamp)
Process a frame during tuning (synchronous mode).
Definition camera_tuner.cpp:86
bool IsTuning() const
Check if tuning is currently in progress.
Definition camera_tuner.cpp:76
CameraTuner(CameraTunerSettings settings={})
Construct a camera tuner with specified settings.
Definition camera_tuner.cpp:17
absl::Status StartTuning()
Start the tuning process.
Definition camera_tuner.cpp:47
TuningStage GetCurrentStage() const
Get the current tuning stage.
Definition camera_tuner.cpp:82
cv::Mat ProcessFrameForDisplay(const cv::Mat &frame) const
Process a frame for display with optional camera tuning overlay.
Definition camera_tuner.cpp:372
absl::Status SetVideoSource(std::shared_ptr< VideoSource > source)
Set the video source to tune.
Definition camera_tuner.cpp:34
absl::StatusOr< double > GetTunedWhiteBalance() const
Get the tuned white balance value.
Definition camera_tuner.cpp:118
absl::StatusOr< double > GetTunedExposure() const
Get the tuned exposure value.
Definition camera_tuner.cpp:104
std::shared_ptr< VideoSource > GetVideoSource()
Get shared pointer to the video source.
Definition camera_tuner.cpp:43
Configuration parameters for the camera tuning process.
Definition camera_tuner_settings.hpp:14