SmartSpectra C++ SDK
Measure human vitals from video with SmartSpectra C++ SDK.
Loading...
Searching...
No Matches
presage::smartspectra::video_source::v4l2::V4l2CameraSource Class Reference

#include <v4l2_camera_source.hpp>

Inheritance diagram for presage::smartspectra::video_source::v4l2::V4l2CameraSource:
presage::smartspectra::video_source::VideoSource

Public Member Functions

 V4l2CameraSource (const V4l2CameraSource &)=delete
V4l2CameraSourceoperator= (const V4l2CameraSource &)=delete
 V4l2CameraSource (V4l2CameraSource &&)=delete
V4l2CameraSourceoperator= (V4l2CameraSource &&)=delete
absl::Status Initialize (const VideoSourceSettings &settings) override
int GetWidth () override
int GetHeight () override
void ProducePreTransformFrame (cv::Mat &frame) override
bool SupportsExactFrameTimestamp () const override
int64_t GetFrameTimestamp () const override
absl::Status TurnOnAutoExposure () override
 Enable automatic exposure mode.
absl::Status TurnOffAutoExposure () override
 Disable automatic exposure and switch to manual mode.
absl::Status ToggleAutoExposure () override
 Toggle between automatic and manual exposure modes.
absl::StatusOr< bool > IsAutoExposureOn () override
 Check if automatic exposure is currently enabled.
absl::Status IncreaseExposure () override
 Increase exposure by a fixed hardware-specific step.
absl::Status DecreaseExposure () override
 Decrease exposure by a fixed hardware-specific step.
absl::Status SetExposure (double value) override
 Set exposure to a normalized value.
absl::StatusOr< double > GetExposure () override
 Get current exposure as a normalized value.
bool SupportsExposureControls () override
 Check if this video source supports exposure controls.
bool SupportsWhiteBalanceControls () override
 Check if this video source supports white balance controls.
absl::Status TurnOnAutoWhiteBalance () override
 Enable automatic white balance mode.
absl::Status TurnOffAutoWhiteBalance () override
 Disable automatic white balance and switch to manual mode.
absl::Status ToggleAutoWhiteBalance () override
 Toggle between automatic and manual white balance modes.
absl::StatusOr< bool > IsAutoWhiteBalanceOn () override
 Check if automatic white balance is currently enabled.
absl::Status IncreaseWhiteBalance () override
 Increase white balance temperature by a fixed hardware-specific step.
absl::Status DecreaseWhiteBalance () override
 Decrease white balance temperature by a fixed hardware-specific step.
absl::Status SetWhiteBalance (double value) override
 Set white balance temperature to a normalized value.
absl::StatusOr< double > GetWhiteBalance () override
 Get current white balance temperature as a normalized value.
bool SupportsGainControl () override
 Check if this video source supports gain controls.
absl::Status IncreaseGain () override
 Increase gain by a fixed hardware-specific step.
absl::Status DecreaseGain () override
 Decrease gain by a fixed hardware-specific step.
absl::Status SetGain (double value) override
 Set gain to a normalized value.
absl::StatusOr< double > GetGain () override
 Get current gain as a normalized value.
bool SupportsCompressedOutput () override
bool ProduceCompressedFrame (std::vector< uint8_t > &jpeg_data) override
InputTransformMode GetDefaultInputTransformMode () override
Public Member Functions inherited from presage::smartspectra::video_source::VideoSource
VideoSourceoperator>> (cv::Mat &frame)
bool HasFrameDimensions ()

Additional Inherited Members

Protected Attributes inherited from presage::smartspectra::video_source::VideoSource
InputTransformer input_transformer

Detailed Description

Video source that uses direct v4l2 API for camera capture on Linux. Provides full control over camera settings including exposure and format. Supports zero-copy compressed MJPEG output when available.

Member Function Documentation

◆ DecreaseExposure()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::DecreaseExposure ( )
overridevirtual

Decrease exposure by a fixed hardware-specific step.

