Skip to content

Class CameraInterface

ClassList > CameraInterface

Class in charge of interfacing with the camera through an API wrapper. More...

  • #include <cameraInterface.h>

Inherits the following classes: QObject

Public Attributes

Type Name
std::shared_ptr< XiAPIWrapper > m_apiWrapper
QMap< QString, DWORD > m_availableCameras
Map of available cameras.
std::unique_ptr< Camera > m_camera
std::unique_ptr< CameraFamily > m_cameraFamily
QString m_cameraFamilyName
HANDLE m_cameraHandle
The handle for managing the camera device.
QString m_cameraIdentifier
The variable m_cameraIdentifier represents the model of the camera being used.
int m_cameraIndex
QString m_cameraSN
QMap< QString, float > m_cameraTemperature = /* multi line expression */
The camera temperature data structure.
QString m_cameraType
The type of camera used for capturing images.

Public Functions

Type Name
CameraInterface ()
The CameraInterface class provides an interface for interacting with a camera.
void CloseDevice ()
Closes the device.
QStringList GetAvailableCameraIdentifiers ()
Retrieves a list of available camera identifiers.
QString GetCameraIdentifier (HANDLE cameraHandle) const
HANDLE GetHandle () const
Retrieves the handle associated with the current camera.
void Initialize (const std::shared_ptr< XiAPIWrapper > & apiWrapper)
int OpenDevice (DWORD cameraDeviceID)
Initializes a device with the specified camera ID.
void SetCamera (const QString & cameraType, const QString & cameraFamily)
void SetCameraIndex (int index)
Sets the camera index.
void SetCameraProperties (const QString & cameraModel)
Set the camera type.
void StartAcquisition (QString cameraIdentifier)
StartAcquisition function.
int StopAcquisition () const
Stops the acquisition process.
~CameraInterface ()
Destructor of camera interface.

Detailed Description

This class is in charge of initializing the communication with the cameras, start the image acquisition, and also stop it when required. At the same time, this class opens and closes the camera while checking if there are any available cameras, and how many of them.

Public Attributes Documentation

variable m_apiWrapper

std::shared_ptr<XiAPIWrapper> CameraInterface::m_apiWrapper;

Wrapper to xiAPI, useful for mocking the aPI during testing


variable m_availableCameras

Map of available cameras.

QMap<QString, DWORD> CameraInterface::m_availableCameras;

This variable represents the available cameras in the system. It is used to keep track of the number of cameras that can be accessed or used for capturing images or recording videos.

Note:

This variable value may change dynamically based on the currently connected cameras, their availability or any configuration changes.


variable m_camera

std::unique_ptr<Camera> CameraInterface::m_camera;

Custom camera object used to differentiate the actions that need to be taken into account across different types of cameras: gray scale, RGB and spectral. E.g. number of bands, etc.


variable m_cameraFamily

std::unique_ptr<CameraFamily> CameraInterface::m_cameraFamily;

Camera family used to identify the behaviour of different families: xiQ, xiSpec, xiC, etc. E.g. xiSpec support some API calls that xiC does not.


variable m_cameraFamilyName

QString CameraInterface::m_cameraFamilyName;

Camera family name, e.g. xiSpec, xiC, etc.


variable m_cameraHandle

The handle for managing the camera device.

HANDLE CameraInterface::m_cameraHandle;

This variable represents the handle used for managing the camera device. It is typically obtained from the camera API and is responsible for retrieving camera data, controlling camera parameters, and performing camera-related operations.

The handle is an opaque pointer that provides an abstraction layer for controlling the camera device. Users are strongly advised against modifying or accessing the handle directly.

The handle is used for various camera operations, such as opening and closing the camera, starting and stopping video recording, capturing images, and configuring camera settings. It should be properly initialized and released to prevent resource leaks and ensure proper functioning of the camera module.

See also: https://www.ximea.com/support/wiki/apis/xiapi_manual for more details on how to use the camera handle and its associated functions.

Note:

This variable should be properly initialized before use and released when no longer required to avoid resource leaks and ensure correct behavior of the camera module.


variable m_cameraIdentifier

The variable m_cameraIdentifier represents the model of the camera being used.

QString CameraInterface::m_cameraIdentifier;


variable m_cameraIndex

int CameraInterface::m_cameraIndex;

camera index in dropdown menu of GUI


variable m_cameraSN

QString CameraInterface::m_cameraSN;

Serial number of camera


variable m_cameraTemperature

