fwt_software/include/fgc/VimbaCameraSource.h

50 lines
1.7 KiB
C++

#pragma once
#include "fgc/Config.h"
#include "fgc/ICameraSource.h"
#include <memory>
namespace fgc {
// Real camera source backed by the Allied Vision Vimba X SDK (VmbCPP). Opens the
// cameras in CameraConfig and applies the on-camera imaging settings in-session.
//
// Two acquisition modes, chosen with setAcquisitionMode() before start():
// TRIGGERED (default) - TriggerMode=On + TriggerSource=Software. acquireFrame()
// fires one TriggerSoftware and returns that frame, so the image belongs to the
// waypoint that asked for it and its exposure can be set deliberately.
// FREE-RUN - a paced low-rate stream; trigger() hands over the latest complete
// frame, restarting acquisition if the stream has stalled. Kept as a fallback.
// Encode/save lives in ImagePipeline; quality gating lives in GatedCameraSource.
class VimbaCameraSource : public ICameraSource {
public:
explicit VimbaCameraSource(CameraConfig config);
~VimbaCameraSource() override;
// Must be called before start() to take effect (features are applied there).
void setAcquisitionMode(bool triggered, bool manual_exposure);
void open() override;
void close() override;
void start() override;
void stop() override;
bool trigger() override;
bool setFrameRate(double fps) override;
void setFrameCallback(FrameCallback cb) override;
int cameraCount() const override;
std::vector<CameraDeviceInfo> deviceInfo() override;
bool acquireFrame(Frame& out, int timeout_ms) override;
bool setExposure(double us) override;
bool setGain(double db) override;
bool setAutoExposureGain(bool on) override;
double currentGain() override;
private:
struct Impl;
std::unique_ptr<Impl> impl_;
};
} // namespace fgc