Returns
Status indicating success or failure.
Note
Only works in manual exposure mode.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ DecreaseGain()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::DecreaseGain ( )
overridevirtual

Decrease gain by a fixed hardware-specific step.

Returns
Status indicating success or failure.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ DecreaseWhiteBalance()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::DecreaseWhiteBalance ( )
overridevirtual

Decrease white balance temperature by a fixed hardware-specific step.

Returns
Status indicating success or failure.
Note
Only works in manual white balance mode.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ GetDefaultInputTransformMode()

InputTransformMode presage::smartspectra::video_source::v4l2::V4l2CameraSource::GetDefaultInputTransformMode ( )
overridevirtual

◆ GetExposure()

absl::StatusOr< double > presage::smartspectra::video_source::v4l2::V4l2CameraSource::GetExposure ( )
overridevirtual

Get current exposure as a normalized value.

Returns
StatusOr containing normalized exposure value in range [0.0, 1.0].
Note
Hardware values are automatically normalized for consistent API.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ GetFrameTimestamp()

int64_t presage::smartspectra::video_source::v4l2::V4l2CameraSource::GetFrameTimestamp ( ) const
overridevirtual

return the current frame's timestamp, in microseconds

Implements presage::smartspectra::video_source::VideoSource.

◆ GetGain()

absl::StatusOr< double > presage::smartspectra::video_source::v4l2::V4l2CameraSource::GetGain ( )
overridevirtual

Get current gain as a normalized value.

Returns
StatusOr containing normalized gain value in range [0.0, 1.0].
Note
Hardware gain values are automatically normalized for consistent API.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ GetHeight()

int presage::smartspectra::video_source::v4l2::V4l2CameraSource::GetHeight ( )
overridevirtual

◆ GetWhiteBalance()

absl::StatusOr< double > presage::smartspectra::video_source::v4l2::V4l2CameraSource::GetWhiteBalance ( )
overridevirtual

Get current white balance temperature as a normalized value.

Returns
StatusOr containing normalized white balance value in range [0.0, 1.0].
Note
Hardware temperature values are automatically normalized for consistent API.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ GetWidth()

int presage::smartspectra::video_source::v4l2::V4l2CameraSource::GetWidth ( )
overridevirtual

◆ IncreaseExposure()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::IncreaseExposure ( )
overridevirtual

Increase exposure by a fixed hardware-specific step.

Returns
Status indicating success or failure.
Note
Only works in manual exposure mode.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ IncreaseGain()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::IncreaseGain ( )
overridevirtual

Increase gain by a fixed hardware-specific step.

Returns
Status indicating success or failure.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ IncreaseWhiteBalance()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::IncreaseWhiteBalance ( )
overridevirtual

Increase white balance temperature by a fixed hardware-specific step.

Returns
Status indicating success or failure.
Note
Only works in manual white balance mode.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ Initialize()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::Initialize ( const VideoSourceSettings & settings)
overridevirtual

Configure the source with provided settings.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ IsAutoExposureOn()

absl::StatusOr< bool > presage::smartspectra::video_source::v4l2::V4l2CameraSource::IsAutoExposureOn ( )
overridevirtual

Check if automatic exposure is currently enabled.

Returns
StatusOr containing true if auto exposure is on, false otherwise.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ IsAutoWhiteBalanceOn()

absl::StatusOr< bool > presage::smartspectra::video_source::v4l2::V4l2CameraSource::IsAutoWhiteBalanceOn ( )
overridevirtual

Check if automatic white balance is currently enabled.

Returns
StatusOr containing true if auto white balance is on, false otherwise.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ ProduceCompressedFrame()

bool presage::smartspectra::video_source::v4l2::V4l2CameraSource::ProduceCompressedFrame ( std::vector< uint8_t > & jpeg_data)
overridevirtual

Get the next frame as compressed JPEG data (if supported). Only call this if SupportsCompressedOutput() returns true.

Parameters
jpeg_dataOutput buffer for compressed JPEG data
Returns
true if a compressed frame was successfully retrieved

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ ProducePreTransformFrame()

