MAClient/src/cameras.h
uvos b9b4b0fc2a fix various bugs
add commandline parser for various options
allow cameras to be operated in serial fashion
allow disabeling of quirks
allow changing of Photonfocus quirk timeings
2021-07-08 11:24:19 +02:00

80 lines
1.9 KiB
C++

#ifndef CAMERAS_H
#define CAMERAS_H
#include <QObject>
#include <vector>
#include <uvoscam.h>
#include <uvosled.h>
#include <memory.h>
#include <stdint.h>
#include <QSettings>
#include <opencv2/core/mat.hpp>
#include <QTimer>
#include "profile.h"
#include "camera.h"
class Cameras : public QObject
{
Q_OBJECT
static constexpr const char* GROUP = "Cameras";
private:
uvosled* led_;
bool free_ = false;
bool disable_ = false;
double exposrueTime_ = 1.0/60.0;
uint64_t blockCaptureId_ = 0;
LightingSetup lighting_;
std::vector<std::shared_ptr<Camera>> cameras_;
std::vector<Camera::Image> images_;
size_t captureingCamera = 0;
QTimer ledTimer;
QTimer cameraFailureTimer;
bool quirks_;
bool serial_;
bool lightFor(const LightingSetup& lighting, double time);
private slots:
void imageRecived(Camera::Image img);
void finishAddCamera(std::shared_ptr<Camera> camera);
void lightOff();
signals:
void cameraRemoved(std::shared_ptr<Camera> camera);
void cameraAdded(std::shared_ptr<Camera> camera);
void newImages(std::vector<Camera::Image> images);
void enableCapture(bool enable);
public slots:
bool setExposureTime(double exposureTime);
void trigger();
bool start();
bool stop();
bool setFree(bool free);
void setLighting(const LightingSetup& lighting) {lighting_ = lighting;}
void reloadCameras();
public:
Cameras(uvosled* led = nullptr, bool quirks = true, bool serial = false);
~Cameras();
bool setCameras(const std::vector<cam::Camera::Description>& descriptions);
bool addCamera(const cam::Camera::Description& desc);
void setSetup(const std::vector<CameraSetup>& setups);
std::vector<cam::Camera::Description> getCameras();
std::shared_ptr<Camera> getCamera(size_t id);
size_t numCameras(){return cameras_.size();}
void clear();
double getMeanTemp();
void load(QSettings& settings);
void store(QSettings& settings);
void disable(bool disable);
inline static float quirkTime = 3;
};
#endif // CAMERAS_H