Overview
The FujiSxCamera C++ library is a software controller for Fujifilm long-range surveillance cameras in the SX Series. Fujifilm SX cameras are block cameras that combine lens and camera (image sensor), and provide one control interface (serial port). The FujiSxCamera library supports Fuji SX800 and SX1600 models. The library inherits interfaces from Lens and Camera. It depends on libraries: Lens (provides interface and data structures to control lenses, source code included, Apache 2.0 license), Camera (provides interface and data structures to control cameras, source code included, Apache 2.0 license), Logger (provides functions to print logs, source code included, Apache 2.0 license), SerialPort (provides functions to work with serial ports, source code included, Apache 2.0 license), and FujiSxParser (provides functions to encode control commands and decode responses from Fujifilm SX cameras). The FujiSxCamera library provides a simple interface to be integrated into any C++ project. The library doesn’t have third-party dependencies that need to be specially installed in the OS. It is developed with the C++17 standard and is compatible with Linux and Windows.
Documentation
Documentation: GO TO DOCUMENTATION
Lens + camera control interface
namespace cr
{
namespace fuji
{
class FujiSxCamera : public cr::camera::Camera, public cr::lens::Lens
{
public:
/// Class destructor.
~FujiSxCamera();
/// Get class version.
static std::string getVersion();
/// Decode and execute command.
bool decodeAndExecuteCommand(uint8_t* data, int size) override;
// #######################################
// CAMERA CONTROL INTERFACE
// #######################################
/// Open controller serial port.
bool openCamera(std::string initString) override;
/// Init camera by parameters structure.
bool initCamera(cr::camera::CameraParams& params) override;
/// Close controller.
void closeCamera() override;
/// Get serial port open status.
bool isCameraOpen() override;
/// Get camera connection status.
bool isCameraConnected() override;
/// Set the camera parameter.
bool setParam(cr::camera::CameraParam id, float value) override;
/// Get the camera parameter.
float getParam(cr::camera::CameraParam id) override;
/// Get the camera params.
void getParams(cr::camera::CameraParams& params) override;
/// Execute camera command.
bool executeCommand(cr::camera::CameraCommand id) override;
// #######################################
// LENS CONTROL INTERFACE
// #######################################
/// Open controller serial port.
bool openLens(std::string initString) override;
/// Init lens by parameters structure.
bool initLens(cr::lens::LensParams& params) override;
/// Close controller.
void closeLens() override;
/// Get serial port open status.
bool isLensOpen() override;
/// Get camera connection status.
bool isLensConnected() override;
/// Set the lens parameter.
bool setParam(cr::lens::LensParam id, float value) override;
/// Get the lens parameter.
float getParam(cr::lens::LensParam id) override;
/// Get the lens params.
void getParams(cr::lens::LensParams& params) override;
/// Execute lens command.
bool executeCommand(cr::lens::LensCommand id, float arg = 0) override;
/// Not supported.
void addVideoFrame(cr::video::Frame& frame) override;
};
}
}
Simple example
#include <iostream>
#include "FujiSxCamera.h"
int main(void)
{
// Init camera controller.
cr::fuji::FujiSxCamera controller;
if (!controller.openCamera("/dev/ttyUSB0"))
return -1;
while (true)
{
// Main dialog.
int option = -1;
std::cout << "Options (1:Zoom tele, 2:Zoom wide, " <<
"3:Zoom stop), 4:Brightness+1, 5:Brightness-1 : ";
std::cin >> option;
// Get all camera params.
cr::camera::CameraParams cameraParams;
controller.getParams(cameraParams);
// Get all lens params.
cr::lens::LensParams lensParams;
controller.getParams(lensParams);
switch (option)
{
case 1: // Zoom tele.
controller.executeCommand(cr::lens::LensCommand::ZOOM_TELE);
break;
case 2: // Zoom wide.
controller.executeCommand(cr::lens::LensCommand::ZOOM_WIDE);
break;
case 3: // Zoom stop.
controller.executeCommand(cr::lens::LensCommand::ZOOM_STOP);
break;
case 4:
controller.setParam(cr::camera::CameraParam::BRIGHTNESS,
cameraParams.brightness + 1);
break;
case 5:
controller.setParam(cr::camera::CameraParam::BRIGHTNESS,
cameraParams.brightness - 1);
break;
default:
break;
}
}
return 1;
}

