Compare commits
No commits in common. "155ac6b471e086eec1155e54b691973133940006" and "ec203ba1ada6f127dd8a9fbbd9ccbccbb4675655" have entirely different histories.
155ac6b471
...
ec203ba1ad
@ -43,10 +43,10 @@ include_directories (AFTER ${NIX_INCLUDE_DIR})
|
||||
|
||||
# #######################################
|
||||
# OPENCV
|
||||
# message ("=> finding opencv ...")
|
||||
# find_package(OpenCV REQUIRED opencv_highgui opencv_core)
|
||||
# include_directories(AFTER ${OpenCV_INCLUDE_DIRS} )
|
||||
# set(LINK_LIBS ${LINK_LIBS} ${OpenCV_LIBRARIES})
|
||||
message ("=> finding opencv ...")
|
||||
find_package(OpenCV REQUIRED opencv_highgui opencv_core)
|
||||
include_directories(AFTER ${OpenCV_INCLUDE_DIRS} )
|
||||
set(LINK_LIBS ${LINK_LIBS} ${OpenCV_LIBRARIES})
|
||||
|
||||
#######################################
|
||||
# Pylon
|
||||
@ -58,5 +58,5 @@ file (GLOB RECORDER_SOURCES *.cpp)
|
||||
file (GLOB RECORDER_INCLUDES *.hpp)
|
||||
add_executable ( recorder ${RECORDER_SOURCES} ${RECORDER_INCLUDES} ${RECORDER_RES_SOURCES} )
|
||||
target_include_directories ( recorder PUBLIC "${PROJECT_BINARY_DIR}" )
|
||||
target_link_libraries ( recorder Qt5::PrintSupport Qt5::Core Qt5::Widgets Qt5::Gui ${NIX_LIBRARIES} pylon::pylon)
|
||||
target_link_libraries ( recorder Qt5::PrintSupport Qt5::Core Qt5::Widgets Qt5::Gui ${NIX_LIBRARIES} pylon::pylon ${OpenCV_LIBRARIES})
|
||||
# ${PYLON_LIBRARIES} ${OpenCV_LIBRARIES})
|
@ -60,7 +60,8 @@ CameraPreview::CameraPreview(QWidget *parent):cameraname(""), camera(nullptr), Q
|
||||
void CameraPreview::setCamera(QString &device){
|
||||
qDebug() << "update camera! ";// << device.toStdString();
|
||||
cameraname = device;
|
||||
if (camera != nullptr) {
|
||||
label->setText(device);
|
||||
if (camera != NULL) {
|
||||
qDebug() << "camera is not nullptr! ";
|
||||
delete camera;
|
||||
camera = nullptr;
|
||||
@ -75,9 +76,7 @@ void CameraPreview::setCamera(QString &device){
|
||||
QString msg = "<p><b>Could not open camera device!</b><p><p>" + QString::fromStdString(message) + "</p>";
|
||||
msgBox.setText(msg);
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
label->setText(device + " - " + camera->userName());
|
||||
takeStill();
|
||||
}
|
||||
|
||||
|
48
camids.cpp
48
camids.cpp
@ -1,48 +0,0 @@
|
||||
#include "camids.h"
|
||||
#include "mylogger.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
|
||||
CameraID::CameraID(Pylon::DeviceInfoList &deviceList, QWidget *parent) :
|
||||
deviceList(deviceList), QDialog(parent) {
|
||||
device_combo = new QComboBox(this);
|
||||
for (auto d : deviceList) {
|
||||
device_combo->addItem(QString(d.GetFullName()) + " - " + QString(d.GetUserDefinedName()));
|
||||
}
|
||||
connect(device_combo, SIGNAL(currentIndexChanged(int)), SLOT(primaryDeviceChanged(int)));
|
||||
|
||||
QWidget *header = new QWidget(this);
|
||||
QGridLayout *grid = new QGridLayout(header);
|
||||
grid->addWidget(new QLabel("Camera device:", this), 1, 0);
|
||||
grid->addWidget(device_combo, 1, 1);
|
||||
|
||||
edit = new QLineEdit(this);
|
||||
grid->addWidget(new QLabel("Camera Id", this), 2, 0);
|
||||
grid->addWidget(edit, 2, 1);
|
||||
header->setLayout(grid);
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->addWidget(header);
|
||||
|
||||
buttonbox = new QDialogButtonBox(QDialogButtonBox::Ok
|
||||
| QDialogButtonBox::Cancel);
|
||||
connect(buttonbox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(buttonbox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
vbox->addWidget(buttonbox);
|
||||
std::cerr <<"ping\n";
|
||||
}
|
||||
|
||||
void CameraID::setID() {
|
||||
std::cerr << "Set ID!" << std::endl;
|
||||
}
|
||||
|
||||
QString CameraID::newID() {
|
||||
std::cerr <<"ping\n";
|
||||
return edit->text();
|
||||
}
|
||||
|
||||
int CameraID::cameraIndex() {
|
||||
std::cerr <<"ping\n";
|
||||
return device_combo->currentIndex();
|
||||
}
|
45
camids.h
45
camids.h
@ -1,45 +0,0 @@
|
||||
#ifndef CAMIDS_H
|
||||
#define CAMIDS_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QDialogButtonBox>
|
||||
#include <pylon/PylonIncludes.h>
|
||||
|
||||
#include "mylogger.h"
|
||||
|
||||
namespace Ui {
|
||||
class CameraID;
|
||||
}
|
||||
|
||||
class CameraID : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CameraID(Pylon::DeviceInfoList_t &deviceList, QWidget *parent = 0);
|
||||
// ~CameraID(){};
|
||||
QString newID();
|
||||
int cameraIndex();
|
||||
|
||||
public slots:
|
||||
void setID();
|
||||
|
||||
// signals:
|
||||
// void column_visibility_changed(QString who, QString column, bool state);
|
||||
// void recent_file_changed(QStringList);
|
||||
|
||||
private:
|
||||
Pylon::DeviceInfoList_t deviceList;
|
||||
QComboBox *device_combo;
|
||||
QLineEdit *edit;
|
||||
QDialogButtonBox *buttonbox;
|
||||
|
||||
};
|
||||
|
||||
#endif // CAMIDS_H
|
||||
|
@ -61,8 +61,8 @@ PylonRecorder::PylonRecorder(QWidget *parent)
|
||||
QPalette progressPalette = pressureBar->palette();
|
||||
progressPalette.setBrush(QPalette::Highlight, QBrush(color));
|
||||
pressureBar->setPalette(progressPalette);
|
||||
QLabel *pressureLabel = new QLabel("Buffer pressure:", this);
|
||||
pressureLabel->setStyleSheet("QLabel{font-size: 11pt;font-family: Arial;font-weight: Bold}");
|
||||
QLabel *preassureLabel = new QLabel("Buffer preassure:", this);
|
||||
preassureLabel->setStyleSheet("QLabel{font-size: 11pt;font-family: Arial;font-weight: Bold}");
|
||||
loadBar = new QProgressBar(this);
|
||||
loadBar->setRange(0, defaultBufferSize);
|
||||
loadBar->setFixedSize(200, 25);
|
||||
@ -89,7 +89,7 @@ PylonRecorder::PylonRecorder(QWidget *parent)
|
||||
fileHeader->setStyleSheet("QLabel{font-size: 11pt;font-family: Arial; font-weight: Bold}");
|
||||
statusBar()->addWidget(camHeader);
|
||||
statusBar()->addWidget(cameraConnectedLabel);
|
||||
statusBar()->addWidget(pressureLabel);
|
||||
statusBar()->addWidget(preassureLabel);
|
||||
statusBar()->addWidget(pressureBar);
|
||||
statusBar()->addWidget(loadLabel);
|
||||
statusBar()->addWidget(loadBar);
|
||||
@ -434,7 +434,6 @@ void PylonRecorder::createActions() {
|
||||
connect_camera_action->setStatusTip(tr("Connect to to camera and open device"));
|
||||
disconnect_camera_action = camera_menu->addAction(disconnect_icon, tr("&disconnect"), this, &PylonRecorder::disconnectCamera);
|
||||
disconnect_camera_action->setStatusTip(tr("Disconnect from the camera device"));
|
||||
disconnect_camera_action->setEnabled(false);
|
||||
camera_menu->addSeparator();
|
||||
grab_still_action = camera_menu->addAction(snapshot_icon, tr("&grab still"), this, &PylonRecorder::grabStillFromPylon);
|
||||
grab_still_action->setStatusTip(tr("Grab single image from Pylon camera"));
|
||||
@ -443,9 +442,6 @@ void PylonRecorder::createActions() {
|
||||
grab_continuous_action->setShortcut(tr("Ctrl+Enter"));
|
||||
grab_stop_action = camera_menu->addAction(stop_icon, tr("&stop grabbing"), this, &PylonRecorder::stopRecording);
|
||||
grab_stop_action->setShortcut(tr("Ctrl+Shift+Enter"));
|
||||
set_cam_identifier_action = camera_menu->addAction(tr("set identifier"), this, &PylonRecorder::setCameraIDs);
|
||||
set_cam_identifier_action->setStatusTip(tr("Set human readable camera identifier or easier recognition."));
|
||||
set_cam_identifier_action->setToolTip(tr("Set human readable camera identifier or easier recognition."));
|
||||
|
||||
selectStorageAction = new QAction(tr("storage location"), this);
|
||||
selectStorageAction->setStatusTip(tr("Select a storage location for the recorded videos"));
|
||||
@ -538,37 +534,15 @@ void PylonRecorder::updateActions() {
|
||||
zoomInAct->setEnabled(!fitToWindowAct->isChecked());
|
||||
zoomOutAct->setEnabled(!fitToWindowAct->isChecked());
|
||||
normalSizeAct->setEnabled(!fitToWindowAct->isChecked());
|
||||
disconnect_camera_action->setEnabled(cameraOpened);
|
||||
disconnect_camera_action->setEnabled(deviceList.size() > 0);
|
||||
connect_camera_action->setEnabled(true);
|
||||
grab_still_action->setEnabled(cameraOpened);
|
||||
grab_still_action->setEnabled(deviceList.size() > 0);
|
||||
grab_continuous_action->setEnabled(cameraOpened && !grabbing);
|
||||
// grab_continuous_action->setEnabled(!grabbing);
|
||||
grab_stop_action->setEnabled(grabbing);
|
||||
set_cam_identifier_action->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
void PylonRecorder::setCameraIDs() {
|
||||
if (deviceList.size() == 0) {
|
||||
QMessageBox msgBox;
|
||||
QString msg = "<p><b>No camera device found!</b></p><br><p>Connect camera and try again!</p>";
|
||||
msgBox.setText(msg);
|
||||
msgBox.exec();
|
||||
qWarning() << msg.toStdString().c_str();
|
||||
return;
|
||||
}
|
||||
cameraIdDialog = new CameraID(deviceList, this);
|
||||
connect(cameraConfigDialog, SIGNAL(accepted()), SLOT(cameraIDAccepted()));
|
||||
std::cerr <<"ping\n";
|
||||
cameraIdDialog->exec();
|
||||
}
|
||||
|
||||
void PylonRecorder::cameraIDAccepted() {
|
||||
QString newid = cameraIdDialog->newID();
|
||||
int deviceindex = cameraIdDialog->cameraIndex();
|
||||
std::cerr << "New camera id " << newid.toStdString() << " index: " << deviceindex << std::endl;
|
||||
delete(cameraIdDialog);
|
||||
}
|
||||
|
||||
void PylonRecorder::scaleImage(double factor) {
|
||||
QPixmap map = imageLabel->pixmap(Qt::ReturnByValue);
|
||||
Q_ASSERT(!map.isNull());
|
||||
@ -608,19 +582,19 @@ void PylonRecorder::adjustScrollBar(QScrollBar *scrollBar, double factor) {
|
||||
|
||||
|
||||
void PylonRecorder::cameraConfiguration(){
|
||||
cameraConfigDialog = new CamConfigurator(deviceList, this);
|
||||
connect(cameraConfigDialog, SIGNAL(accepted()), SLOT(cameraConfigurationAccepted()));
|
||||
connect(cameraConfigDialog, SIGNAL(rejected()), SLOT(cameraConfigurationAborted()));
|
||||
d = new CamConfigurator(deviceList, this);
|
||||
connect(d, SIGNAL(accepted()), SLOT(cameraConfigurationAccepted()));
|
||||
connect(d, SIGNAL(rejected()), SLOT(cameraConfigurationAborted()));
|
||||
// QObject::connect(&d, SIGNAL(column_visibility_changed(QString, QString,bool)), this, SLOT(visible_columns_update(QString, QString,bool)));
|
||||
cameraConfigDialog->exec();
|
||||
d->exec();
|
||||
}
|
||||
|
||||
|
||||
void PylonRecorder::cameraConfigurationAccepted() {
|
||||
qDebug() << "Cameras setting " << ((cameraConfigDialog->result()) ? "Accepted" : "Discarded");
|
||||
this->layout = cameraConfigDialog->layout();
|
||||
qDebug() << "Cameras setting " << ((d->result()) ? "Accepted" : "Discarded");
|
||||
this->layout = d->layout();
|
||||
camsconfigured = true;
|
||||
delete cameraConfigDialog;
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,9 +13,9 @@
|
||||
#include "grabber.h"
|
||||
#include "dualcamgrabber.h"
|
||||
#include "writer.h"
|
||||
#include "opencvwriter.h"
|
||||
#include "projectsettings.h"
|
||||
#include "camconfig.h"
|
||||
#include "camids.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <QImage>
|
||||
@ -71,8 +71,6 @@ private slots:
|
||||
void selectStorageLocation();
|
||||
void cameraConfigurationAccepted();
|
||||
void cameraConfigurationAborted();
|
||||
void setCameraIDs();
|
||||
void cameraIDAccepted();
|
||||
|
||||
private:
|
||||
void createActions();
|
||||
@ -89,6 +87,7 @@ private:
|
||||
VideoSpecs getVideoSpecs(const ImageSettings &settings);
|
||||
void startSinglecamRecording();
|
||||
void startDualcamRecording();
|
||||
|
||||
bool saveFile(const QString &fileName);
|
||||
void setImage(const QImage &newImage);
|
||||
void scaleImage(double factor);
|
||||
@ -123,9 +122,8 @@ private:
|
||||
QString storageLocation = "";
|
||||
ProjectMetadata mdata;
|
||||
Pylon::DeviceInfoList_t deviceList;
|
||||
CamConfigurator *d;
|
||||
Pylon::PylonAutoInitTerm autoInitTerm;
|
||||
CamConfigurator *cameraConfigDialog;
|
||||
CameraID *cameraIdDialog;
|
||||
|
||||
|
||||
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printer)
|
||||
@ -144,7 +142,6 @@ private:
|
||||
QAction *grab_stop_action;
|
||||
QAction *connect_camera_action;
|
||||
QAction *disconnect_camera_action;
|
||||
QAction *set_cam_identifier_action;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -232,9 +232,3 @@ void PylonWrapper::closeCamera() {
|
||||
Pylon::CInstantCamera *PylonWrapper::getCamera() {
|
||||
return camera;
|
||||
}
|
||||
|
||||
QString PylonWrapper::userName() {
|
||||
GenApi::INodeMap& nodemap = camera->GetNodeMap();
|
||||
QString username = Pylon::CStringParameter(nodemap, "DeviceUserID").GetValue().c_str();
|
||||
return username;
|
||||
}
|
@ -27,7 +27,6 @@ public:
|
||||
bool exposureTime(double exposure_time);
|
||||
double gain();
|
||||
bool gain(double gain_db);
|
||||
QString userName();
|
||||
Pylon::CInstantCamera *getCamera();
|
||||
void resetCamera();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user