esp32cam
OV2640 camera on ESP32-CAM
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
esp32cam::CameraClass Class Reference

#include <camera.hpp>

Public Member Functions

bool begin (const Config &config)
 Enable camera. More...
 
bool end ()
 Disable camera. More...
 
ResolutionList listResolutions () const
 Retrieve list of resolutions (likely) supported by hardware. More...
 
bool changeResolution (const Resolution &resolution, int sleepFor=500)
 Change camera resolution. More...
 
Settings status () const
 Retrieve runtime settings. More...
 
bool update (const Settings &settings, int sleepFor=0)
 Update runtime settings. More...
 
template<typename Fn >
std::enable_if_t< std::is_assignable_v< std::function< void(Settings &)>, Fn >, bool > update (const Fn &modifier, int sleepFor=0)
 Update runtime settings using modifier function. More...
 
std::unique_ptr< Framecapture ()
 Capture a frame of picture. More...
 
int streamMjpeg (Client &client, const MjpegConfig &cfg=MjpegConfig())
 Stream Motion JPEG. More...
 

Member Function Documentation

◆ begin()

bool esp32cam::CameraClass::begin ( const Config config)

Enable camera.

Returns
whether success.

◆ capture()

std::unique_ptr< Frame > esp32cam::CameraClass::capture ( )

Capture a frame of picture.

Precondition
Camera is enabled.
Returns
the picture frame, or nullptr on error.

◆ changeResolution()

bool esp32cam::CameraClass::changeResolution ( const Resolution resolution,
int  sleepFor = 500 
)

Change camera resolution.

Precondition
Camera is enabled.
Parameters
resolutionnew resolution; must be no higher than initial resolution.
sleepForhow long to wait for stabilization (millis).
Deprecated:
Use update instead.

◆ end()

bool esp32cam::CameraClass::end ( )

Disable camera.

Returns
whether success.

◆ listResolutions()

ResolutionList esp32cam::CameraClass::listResolutions ( ) const

Retrieve list of resolutions (likely) supported by hardware.

Precondition
Camera is enabled.

◆ status()

Settings esp32cam::CameraClass::status ( ) const

Retrieve runtime settings.

Precondition
Camera is enabled.

◆ streamMjpeg()

int esp32cam::CameraClass::streamMjpeg ( Client &  client,
const MjpegConfig cfg = MjpegConfig() 
)

Stream Motion JPEG.

Precondition
The camera has been initialized to JPEG mode.
Returns
number of frames streamed.

◆ update() [1/2]

template<typename Fn >
std::enable_if_t<std::is_assignable_v<std::function<void(Settings&)>, Fn>, bool> esp32cam::CameraClass::update ( const Fn &  modifier,
int  sleepFor = 0 
)
inline

Update runtime settings using modifier function.

Parameters
modifierfunction to modify settings.
sleepForhow long to wait for stabilization (millis).
Precondition
Camera is enabled.
Postcondition
Camera may be left in inconsistent state in case of failure.
Returns
whether success.

◆ update() [2/2]

bool esp32cam::CameraClass::update ( const Settings settings,
int  sleepFor = 0 
)

Update runtime settings.

Parameters
settingsupdated settings.
sleepForhow long to wait for stabilization (millis).
Precondition
Camera is enabled.
Postcondition
Camera may be left in inconsistent state in case of failure.
Returns
whether success.

The documentation for this class was generated from the following files: