Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add viewer tab for recorded arrays #40

Merged
merged 12 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

-
- Adds image viewer tab to open recorded .b2nd files and scroll over images.
- Adds missing camera models to JSON file.

### Changed

-
- All displaying operations run from a thread, and only calls the main thread when the process images are to be displayed.
- Restructures UI for a more clear use and structures controls inside a toolbox.
- Limits frequency at which images are displayed to avoid locking the UI. Images are still recorded at full speed.

### Removed

Expand Down
6 changes: 6 additions & 0 deletions resources/XiLensCameraProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,12 @@
"mosaicWidth": 0,
"mosaicHeight": 0
},
"MQ042CG-CM": {
"cameraType": "rgb",
"cameraFamily": "xiQ",
"mosaicWidth": 0,
"mosaicHeight": 0
},
"MQ042CG-CM-S7": {
"cameraType": "rgb",
"cameraFamily": "xiQ",
Expand Down
9 changes: 8 additions & 1 deletion resources/dark_amber.css
Original file line number Diff line number Diff line change
Expand Up @@ -814,17 +814,24 @@ QMenuBar::item:pressed {

QToolBox::tab {
background-color: #232629;
color: #ffffff;
color: #ffd740;
text-transform: uppercase;
border-radius: 4px;
padding-left: 15px;
font-weight: bold;
}

QToolBox::tab:selected,
QToolBox::tab:hover {
background-color: rgba(255, 215, 64, 0.2);
}

QToolBox::tab:disabled {
color: rgba(79, 91, 98, 0.75);
background-color: rgba(35, 38, 41, 0.3);
border-color: #4f5b62;
}

/* ------------------------------------------------------------------------ */
/* QProgressBar */

Expand Down
8 changes: 4 additions & 4 deletions src/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void CameraFamily::UpdateCameraTemperature()
{
}

QMap<QString, float> CameraFamily::getCameraTemperature()
QMap<QString, float> CameraFamily::GetCameraTemperature()
{
return this->m_cameraTemperature;
}
Expand Down Expand Up @@ -131,7 +131,7 @@ int RGBCamera::InitializeCamera()

void XiSpecFamily::UpdateCameraTemperature()
{
boost::lock_guard<boost::mutex> guard(this->mtx_);
boost::lock_guard<boost::mutex> guard(this->m_mutexCameraTemperature);
float chipTemp, houseTemp, houseBackSideTemp, sensorBoardTemp;

this->m_apiWrapper->xiGetParamFloat(*m_cameraHandle, XI_PRM_CHIP_TEMP, &chipTemp);
Expand All @@ -146,15 +146,15 @@ void XiSpecFamily::UpdateCameraTemperature()

void XiCFamily::UpdateCameraTemperature()
{
boost::lock_guard<boost::mutex> guard(this->mtx_);
boost::lock_guard<boost::mutex> guard(this->m_mutexCameraTemperature);
float sensorBoardTemp;
this->m_apiWrapper->xiGetParamFloat(*m_cameraHandle, XI_PRM_SENSOR_BOARD_TEMP, &sensorBoardTemp);
this->m_cameraTemperature[SENSOR_BOARD_TEMP] = sensorBoardTemp;
}

void XiQFamily::UpdateCameraTemperature()
{
boost::lock_guard<boost::mutex> guard(this->mtx_);
boost::lock_guard<boost::mutex> guard(this->m_mutexCameraTemperature);
float chipTemp, houseTemp, houseBackSideTemp, sensorBoardTemp;
if (*m_cameraHandle != INVALID_HANDLE_VALUE)
{
Expand Down
8 changes: 4 additions & 4 deletions src/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CameraFamily
* Mutex used to lock access to variables like the camera temperature, this allows updating temperature from
* multiple threads.
*/
boost::mutex mtx_;
boost::mutex m_mutexCameraTemperature;

public:
explicit CameraFamily(HANDLE *handle) : m_cameraHandle(handle)
Expand Down Expand Up @@ -90,7 +90,7 @@ class CameraFamily
/*
* Queries camera temperature
*/
QMap<QString, float> getCameraTemperature();
QMap<QString, float> GetCameraTemperature();
};

/**
Expand Down Expand Up @@ -212,7 +212,7 @@ class Camera
* @param family family of the camera to be constructed
* @param handle camera handle used for all interactions with it
*/
Camera(std::unique_ptr<CameraFamily> *family, HANDLE *handle) : family(family), m_cameraHandle(handle)
Camera(std::unique_ptr<CameraFamily> *family, HANDLE *handle) : m_cameraFamily(family), m_cameraHandle(handle)
{
}

Expand All @@ -224,7 +224,7 @@ class Camera
/**
* Unique pointer to camera family
*/
std::unique_ptr<CameraFamily> *family;
std::unique_ptr<CameraFamily> *m_cameraFamily;

/**
* initializes camera by setting parameters such as framerate, binning mode,
Expand Down
4 changes: 2 additions & 2 deletions src/cameraInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int CameraInterface::OpenDevice(DWORD cameraDeviceID)
stat = this->m_apiWrapper->xiOpenDevice(cameraDeviceID, &m_cameraHandle);
HandleResult(stat, "xiOepnDevice");

this->setCamera(m_cameraType, m_cameraFamilyName);
this->SetCamera(m_cameraType, m_cameraFamilyName);

stat = this->m_camera->InitializeCamera();
if (stat != XI_OK)
Expand Down Expand Up @@ -169,7 +169,7 @@ CameraInterface::~CameraInterface()
}
}

void CameraInterface::setCamera(QString cameraType, QString cameraFamily)
void CameraInterface::SetCamera(QString cameraType, QString cameraFamily)
{
// instantiate camera type
if (cameraType == CAMERA_TYPE_SPECTRAL)
Expand Down
2 changes: 1 addition & 1 deletion src/cameraInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CameraInterface : public QObject
*/
~CameraInterface();

void setCamera(QString cameraType, QString cameraFamily);
void SetCamera(QString cameraType, QString cameraFamily);

/**
* @brief Initializes a device with the specified camera ID.
Expand Down
7 changes: 3 additions & 4 deletions src/display.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#include "display.h"

Displayer::Displayer()
Displayer::Displayer(QObject *parent) : QObject(parent)
{
}

Displayer::~Displayer()
{
}
Displayer::~Displayer() = default;

void Displayer::StopDisplayer()
{
Expand All @@ -16,4 +14,5 @@ void Displayer::StopDisplayer()
void Displayer::StartDisplayer()
{
this->m_stop = false;
this->m_displayCondition.notify_one();
}
37 changes: 33 additions & 4 deletions src/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
#ifndef DISPLAY_H
#define DISPLAY_H

#include <xiApi.h>

#include <QObject>
#include <QString>
#include <boost/thread.hpp>
#include <opencv2/core.hpp>
#include <xiApi.h>

class Displayer : public QObject
{
Q_OBJECT

public:
explicit Displayer();
explicit Displayer(QObject *parent = nullptr);

~Displayer();
~Displayer() override;

QString m_cameraType;

Expand All @@ -33,11 +34,39 @@ class Displayer : public QObject
*/
void StartDisplayer();

signals:
/**
* Qt signal emitted when an RGB image is ready to be displayed in the UI.
*/
void ImageReadyToUpdateRGB(cv::Mat &);

/**
* Qt signal emitted when a raw image is ready to be displayed in the UI.
*/
void ImageReadyToUpdateRaw(cv::Mat &);

/**
* Qt signal emitted when a new image is ready to compute the saturation percentage for the display.
*/
void SaturationPercentageImageReady(cv::Mat &);

protected:
/**
* Indicate that process should stop displaying images.
*/
bool m_stop = false;

/**
* condition variable used to wait until a new image is available to be processed.
*/
boost::condition_variable m_displayCondition;

public slots:

/**
* Qt slot in charge of displaying images.
* @param image
*/
virtual void Display(XI_IMG &image) = 0;
};

Expand Down
Loading