Overview
The FlirTau2Camera C++ library is a software controller for Flir Tau 2 camera. The FlirTau2Camera library inherits Camera interface. It depends on libraries: Camera interface library (provides interface and data structures to control cameras, source code included, Apache 2.0 license), Logger logging library (provides function to print log information in console and files, source code included, Apache 2.0 license), SerialPort library (provides functions to work with serial ports, source code included, Apache 2.0 license) and FlirTau2Parser (provides functions to encode / decode commands and responses from camera, source code included). The FlirTau2Camera library provides simple interface to be integrated in any C++ project. The library repository (folder) is provided by source code and doesn’t have third-party dependencies to be specially installed in OS. It built C++17 standard and compatible with Linux and Windows.
Documentation
Documentation: GO TO DOCUMENTATION
Camera control interface
class IRayFtCamera : public cr::camera::Camera
{
public:
/// Get Camera class version.
static std::string getVersion();
/// Init camera controller.
bool openCamera(std::string initString) override;
/// Init camera controller by parameters class.
bool initCamera(CameraParams& params) override;
/// Close camera serial port.
void closeCamera() override;
/// Get camera connection status.
bool isCameraOpen() override;
/// Get camera open status.
bool isCameraConnected() override;
/// Set the camera controller param.
bool setParam(CameraParam id, float value) override;
/// Get the camera controller param.
float getParam(CameraParam id) override;
/// Get the camera controller params.
void getParams(CameraParams& params) override;
/// Execute camera controller action command.
bool executeCommand(CameraCommand id) override;
/// Decode and execute command.
bool decodeAndExecuteCommand(uint8_t* data, int size) override;
};
Simple example
#include <iostream>
#include "IRayFtCamera.h"
using namespace std;
using namespace cr::camera;
/// Pointer to camera controller.
Camera* g_camera{nullptr};
int main(void)
{
string portName = "/dev/ttyUSB0";
int baudrate = 57600;
// Init camera controller.
IRayFtCamera* controller = new IRayFtCamera();
// Open camera.
g_camera = controller;
if (!g_camera->openCamera(portName + ";" + to_string(baudrate)))
{
cout << "ERROR: Camera controller not init. Exit..." << endl;
std::this_thread::sleep_for(std::chrono::seconds(1));
return -1;
}
// Set logging mode.
g_camera->setParam(CameraParam::LOG_MODE, 2);
// Set brightness.
g_camera->setParam(CameraParam::BRIGHTNESS, 50);
// Set contrast.
g_camera->setParam(CameraParam::CONTRAST, 50);
// Get camera params.
CameraParams params;
if (!g_camera->getParams(params))
{
cout << "ERROR: Can't get camera params" << endl;
return -1;
}
// Get brightness.
cout << "Brightness: " << g_camera->getParam(CameraParam::BRIGHTNESS) << endl;
return 1;
}