void presage::smartspectra::video_source::v4l2::V4l2CameraSource::ProducePreTransformFrame ( cv::Mat & frame)
overridevirtual

◆ SetExposure()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::SetExposure ( double value)
overridevirtual

Set exposure to a normalized value.

Parameters
valueNormalized exposure value in range [0.0, 1.0] where 0.0 is minimum and 1.0 is maximum.
Returns
Status indicating success or failure.
Note
Values are automatically mapped to hardware-specific ranges.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ SetGain()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::SetGain ( double value)
overridevirtual

Set gain to a normalized value.

Parameters
valueNormalized gain value in range [0.0, 1.0] where 0.0 is minimum and 1.0 is maximum.
Returns
Status indicating success or failure.
Note
Values are automatically mapped to hardware-specific gain ranges.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ SetWhiteBalance()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::SetWhiteBalance ( double value)
overridevirtual

Set white balance temperature to a normalized value.

Parameters
valueNormalized white balance value in range [0.0, 1.0] where 0.0 is coolest and 1.0 is warmest.
Returns
Status indicating success or failure.
Note
Values are automatically mapped to hardware-specific temperature ranges (typically 2800K-6500K).

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ SupportsCompressedOutput()

bool presage::smartspectra::video_source::v4l2::V4l2CameraSource::SupportsCompressedOutput ( )
overridevirtual

Check if this video source can provide compressed JPEG frames directly. This allows bypassing recompression when the source already provides MJPEG.

Returns
true if ProduceCompressedFrame() is supported

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ SupportsExactFrameTimestamp()

bool presage::smartspectra::video_source::v4l2::V4l2CameraSource::SupportsExactFrameTimestamp ( ) const
overridevirtual

◆ SupportsExposureControls()

bool presage::smartspectra::video_source::v4l2::V4l2CameraSource::SupportsExposureControls ( )
overridevirtual

Check if this video source supports exposure controls.

Returns
true if exposure controls are available, false otherwise.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ SupportsGainControl()

bool presage::smartspectra::video_source::v4l2::V4l2CameraSource::SupportsGainControl ( )
overridevirtual

Check if this video source supports gain controls.

Returns
true if gain controls are available, false otherwise.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ SupportsWhiteBalanceControls()

bool presage::smartspectra::video_source::v4l2::V4l2CameraSource::SupportsWhiteBalanceControls ( )
overridevirtual

Check if this video source supports white balance controls.

Returns
true if white balance controls are available, false otherwise.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ ToggleAutoExposure()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::ToggleAutoExposure ( )
overridevirtual

Toggle between automatic and manual exposure modes.

Returns
Status indicating success or failure.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ ToggleAutoWhiteBalance()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::ToggleAutoWhiteBalance ( )
overridevirtual

Toggle between automatic and manual white balance modes.

Returns
Status indicating success or failure.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ TurnOffAutoExposure()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::TurnOffAutoExposure ( )
overridevirtual

Disable automatic exposure and switch to manual mode.

Returns
Status indicating success or failure.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ TurnOffAutoWhiteBalance()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::TurnOffAutoWhiteBalance ( )
overridevirtual

Disable automatic white balance and switch to manual mode.

Returns
Status indicating success or failure.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ TurnOnAutoExposure()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::TurnOnAutoExposure ( )
overridevirtual

Enable automatic exposure mode.

Returns
Status indicating success or failure.

Reimplemented from presage::smartspectra::video_source::VideoSource.

◆ TurnOnAutoWhiteBalance()

absl::Status presage::smartspectra::video_source::v4l2::V4l2CameraSource::TurnOnAutoWhiteBalance ( )
overridevirtual

Enable automatic white balance mode.

Returns
Status indicating success or failure.

Reimplemented from presage::smartspectra::video_source::VideoSource.


The documentation for this class was generated from the following files:
  • smartspectra/video_source/camera/v4l2_camera_source.hpp
  • smartspectra/video_source/camera/v4l2_camera_source.cpp