The camera temperature data structure.

QMap<QString, float> CameraInterface::m_cameraTemperature;

This structure stores temperature values for various camera components. It uses a nested pair structure, where each element consists of a temperature type and its corresponding temperature value.

The temperature types are defined as follows: * CHIP_TEMP: Temperature of the camera chip * HOUSE_TEMP: Temperature inside the camera housing * HOUSE_BACK_TEMP: Temperature at the back of the camera housing * SENSOR_BOARD_TEMP: Temperature of the camera sensor board

The temperature values are of type double and represent the temperature in degrees Celsius.

Example usage:

// Accessing temperature values
double chipTemp = m_cameraTemperature[CHIP_TEMP];
double houseTemp = m_cameraTemperature[HOUSE_TEMP];

// Updating temperature values
m_cameraTemperature[CHIP_TEMP] = 35.7;
m_cameraTemperature[HOUSE_TEMP] = 28.2;

variable m_cameraType

The type of camera used for capturing images.

QString CameraInterface::m_cameraType;


Public Functions Documentation

function CameraInterface

The CameraInterface class provides an interface for interacting with a camera.

inline CameraInterface::CameraInterface () 

This class represents a camera interface that allows control over various camera functionalities such as capturing images, starting and stopping video recording, and adjusting camera settings.

The CameraInterface class does not include any example code or implementation details. It serves as a high-level documentation for the camera interface.


function CloseDevice

Closes the device.

void CameraInterface::CloseDevice () 

This function closes the opened device. It performs necessary cleanup and frees any resources used by the device.

Note:

Before calling this function, the device should be opened using the OpenDevice() function.

See also: OpenDevice()


function GetAvailableCameraIdentifiers

Retrieves a list of available camera identifiers.

QStringList CameraInterface::GetAvailableCameraIdentifiers () 

This function retrieves a list of available camera identifiers that can be used with the application. The returned list contains the names of the camera models and sensor serial number according to the pattern: camera_model@sensorSN

Returns:

QList<QString> A vector of strings representing the available camera models and their ID in the system.


function GetCameraIdentifier

QString CameraInterface::GetCameraIdentifier (
    HANDLE cameraHandle
) const

Given a camera handle, it constructs a camera identifier based on the model and the sensor serial number.

Parameters:

  • cameraHandle Handle of the camera, it should be a valid handle initialized by xiOpenDevice.

Returns:

camera identifier in the format camera_model@sensorSN.


function GetHandle

Retrieves the handle associated with the current camera.

HANDLE CameraInterface::GetHandle () const

This function retrieves the handle, which represents a unique identifier associated with the current camera.

Returns:

The handle associated with the current object.


function Initialize

void CameraInterface::Initialize (
    const std::shared_ptr< XiAPIWrapper > & apiWrapper
) 

Check if XIMEA cameras are connected and counts them


function OpenDevice

Initializes a device with the specified camera ID.

int CameraInterface::OpenDevice (
    DWORD cameraDeviceID
) 

This function opens a device with the specified camera device ID associated by XiAPI.

Parameters:

  • cameraDeviceID The device ID assigned by XiAPI to the camera.

Returns:

0 if the device was successfully opened, 1 otherwise.


function SetCamera

void CameraInterface::SetCamera (
    const QString & cameraType,
    const QString & cameraFamily
) 

function SetCameraIndex

Sets the camera index.

void CameraInterface::SetCameraIndex (
    int index
) 

This function sets the camera index as appeared in the ComboBox of the GUI

Parameters:

  • index The index of the camera to be set.

function SetCameraProperties

Set the camera type.

void CameraInterface::SetCameraProperties (
    const QString & cameraModel
) 

This function is used to set the camera type for further processing. The camera type is specified using a QString parameter which should contain the appropriate camera type.

Parameters:

  • cameraModel A QString specifying the camera type.

function StartAcquisition

StartAcquisition function.

void CameraInterface::StartAcquisition (
    QString cameraIdentifier
) 

This function starts the acquisition process for a specified camera.

Parameters:

  • cameraIdentifier The deviceID used by XiAPI to open the device.

function StopAcquisition

Stops the acquisition process.

int CameraInterface::StopAcquisition () const

This function is used to stop the ongoing acquisition process. It ensures that all resources are properly released and the acquisition is halted.

See also: StartAcquisition


function ~CameraInterface

Destructor of camera interface.

CameraInterface::~CameraInterface () 



The documentation for this class was generated from the following file src/cameraInterface.h