add user given camera name to configuration
This commit is contained in:
parent
18f088c4fd
commit
155ac6b471
@ -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 ${OpenCV_LIBRARIES})
|
||||
target_link_libraries ( recorder Qt5::PrintSupport Qt5::Core Qt5::Widgets Qt5::Gui ${NIX_LIBRARIES} pylon::pylon)
|
||||
# ${PYLON_LIBRARIES} ${OpenCV_LIBRARIES})
|
@ -60,8 +60,7 @@ CameraPreview::CameraPreview(QWidget *parent):cameraname(""), camera(nullptr), Q
|
||||
void CameraPreview::setCamera(QString &device){
|
||||
qDebug() << "update camera! ";// << device.toStdString();
|
||||
cameraname = device;
|
||||
label->setText(device);
|
||||
if (camera != NULL) {
|
||||
if (camera != nullptr) {
|
||||
qDebug() << "camera is not nullptr! ";
|
||||
delete camera;
|
||||
camera = nullptr;
|
||||
@ -76,7 +75,9 @@ 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();
|
||||
}
|
||||
|
||||
|
@ -443,6 +443,9 @@ 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"));
|
||||
@ -540,9 +543,32 @@ void PylonRecorder::updateActions() {
|
||||
grab_still_action->setEnabled(cameraOpened);
|
||||
grab_continuous_action->setEnabled(cameraOpened && !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());
|
||||
@ -582,19 +608,19 @@ void PylonRecorder::adjustScrollBar(QScrollBar *scrollBar, double factor) {
|
||||
|
||||
|
||||
void PylonRecorder::cameraConfiguration(){
|
||||
d = new CamConfigurator(deviceList, this);
|
||||
connect(d, SIGNAL(accepted()), SLOT(cameraConfigurationAccepted()));
|
||||
connect(d, SIGNAL(rejected()), SLOT(cameraConfigurationAborted()));
|
||||
cameraConfigDialog = new CamConfigurator(deviceList, this);
|
||||
connect(cameraConfigDialog, SIGNAL(accepted()), SLOT(cameraConfigurationAccepted()));
|
||||
connect(cameraConfigDialog, SIGNAL(rejected()), SLOT(cameraConfigurationAborted()));
|
||||
// QObject::connect(&d, SIGNAL(column_visibility_changed(QString, QString,bool)), this, SLOT(visible_columns_update(QString, QString,bool)));
|
||||
d->exec();
|
||||
cameraConfigDialog->exec();
|
||||
}
|
||||
|
||||
|
||||
void PylonRecorder::cameraConfigurationAccepted() {
|
||||
qDebug() << "Cameras setting " << ((d->result()) ? "Accepted" : "Discarded");
|
||||
this->layout = d->layout();
|
||||
qDebug() << "Cameras setting " << ((cameraConfigDialog->result()) ? "Accepted" : "Discarded");
|
||||
this->layout = cameraConfigDialog->layout();
|
||||
camsconfigured = true;
|
||||
delete d;
|
||||
delete cameraConfigDialog;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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,6 +71,8 @@ private slots:
|
||||
void selectStorageLocation();
|
||||
void cameraConfigurationAccepted();
|
||||
void cameraConfigurationAborted();
|
||||
void setCameraIDs();
|
||||
void cameraIDAccepted();
|
||||
|
||||
private:
|
||||
void createActions();
|
||||
@ -87,7 +89,6 @@ private:
|
||||
VideoSpecs getVideoSpecs(const ImageSettings &settings);
|
||||
void startSinglecamRecording();
|
||||
void startDualcamRecording();
|
||||
|
||||
bool saveFile(const QString &fileName);
|
||||
void setImage(const QImage &newImage);
|
||||
void scaleImage(double factor);
|
||||
@ -122,8 +123,9 @@ 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)
|
||||
@ -142,6 +144,7 @@ private:
|
||||
QAction *grab_stop_action;
|
||||
QAction *connect_camera_action;
|
||||
QAction *disconnect_camera_action;
|
||||
QAction *set_cam_identifier_action;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -232,3 +232,9 @@ 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,6 +27,7 @@ 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