This commit is contained in:
2026-01-12 00:53:54 +01:00
commit 2f827c168d
26 changed files with 3145 additions and 0 deletions

31
include/camera_service.h Normal file
View File

@@ -0,0 +1,31 @@
#pragma once
#include "esp_camera.h"
class CameraService {
public:
class Frame {
camera_fb_t* fb;
public:
Frame(camera_fb_t* _fb) : fb(_fb) {}
~Frame() {
if (fb) {
esp_camera_fb_return(fb);
}
}
Frame(const Frame&) = delete;
Frame& operator=(const Frame&) = delete;
Frame(Frame&& other) noexcept : fb(other.fb) {
other.fb = nullptr;
}
bool isValid() const { return fb != nullptr; }
uint8_t* getData() const { return fb ? fb->buf : nullptr; }
size_t getWidth() const { return fb ? fb->width : 0; }
size_t getHeight() const { return fb ? fb->height : 0; }
size_t getLength() const { return fb ? fb->len : 0; }
};
static void init();
static Frame capture();
};