diff options
Diffstat (limited to 'src/camera')
| -rw-r--r-- | src/camera/innomakerov9281.h | 13 | ||||
| -rw-r--r-- | src/camera/ov9281.cpp | 5 | ||||
| -rw-r--r-- | src/camera/ov9281.h | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/src/camera/innomakerov9281.h b/src/camera/innomakerov9281.h index bcafc12..51485cb 100644 --- a/src/camera/innomakerov9281.h +++ b/src/camera/innomakerov9281.h @@ -5,7 +5,14 @@ #include "constants.h" #include "image.h" -class InnoMakerOV9281 +class ICamera +{ +public: + virtual bool setExposureTimeMs(int value) = 0; + virtual bool setGain(int value) = 0; +}; + +class InnoMakerOV9281 : public ICamera { public: using buffer_t = std::array<uint8_t, img_size>; @@ -17,8 +24,8 @@ public: public: bool init(); - bool setExposureTimeMs(int value); - bool setGain(int value); + bool setExposureTimeMs(int value) override; + bool setGain(int value) override; bool getImage(Image &image); diff --git a/src/camera/ov9281.cpp b/src/camera/ov9281.cpp index b76ecdd..48f445f 100644 --- a/src/camera/ov9281.cpp +++ b/src/camera/ov9281.cpp @@ -189,7 +189,7 @@ void OV9281::onRequestCompleted(libcamera::Request *completed_request) .planes()[i]; size_t size = std::min(metaplane.bytesused, plane.length); - std::cout << "size is: " << size << std::endl; + // std::cout << "size is: " << size << std::endl; void *data = m_mappedBuffers[plane.fd.get()].first; auto img = std::make_shared<Image>(); @@ -204,7 +204,8 @@ void OV9281::onRequestCompleted(libcamera::Request *completed_request) img->counters.timestampUs = metadata.timestamp / 1000; img->counters.encoderPosition = RotaryEncoder::instance()->position(); - memcpy(img->data, data, size); + img->copyFromData(data, size); + // memcpy(img->data, data, size); img->rotate(); auto pixels = img->pixels(); diff --git a/src/camera/ov9281.h b/src/camera/ov9281.h index e989d96..1f2011a 100644 --- a/src/camera/ov9281.h +++ b/src/camera/ov9281.h @@ -65,5 +65,5 @@ private: std::unique_ptr<libcamera::FrameBufferAllocator> m_allocator{nullptr}; // TODO: set exposureTime from outside - int32_t m_exposureTime{100}; + int32_t m_exposureTime{3000}; }; |
